Subversion Repositories ALCASAR

Rev

Rev 2474 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2157 franck 1
#!/bin/bash
2
# $Id: alcasar-watchdog-hl/sh 2113 2017-01-08 22:43:26Z richard $
3
 
4
# alcasar-watchdog-hl.sh
5
# by 3abtux
6
# This script is distributed under the Gnu General Public License (GPL)
2516 rexy 7
# - Ce script déconnecte les équipements réseau qui sont identifiés en 0.0.0.0 (lancé optionnellement par cron dans /etc/cron.d/alcasar-watchdog)
8
# - This script disconnects the network equipments which are identified in 0.0.0.0 (optionally run by cron in /etc/cron.d/alcasar-watchdog)
2157 franck 9
 
10
OLDIFS=$IFS
11
IFS=$'\n'
12
 
13
usage="Usage: alcasar-watchdog-hl.sh "
14
case $1 in
15
	-\? | -h* | --h*)
16
		echo "$usage"
17
		exit 0
18
		;;
19
	*)
2516 rexy 20
		# searching for 0.0.0.0 IP
2157 franck 21
		for system in `/usr/sbin/chilli_query list |grep  "0\.0\.0\.0 dnat"`
22
		do
23
			active_mac=`echo $system | cut -d" " -f1`
2516 rexy 24
			echo "$(date "+[%x-%X] : ")alcasar-watchdog-hl : $active_mac has 0.0.0.0 IP address. Alcasar release the equipment." >> /var/Save/security/watchdog-hl.log
2157 franck 25
			/usr/sbin/chilli_query dhcp-release $active_mac
26
		done
27
		;;
28
esac	
29
IFS=$OLDIFS