Proyecto

General

Perfil

« Anterior | Siguiente » 

Revisión 487

dhcp-server-denegar

Ver diferencias:

dhcp-server-denegar/trunk/dhcp-server-denegar
#!/bin/bash
### BEGIN INIT INFO
# Provides: dhcp-server-denegar
# Required-Start: $remote_fs $all
# Required-Stop:
# Should-Start: $network
# Should-Stop:
# Default-Start: 2
# Default-Stop:
# Short-Description: Genera el fichero dhcpd.conf, denegando la entrada a los no permitidos
# Description: Controla el acceso al sistema. Los equipos denegados no tomarán ip
### END INIT INFO
# ***********************************************************************************************************
# Antonio J. Abasolo Sierra (Dic-2012)
# IES Rodriguez Moñino
......
# Se base en el sistema de lista blanca (mantenida por el usuario),
# y lista negra (obtenida por filtrado de entradas del fichero del servidor dhcp: dhcpd.leases)
# Las entradas manuales que se hagan en la lista negra, también se mantienen.
# Si un equipo está en ambas listas, se le denegará el acceso: sistema deny,access
#
# La Lista_Blanca de equipos que dejamos conectarse la mantenemos nosotros, y debe tener este formato:
# MAC,EQUIPO[,IP][,NOMBRE]
......
echo "" >> $FILE_CONF
echo "# Equipos con entrada denegada:" >> $FILE_CONF
echo "# -----------------------------" >> $FILE_CONF
cat $LISTA_NEGRA | while read linea; do
cat $LISTA_NEGRA | grep -v '#' | while read linea; do
NUMPC=`expr $NUMPC + 1`
MAC=`echo $linea | cut -f1 -d,`
PC=`echo $linea | cut -f2 -d, | tr '-' '_'`
......
if [ "$PC" ]; then
EQUIPO=$EQUIPO"_"$PC
fi
echo "host $EQUIPO {
if [ "$MAC" ]; then
echo "host $EQUIPO {
hardware ethernet $MAC;
deny booting;
}" >> $FILE_CONF
}" >> $FILE_CONF
fi
done
}

Exportar a: Unified diff