Subjectively

dd if=/dev/random | kirk > blog

Subjectively header image 2

How to configure vpnc for cisco concentrator with RSA SecurID on ubuntu

August 24th, 2010 · No Comments · Linux

Do this in a shell:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
sudo su -
#Make sure you have what it takes to compile it.
apt-get install dpkg-dev
#Here are the libraries that are missing
#  that we need for the cisco concentrator
apt-get install libgcrypt11-dev
apt-get install libssl-dev
# So we have to get the source and compile it ourselves
apt-get source vpnc
cd vpnc-0.5.3
# and remove the comment so it will actually *USE*
#   the libraries we added
sed -i 's/^#OPENSSL/OPENSSL/' Makefile
# Prepare the dependencies for compiling
apt-get build-dep vpnc
# Compile and make an installable package
dpkg-buildpackage
cd ..
# Install the package
dpkg -i vpnc_0.5.3-1_i386.deb

Then, create a file with your personal vpn settings. Here is mine as an example. Put this file in /etc/vpnc/yourfile.conf. It must be in this folder, and the name must end in .conf.

1
2
3
4
5
IPSec gateway vpn.yourdomain.com
IPSec ID thenameofyourgroup
IPSec secret passwordyeradmingaveyou
Xauth username yername
Xauth password yersupersecretpassword

If you are using an RSA SecureID, you should leave off the Xauth password line in the configuration. You will be prompted for the password later, and it will not echo anything to the console.

After that, create a startup/shutdown script This one is like an init.d script, but we will have to run it interactively. This script will be in the root home directory:

/root/mytunnel

Remember to change line 4 to the name of the configuration file you created earlier.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
 
vpnc=/usr/local/sbin/vpnc
conf=/etc/vpnc/yourfile.conf
pid=/var/run/vpnc/pid
 
function start () {
  echo "Enter VPN password:"
  $vpnc $conf > /dev/null
}
 
function stop () {
  [[ ! -f $pid ]] && exit
  vpid=$(cat $pid)
  kill $vpid
}
 
function status () {
  [[ ! -f $pid ]] && {
        echo "$0 is not running"
        exit
  }
  vpid=$(cat $pid)
  instance=$(ps aux | grep $vpid | sed "/grep $vpid/d")
  [[ ! -z "$instance" ]] && echo "$0 is running" || echo "$0 is not running"
}
 
function reload () {
 echo "Reload is not supported for cisco vpn"
}
 
function restart () {
  stop
  start
}
 
VERSION=0.1
 
case "$1" in
    start)
        start $VERSION
        ;;
    stop)
        stop "$VERSION"
        ;;
    restart)
        restart "$VERSION"
        ;;
    reload)
        reload $VERSION
        ;;
    status)
        status $VERSION
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|reload|status}"
        exit 1
        ;;
esac
 
exit 0

Make it executable:

chmod +x mytunnel

You are now ready to start vpnc!

./mytunnel start
Enter VPN password:

There will be no response. That is a good thing, because the vpn is now running in the background. Test this with:

./mytunnel status
./mytunnel is running

Have fun mucking around in somebody else’s network!

When you’re done with your evil intentions:

./mytunnel stop

You’re now done with the thing you had to do, to get to the thing you had to do, so you could do some work.

Tags:

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

You must log in to post a comment.