Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-watchdog.sh 2454 2017-12-09 18:59:31Z tom.houdayer $
|
2 |
# $Id: alcasar-watchdog.sh 2455 2017-12-09 19:14:05Z tom.houdayer $
|
3 |
|
3 |
|
4 |
# alcasar-watchdog.sh
|
4 |
# alcasar-watchdog.sh
|
5 |
# by Rexy
|
5 |
# by Rexy
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
7 |
# - Ce script prévient les usagers de l'indisponibilité de l'accès Internet
|
7 |
# - Ce script prévient les usagers de l'indisponibilité de l'accès Internet
|
Line 135... |
Line 135... |
135 |
then
|
135 |
then
|
136 |
arp_reply=`/usr/sbin/arping -b -I$INTIF -s$PRIVATE_IP -c1 -w4 $active_ip|grep -c "Unicast reply"`
|
136 |
arp_reply=`/usr/sbin/arping -b -I$INTIF -s$PRIVATE_IP -c1 -w4 $active_ip|grep -c "Unicast reply"`
|
137 |
# disconnect users whose equipement is usurped. For example, if there are 2 same @MAC it will make 2 lines in output.
|
137 |
# disconnect users whose equipement is usurped. For example, if there are 2 same @MAC it will make 2 lines in output.
|
138 |
if [[ $(expr $arp_reply) -gt 1 ]]
|
138 |
if [[ $(expr $arp_reply) -gt 1 ]]
|
139 |
then
|
139 |
then
|
140 |
echo "$(date "+[%x-%X] : ")alcasar-watchdog : $active_ip is usurped ($active_mac). Alcasar disconnect the user ($active_user)." >> /var/Save/security/watchdog.log
|
140 |
echo "[$(date +"%Y-%m-%d %H:%M:%S")] : alcasar-watchdog : $active_ip is usurped ($active_mac). Alcasar disconnect the user ($active_user)." >> /var/Save/security/watchdog.log
|
141 |
logger "alcasar-watchdog : $active_ip is usurped ($active_mac). Alcasar disconnect the user ($active_user)."
|
141 |
logger "alcasar-watchdog : $active_ip is usurped ($active_mac). Alcasar disconnect the user ($active_user)."
|
142 |
/usr/sbin/chilli_query logout $active_mac
|
142 |
/usr/sbin/chilli_query logout $active_mac
|
143 |
chmod 644 /var/Save/security/watchdog.log
|
143 |
chmod 644 /var/Save/security/watchdog.log
|
144 |
fi
|
144 |
fi
|
145 |
fi
|
145 |
fi
|