Linux und Ich

Blog über Ubuntu, Linux, Android und IT

Lizenziert unter CC by-sa von Xjs-Khaos auf Flickr

Access to the VPN of the University of Karlsruhe with Ubuntu Linux

| 69 Comments

When you study or work at the University of Karlsruhe you can have access to the services of the University or the Internet by installing the proprietary Cisco VPN Client. But to be frank, this programm is a pain in the ass. It’s proprietary, it needs kernel modules, you’ve got to patch it to run on current kernels. In short: Don’t use it, use vpnc. I’ll help you with it…

Anzeige

Compile vpnc

Usually you can install vpnc out of the repositories. The reason we can’t do this now is that we need support for openssl (certificates). Since this function may infringe some license violations, linux distributors usually deactivate openssl inside vpnc. So we’ve got to get the code and compile vpnc by ourself. So first, let’s get the code and untar the archive.

$ wget http://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-0.5.3.tar.gz
$ tar -xzf vpnc-0.5.3.tar.gz

Later on we will generate a .deb package for your own version of vpnc. To avoid that the package management tries to update your version we need to add a suffix for your package. We can do this by changing the name of the directory. When we generate the package, this suffix will be added to the version number.

$ mv vpnc-0.5.3 vpnc-0.5.3-christoph1
$ cd vpnc-0.5.3-christoph1

Now, that we’ve got the source, we’ve got to enable the support for openssl. To do this, you’ve got to edit the file called Makefile, e.g. with

$ gedit Makefile

and remove the hash sign “#” in front of line 49 and 50. These two line should now look like these.

…
OPENSSL_GPL_VIOLATION = -DOPENSSL_GPL_VIOLATION
OPENSSLLIBS = -lcrypto
…

After you saved the Makefile you need a couple of packages to be able to compile vpnc. You can install them via the package management.

$ sudo apt-get install libssl-dev build-essential dh-make fakeroot
$ sudo apt-get build-dep vpnc

Now the “real deal”. In a final step you have to compile vpnc. You can do this with

$ make
$ dh_make -f ../vpnc-0.5.3.tar.gz
$ fakeroot debian/rules binary
$ sudo dpkg -i ../vpnc*.deb

This compiles vpnc, creates a .deb file, and install vpnc. Please test if everything worked out.

$ vpnc --version
[...]
Built with openssl (certificate) support. Be aware of the
license implications.

Supported DH-Groups: nopfs dh1 dh2 dh5
Supported Hash-Methods: md5 sha1
Supported Encryptions: null des 3des aes128 aes192 aes256
Supported Auth-Methods: psk psk+xauth hybrid(rsa)

You’ve got to see the line “Built with openssl (certificate) support”. This means you compiled and installed vpnc with openssl support. Gratulations :)

The Certificate

Since October 2008 the University uses a Root-Certificate provided by the Deutsche Telekom. You can download the certificate from the VPN-Homepage of the University. To make things simpler, here a short command to download the certificate with wget and copy it to the right place inside /etc/ssl/certs.

$ sudo wget --no-check-certificate https://pki.pca.dfn.de/uni-karlsruhe-ca/pub/cacert/rootcert.crt -O /etc/ssl/certs/rootcert.crt

Configuration to access the University of Karlsruhe

Now it’s tome to configure vpnc, so that you can access the VPN of the University of Karlsruhe. This can be done by editing the /etc/vpnc/default.conf with and editor.

$ sudo gedit /etc/vpnc/default.conf

Please replace the content with these settings.

IPSec gateway vpn.uni-karlsruhe.de
IPSec ID vpn
IPSec secret vpnvpn
IKE Authmode hybrid
Xauth username u...
Xauth password xxx
CA-File /etc/ssl/certs/rootcert.crt

Please notice that you’ve got to enter your login and passwort into this file. Since this info won’t be encrypted, I recommend to limit read access to root.

$ sudo chmod 600 /etc/vpnc/default.conf

Start-/stop the connection

This is all you have to:

$ sudo vpnc
$ sudo vpnc-disconnect

to start or stop the connection. But i recommend

$ sudo vpnc --dpd-idle 0

this disabled “DPD idle timeout” which results in a more stable connection.

Automatically connect to the VPN

I’m a lazy person and entering vpnc every time when I’m at the university is a bit inconvenient. To make this more comfortable I wrote a shot script for Ubuntu’s network manager. There are so called “Dispatcher”-Skript which get executed every time you establish or close a network connection. The script will check if you’re inside the network of the University of Karlsruhe and will establish the VPN-connection if you are. I tested this inside our shiny new 24/7 library and with the WLAN “VPN/WEB”. You can download the script from my homepage. Don’t forget to make the script executable.

$ sudo wget http://www.christoph-langner.de/static/02uni-ka-vpn-1.4.sh -O /etc/NetworkManager/dispatcher.d/02uni-ka-vpnc
$ chmod +x /etc/NetworkManager/dispatcher.d/02uni-ka-vpnc

The script is able to show you informations about the connections via small popups. These are quite useful, since i noticed that vpnc has sometimes problems starting the encrypted connection. Without those popups you want see whats going on.

To be able to see those messages you’ve got to install the package libnotify-bin.

$ sudo apt-get install libnotify-bin

As far as i know libnotify-bin only works with the GNOME desktop enviroment. the rest of the script doesn’t depend on your DE. Now matter if you use KDE, Xfce or whatever. As long as you use the network manager, it should work.

[UPDATE 25.04.09] Updated for vpnc 0.5.3[/UPDATE]

Author: Christoph

