(root)/scripts/alcasar-flush_ipset_wl.sh @ 3054 – Rev 1906
Rev 1905 |
Rev 1907 |
Go to most recent revision |
Details |
Compare with Previous |
Last modification |
View Log
Rev |
Author |
Line No. |
Line |
1905 |
raphael.pi |
1 |
#!/bin/sh
|
|
|
2 |
#by Raphaël Pion
|
|
|
3 |
#Permet de vider l'ipset wl_ip_allowed lorsque tous les utilisateurs de la whitelist sont déconnectés
|
|
|
4 |
#Clean wl_ip_allowed ipset when WL users are gone.
|
|
|
5 |
|
|
|
6 |
PTN="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
|
1906 |
raphael.pi |
7 |
NB_USERS=$(ipset list havp_wl | grep -E $PTN | wc -l)
|
|
|
8 |
if [ $NB_USERS -eq '0' ]
|
1905 |
raphael.pi |
9 |
then
|
|
|
10 |
ipset flush wl_ip_allowed
|
|
|
11 |
fi
|