NetworkManager script for Cyberoam Authentication

Share on Facebook0Tweet about this on TwitterShare on Google+0

If you have to authenticate through Cyberoam to get access to the Internet, you need a client. On Windows there is a small tray application which logs you into the system upon every system startup.

On Linux there is also a client but it is a command-line tool and prebuilt for 32-bit x86 architecture. I’ve written a small script for NetworkManager that will log you in on every interface down/up event. In order to make this work, you have to put the downloaded binary into /bin (or adjust the $CRCLIENT variable). You also have to create a configuration file which will include your login credentials (this file is pointed by $CONF).

Also do not forget to install compatibility libraries if you’re running an x86_64 operating systems. Under Fedora, you will have to install the package glibc.i686 to satisfy the dependencies of crclient.

After setting up crclient, copy the below script under /etc/NetworkManager/dispatcher.d/00-cyberoam and make it executable.

#!/bin/sh
 
CRCLIENT=/bin/crclient
CONF="/etc/CyberClient.conf"
USERNAME=`awk '/^User/{print $2}' $CONF`
 
# Cleanup stale PID-like file
rm -rf /tmp/CyberClient*
 
if [ "$2" = "up" ]; then
$CRCLIENT -u $USERNAME -i $1 -f $CONF
fi
 
if [ "$2" = "down" ]; then
$CRCLIENT -l $USERNAME
fi
 
exit 0
Share on Facebook0Tweet about this on TwitterShare on Google+0