Sunday, September 14, 2014

problem with Cisco Anyconnect VPN client on Ubuntu Linux 12.04 and later

I am using Cisco Anyconnect secure mobility client to make a secure VPN connection to my university Anyconnect VPN gateway and have access to online scientific database such as IEEE Xplore digital library.





I'm running Ubuntu 14.04 LTS on my laptop. The problem is that from Ubuntu 12.04 the DNS resolving has changed. Linux uses a plain text file called /etc/resolve.conf to configure the DNS resolver library. Until Ubuntu 12.04 anyone could manually add nameservers to this file but as I mentioned it has been changed so any changes manually done to /etc/resolv.conf will be lost as it gets overwritten next time something triggers resolvconf.

To be more precise, the package resolvconf is the only way to alter file /etc/resolv.conf. resolvconf itself  uses DHCP client hooks, a Network Manager plugin and /etc/network/interfaces to generate a list of nameservers and domain to put in /etc/resolv.conf.

lets get back to Anyconnect client! The problem is that this application directly put namesrver in /etc/resolv.conf and creates problems. If you get disconnected or forget to close this application properly(for instance killing by the process ID)
you will not be able to deploy DNS properly any more.

To resolve this issue, I decided to install the opensource tool openconnect. it is more convinient and you have the option to both use it as CLI or as a plug-in to network manager.

To install both of them simply run this command in terminal:

  $ sudo apt-get install openconnect network-manager-openconnect

I prefer command line option and I can pass parametrs to the command easily. To do so I just need to run this command:

$ echo $PASSWORD | sudo openconnect -v -u $USERNAME --authgroup='$GROUPNAME' --passwd-on-stdin https://sslvpn.ltu.se


you have to replace $PASSWORD, $USERNAME and $GROUPNAME. I have myself is using it as a simble bash script. It works great!


3 comments:

Anonymous said...

works like a charm. much appreciated.

Unknown said...

Hello Sir ! I got some questions ! How can i contact u ?
This is my email : hamid.vafaye@hotmail.com looking forward to ur answer !

Arman Farahzadeh said...

contact me with this email address: arman[dot]farahzadeh[at]gmail[dot]com