Hallo, ich bin Christoph -- Linux-User, Blogger und pragmatischer Fan freier Software. Wie Ihr ohne Zweifel bemerkt haben solltet schreibe ich hier über Linux im Allgemeinen, Ubuntu im Speziellen, sowie Android und andere Internet-Themen. Wenn du Freude an meinen Artikel gefunden haben solltest, dann kannst du mir über Facebook, Google+ oder Twitter oder natürlich dem Blog folgen.

69 Comments

  1. Per vpnc kann ich mich immer noch einwählen. =)

  2. yo – juniper ssl-vpn rockt!
    Volle IPSEC Verbindung mit Fallback auf ssl-vpn.

    läuft mit linux, apple und mikrosaft.
    auch 64 bit.
    have fun.
    Gruss vom Einführer der Juniper-Lösung im ex-FZK!

    • Ja, kann ich bestätigen. Habs bei einem Kollegen gesehen, endlich gibts auch mehr als 200kbit/s. Muss nur mal Zeit finden darüber zu bloggeb. Bzw. noch schöner wäre wieder eine Integration in den NM.

  3. Faszinierend, dass die “nächsten Wochen” fast ein Jahr überdauert haben. Ich frag lieber nicht nochmal beim RZ an, nicht dass die das mit nem “Ahhhhh, stimmt, die wollten wir abschalten, holen wir gleich nach” beantworten…

    Die alte VPN Möhre läuft wahrscheinlich so lang bis sie von alleine abraucht oder versehentlich von der Putzfrau geklaut wird. Abschalten und wegschmeissen macht mehr Arbeit als anlassen und Kaffee trinken. :-)

  4. Hallo,

    wollen auch mal was beitragen: Per VPN und fast jungfräulicher Ubuntu-Installation ins Netz des KIT.

    Installieren: network-manager-vpnc

    Dann network-manager neu starten (wichtig), eventuell auch aus- und einloggen aus Gnome, dann eine VPN-Verbindung hinzufügen und die Einstellungen von hier:

    http://www.kit09.de/viewtopic.php?f=16&t=116#p1661

    übernehmen.

    Funktionierte nicht mit vpn.kit.edu oder so, also schön beim alten vpn.uni-karlsruhe.de bleiben :)

  5. Hi Christoph,

    ich habe gesehen, dass du auch über Android bloggst und nachdem du sogar an der gleichen Uni arbeitest/studierst kann ich einfach nicht widerstehen zu fragen, ob du auch eine VPN Lösung für Android am KIT hast?
    Würde mich freuen von dir zu hören!
    Johannes

  6. Hi
    das die UNI KA das Juniper SA 6500 VPN GW benutzt, gibt es neuerdings für Apple iOS (iPad, iPod, iPhone) und Android den Junos Pulse VPN Client. Ob das UNI RZ den Zugriff damit zulässt weiss ich nicht, es hängt auch von der Firmware ab ob Junos Pulse unterstützt wird (ab IVE OS v7.0).

    Gruss
    Dusan

  7. Hi,

    danke für eure schnellen Antworten. Diesen Juniper Client habe ich mir mal angesehen und ich musste feststellen, dass der so viele Permissions will, dass ich mich frage, ob ich da nicht vom Regen in die Traufe komme.
    Um ehrlich zu sein hatte ich ganz naiv gehofft, dass eine der vier nativen VPN Lösungen von Android funktionieren könnte. Leider sind die für mich allesamt spanische Dörfer.
    Dass die unterstützt werden, könnt ihr ausschließen?

    Vielen Dank nochmal!

    • Früher gabs ja mal den Cisco Zugang, diesen gibts zwar noch, aber offiziell soll ja Juniper benutzt werden. Wie dem auch sei, für Cisco brauchst du vpnc mit hybrid auth, was es vermutlich nicht für Android gibt. Daneben gibts eben Juniper, da gibts für Android wohl keine andere Lösung. Ob Junos Pulse aber mit der Uni-Lösung funktioniert, habe ich schon länger nicht mehr getestet.

  8. http://www.juniper.net/techpubs/software/pulse/guides/j-pulse-mobile-2.0R1-android-ug.pdf

  9. Wenn ich das hier
    http://www.rz.uni-konstanz.de/angebote/remote-access/gnulinux/
    richtig verstehe, brauchts keine compilierung mehr, weil bei vpnc (ab Debian 6.0, Ubuntu 10.04, openSUSE 11.3, Fedora 15) mittlerweile GnuTLS (http://de.wikipedia.org/wiki/GnuTLS) zum Einsatz kommt (was im Gegensatz zu OpenSSL keine Lizenzunverträglichkeiten mit vpnc hat).

    • Der Beitrag ist leider nicht mehr wirklich aktuell. Ich persönlich würde nicht mehr auf vpnc setzen, sondern auf Juniper, das ja auch ganz gut unter Linux läuft. Juniper hat den Vorteil, dass die Verbindung nicht gedrosselt wird, und dass es mittlerweile das “offizielle” VPN der Uni Karlsruhe ist. Via vpnc hab ich nie mehr als 200kb/s übertragen können. Über Juniper hatte ich locker mal einen Mbit/s übertragen können.

  10. Junos Pulse funzt übrigens wunderbar auch mit iPad und iPhone – wenn der Juniper VPN Server entsprechend konfiguriert wurde und Pulse zulässt.

    Ansonsten für diverse Linux Juniper Network Connect verwenden (https://vpn.kit.edu).

    Hilfsanleitungen guggst du hier:
    http://www.scc.kit.edu/dienste/vpn.php

  11. Danke, immer wieder hilfreich, Dein Blog!

Leave a Reply

Required fields are marked *.