/scripts/alcasar-condown.sh |
---|
20,6 → 20,7 |
# 1: profile_2 (WEB + Mail + Remote access) |
# 2: profile_3 (Custom) |
# 3: warn_user (if imputability report has been generated) |
# 4: status_open_required (check user activity through status page) |
# 5: WL |
# 6: BL |
# 7: HAVP |
49,7 → 50,7 |
# Remove IP address from active users |
current_users_file="/var/tmp/havp/current_users.txt" |
[ -e $current_users_file ] && sed -i "/^$FRAMED_IP_ADDRESS\$/d" $current_users_file |
[ -e $current_users_file ] && sed -i "/^$FRAMED_IP_ADDRESS:/d" $current_users_file |
# Debug : show all the coova parse variables (+ $set_filter + $set_proto). |
# see "/src/chilli.c" for the complete list of parse variables |
/scripts/alcasar-conup.sh |
---|
20,6 → 20,7 |
# 1: profile_2 (WEB + Mail + Remote access) |
# 2: profile_3 (Custom) |
# 3: warn_user (if imputability report has been generated) |
# 4: status_open_required (check user activity through status page) |
# 5: WL |
# 6: BL |
# 7: HAVP |
47,6 → 48,13 |
ipset add $set_filter $FRAMED_IP_ADDRESS |
ipset add $set_proto $FRAMED_IP_ADDRESS |
# Add user IP permanently to current_users.txt if no status_open_required |
current_users_file="/var/tmp/havp/current_users.txt" |
[ ! -e $current_users_file ] && touch $current_users_file && chown apache:apache $current_users_file |
if [ ${FILTER_ID:4:1} == '0' ]; then # no status_open_required |
echo "$FRAMED_IP_ADDRESS:PERM" >> $current_users_file |
fi |
# Debug : show all the coova parse variables (+ $set_filter + $set_proto). |
# see "/src/chilli.c" for the complete list of parse variables |
#echo "-----------------------------------------------" >> /tmp/debug-conup.txt |
/scripts/alcasar-watchdog.sh |
---|
105,7 → 105,7 |
lan_test |
# We disconnect inactive users (its means that their 'status.php' tab has been closed --> their ip address isn't in $current_users_file) |
# process each equipment known by chilli to check if IP address is usurped (with arping) |
for system in `/usr/sbin/chilli_query list |grep -v "\.0\.0\.0"` |
for system in `/usr/sbin/chilli_query list | grep -v "0\.0\.0\.0"` |
do |
active_ip=`echo $system |cut -d" " -f2` |
active_session=`echo $system |cut -d" " -f5` |
116,14 → 116,14 |
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\$" -c) |
cmp_user_ok=$(cat $current_users_file | awk -F':' "\$1 == \"$active_ip\" {print \$2}") |
# If not we disconnect this user. |
if [ $cmp_user_ok -eq 0 ]; then |
if [ -z "$cmp_user_ok" ]; 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 |
elif [ "$cmp_user_ok" == "TEMP" ]; then |
# 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 |
sed -i "/^$active_ip:$cmp_user_ok\$/d" $current_users_file |
fi |
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" |