Skip to content

Instantly share code, notes, and snippets.

@claytonaalves
Created January 12, 2012 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save claytonaalves/1601702 to your computer and use it in GitHub Desktop.
Save claytonaalves/1601702 to your computer and use it in GitHub Desktop.
Simple checkrad freeradius bash script
#!/bin/bash
if [ $# -eq 0 ]; then
echo Uso: checkrad nas_type nas_ip nas_port login session_id
exit 1
fi
function checa {
if [ $? -eq 0 ]; then
data=$(date +"%d/%m/%Y %H:%M:%S")
echo "$data - Usuário '$username' já está conectado em $nas" >> /var/log/radius/checkrad.log
exit 1
fi
}
username=$4
nas=$2
snmpwalk -v1 -cpublic $nas ifdescr | grep "<pppoe-$username>" > /dev/null
checa
snmpwalk -v1 -cpublic $nas enterprises.14988.1.1.5.1.1.3 | grep \"$username\" > /dev/null
checa
exit 0
@claytonaalves
Copy link
Author

Implementado também a checagem de hotspot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment