71,7 → 71,7 |
IP_GW=`/sbin/ip route list|grep ^default|cut -d" " -f3` |
arp_reply=`/usr/sbin/arping -I$EXTIF -c1 $IP_GW|grep response|cut -d" " -f2` |
if [ $arp_reply -eq "0" ] |
then |
then |
LAN_DOWN="2" |
fi |
fi |
116,14 → 116,15 |
if [ "$active_user" != "$active_mac" ] && [ $(expr $active_session) -eq 1 ]; then |
if [ -e $current_users_file ]; then |
# We check if user @IP is in 'current_users.txt' |
cmp_user_ok=$(cat $current_users_file | grep $active_ip | wc -w) |
cmp_user_ok=$(cat $current_users_file | grep "^$active_ip\$" -c) |
# If not we disconnect this user. |
if [ $cmp_user_ok -eq 0 ]; then |
logger "alcasar-watchdog : $active_ip ($active_mac) can't be contact. We disconnects the user ($active_user)." |
/usr/sbin/chilli_query logout $active_mac |
else |
# Remove the user's IP from 'current_users.txt'. Every user need to insert their @IP everytime to prove their connectivity. |
sed -i "/^$active_ip\$/d" $current_users_file |
fi |
# Remove the user's IP from 'current_users.txt'. Every user need to insert their @IP everytime to prove their connectivity. |
sed -i "/^$active_ip/d" $current_users_file |
else # "current_user.txt" does not exists. We disconnect every users. |
logger "alcasar-watchdog : The file /var/tmp/havp/current_users.txt doen't' exist. We disconnects the user $active_user" |
/usr/sbin/chilli_query logout $active_mac |
135,7 → 136,7 |
arp_reply=`/usr/sbin/arping -b -I$INTIF -s$PRIVATE_IP -c1 -w4 $active_ip|grep -c "Unicast reply"` |
# disconnect users whose equipement is usurped. For example, if there are 2 same @MAC it will make 2 lines in output. |
if [[ $(expr $arp_reply) -gt 1 ]] |
then |
then |
echo "$(date "+[%x-%X] : ")alcasar-watchdog : $active_ip is usurped ($active_mac). Alcasar disconnect the user ($active_user)." >> /var/Save/security/watchdog.log |
logger "alcasar-watchdog : $active_ip is usurped ($active_mac). Alcasar disconnect the user ($active_user)." |
/usr/sbin/chilli_query logout $active_mac |