User Tools

Site Tools


vpnc_gui

Table of Contents

EEEPC VPNC GUI AND ACCEPTING DYNAMIC USER NAME AND PASSWORD . . . .

This instructions should be followed once you have been through the link http://wiki.eeeuser.com/howto:vpn#cisco_vpn

Here is the script which will allow you to run vpnc and give GUI, a link to vpnc (to connect and disconnect the vpn connection) in EASY MODE.

Script to make running it easier (Running VPNC using GUI):

The script will be stored at /usr/local/bin/vpn with the user as an owner of the file.

#!/bin/sh

vpn_running=0

vpn_running=$(ps xa | grep -v grep | grep vpnc-connect | awk '{print $1}')

echo $vpn_running

if test “$vpn_running” -gt 0;

then

#KDE sudo command

kdesu -c /usr/sbin/vpnc-disconnect

kdialog -title 'VPNC status:' -passivepopup “VPN Connection has been stopped!” 5

else

vpns=$(kdesu -c /bin/ls /etc/vpnc/|grep \.conf|/usr/bin/cut -d / -f 4|/usr/bin/cut -d . -f 1)

let count=$(echo $vpns| wc -w)

if [ “$count” -gt 1 ];

then

vpn=$(kdialog -combobox 'Choose the vpn connection to establish' $vpns)

usrname=$(kdialog –title “VPNC CLIENT” –inputbox “Enter the username”)

passwd=$(kdialog –title “VPNC CLIENT” –password “Please Enter the password”)

else

kdialog -msgbox $vpns

vpn=$vpns

fi

if test ${#vpn} -gt 0

then

#Writing variables to config file because passing them as arguments dont work

echo “Xauth username $usrname” | sudo tee -a /etc/vpnc/$vpn.conf

echo “Xauth password $passwd” | sudo tee -a /etc/vpnc/$vpn.conf

kdialog -title 'VPNC status:' -passivepopup “`kdesu -c /usr/sbin/vpnc-connect $vpn.conf`” 5

sudo cp /etc/vpnc/$vpn.conf /etc/vpnc/new

sudo egrep -v “Xauth” /etc/vpnc/new > /etc/vpnc/$vpn.conf

sudo cat /dev/null > /etc/vpnc/new

else

kdialog -title 'VPNC status:' -passivepopup “Cancelled by user”

fi

fi

####

Now you need to have an icon on the easy mode desktop… so that the normal user can just click the Icon and connect to VPN network by running the above script.

Copy Global Configuration

cp /opt/xandros/share/AsusLauncher/simpleui.rc /home/user/.AsusLauncher/

Edit it


vim /home/user/.AsusLauncher/simpleui.rc

Add: Copy Global Configuration

cp /opt/xandros/share/AsusLauncher/simpleui.rc /home/user/.AsusLauncher/

Edit it


vim /home/user/.AsusLauncher/simpleui.rc

Add: <parcel extraargs=”/usr/bin/sudo /usr/local/bin/vpn” simplecat=“Favorites” selected_icon=“add_remove_favorites_hi.png” icon=“add_remove_favorites_norm.png” >

      <name lang="en" >VPN CLIENT</name>

</parcel>

This will add a icon linked to the VPN Script to the favourites tab.

Logout….restart… enjoy!

Special thanks to Louis Slabbert and Leonard Miraziz for their inputs . . . :)

Author: Dhawal Thakker.

p.s: Permission on the script and configuration file could be an issue, as it will be run by user. So make sure the permission to the user are given correctly and the user have permission to change to /etc/vpnc directroy. Questions can be sent at dhawalthakker@rediffmail.com .

vpnc_gui.txt · Last modified: 2009/08/27 08:45 by dhawalthakker