Cisco Anyconnect Client Ubuntu



One of my planned uses for this blog is sharing tips that came in handy for me. Today I finally got around to getting AnyConnect going on my Ubuntu 16.04 OS. I relied on the great instructions put together by Jeff Stern. I’m reproducing part of those instructions below for posterity, in case the original content disappears into the internet void.

Stern put these instructions together for folks at UC Irvine. I’ve made small changes to the instructions to generalize them.

Oct 26, 2020 Cisco AnyConnect is compatible with Windows 7, 8, 8.1, and 10, Mac OS X 10.8 and later, and Linux Intel (x64). Follow the steps in this article to install the Cisco AnyConnect VPN Mobility Client on a Ubuntu Desktop. In this article, Ubuntu version 20.04 is used. Ubuntu OS 16.04.1 LTS Note: Download the AnyConnect VPN Client package (anyconnect-linux.pkg) from the Cisco Software Download (registered customers only) site. Copy the AnyConnect VPN client to the ASA's flash memory, which is then downloaded to the remote user computers in order to establish the SSL VPN connection with the ASA. Installing and using the Cisco AnyConnect client with Debian and Ubuntu for UCI VPN. By Jeff Stern (Note: There is also an alternative method of installing UCI VPN support without using the Cisco client, but using the built-in Debian/Ubuntu openconnect and openvpn drivers, should you find the below method does not work for you, or if you prefer to use open-source non-proprietary software.). See full list on cisco.com. Mar 09, 2021 These release notes provide information for AnyConnect Secure Mobility Client on Windows, macOS, and Linux platforms. An always-on intelligent VPN helps AnyConnect client devices to automatically select the optimal network access point and adapt its tunneling protocol to the most efficient method.

Stern also put together instructions for installing OpenConnect using the built-in Debian/Ubuntu OpenVPN drivers.

Summary

In the instructions below, I’ll walk you through installing the Cisco VPN client on a Debian or Ubuntu system. When you’re done, you’ll have two commands available at the command-prompt, which you can run to connect to the campus VPN: ‘vpn’ (text mode) and ‘vpnui’ (graphical/windowing).

Cisco

Installing the Cisco AnyConnect client

  1. First, make sure you have the necessary Debian/Ubuntu support packages installed:

    $ sudoapt-get update
    $ sudoapt-get install lib32z1 lib32ncurses5
  2. Download the 32 or 64 bit Cisco Anyconnect client as a .gz file. (Note from Cassi: If you are affiliated with a university, you should be able to get access to this software through your university’s software distribution center.)

    • If you are unsure whether you should use the 32 or 64 bit client: Most people are on 64-bit machines now. But if you are unsure, just run the uname command like this:

      $ uname-a
      Linux sporkula 3.19.0-31-lowlatency #36-Ubuntu SMP PREEMPT Wed Oct 7 15:44:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
      $_

      As you can see from the above example, my machine has a 64-bit Intel (x86_64) based processor. If you see a ‘386’ somewhere, then you are on a 32-bit machine.

  3. From the command prompt, go to the directory you saved the file to, and unpack it and run. Note you might have to put in some back-slashes because the download file apparently comes with spaces in the file name these days:

    ~$ cd ~/Downloads
    ~/Downloads]$ tar-xzvf anyconnect-predeploy-linux-64-4.3.05017-k9.tar 6.59.23 AM.gz
    anyconnect-4.3.05017/
    anyconnect-4.3.05017/vpn/
    anyconnect-4.3.05017/vpn/vpn_install.sh
    anyconnect-4.3.05017/vpn/vpnagentd
    anyconnect-4.3.05017/vpn/vpnagentd_init
    anyconnect-4.3.05017/vpn/vpn_uninstall.sh
    anyconnect-4.3.05017/vpn/anyconnect_uninstall.sh
    ...
    anyconnect-4.3.05017/posture/libacciscocrypto.so
    anyconnect-4.3.05017/posture/libacciscossl.so
    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
    ~/Downloads]$ cd anyconnect-4.3.05017
    ~/Downloads/anyconnect-4.3.05017]$ cd vpn
    ~/Downloads/anyconnect-4.3.05017/vpn]$ ls-lh
    $ total 12M
    -rwxr-xr-x1 jas jas 14K Dec 92016 acinstallhelper
    -rw-r--r--1 jas jas 262 Dec 92016 ACManifestVPN.xml
    -rw-r--r--1 jas jas 6.6K Dec 92016 AnyConnectLocalPolicy.xsd
    -rw-r--r--1 jas jas 83K Dec 92016 AnyConnectProfile.xsd
    -rwxr-xr-x1 jas jas 502 Dec 92016 anyconnect_uninstall.sh
    -rw-r--r--1 jas jas 279 Dec 92016 cisco-anyconnect.desktop
    -rw-r--r--1 jas jas 164 Dec 92016 cisco-anyconnect.directory
    -rw-r--r--1 jas jas 603 Dec 92016 cisco-anyconnect.menu
    -rwxr-xr-x1 jas jas 2.6M Dec 92016 libacciscocrypto.so
    -rwxr-xr-x1 jas jas 436K Dec 92016 libacciscossl.so
    -rwxr-xr-x1 jas jas 232K Dec 92016 libaccurl.so.4.3.0
    -rwxr-xr-x1 jas jas 168K Dec 92016 libacfeedback.so
    -rwxr-xr-x1 jas jas 888K Dec 92016 libvpnagentutilities.so
    -rwxr-xr-x1 jas jas 1.6M Dec 92016 libvpnapi.so
    -rwxr-xr-x1 jas jas 530K Dec 92016 libvpncommoncrypt.so
    -rwxr-xr-x1 jas jas 1.7M Dec 92016 libvpncommon.so
    -rwxr-xr-x1 jas jas 1.1M Dec 92016 libvpnipsec.so
    -rw-r--r--1 jas jas 13K Dec 92016 license.txt
    -rwxr-xr-x1 jas jas 480K Dec 92016 manifesttool
    -rw-r--r--1 jas jas 68K Dec 92016 OpenSource.html
    drwxr-sr-x 2 jas jas 4.0K Dec 92016 pixmaps
    -rw-r--r--1 jas jas 10 Dec 92016 update.txt
    -rw-r--r--1 jas jas 1.8K Dec 92016 VeriSignClass3PublicPrimaryCertificationAuthority-G5.pem
    -rwxr-xr-x1 jas jas 65K Dec 92016 vpn
    -rwxr-xr-x1 jas jas 724K Dec 92016 vpnagentd
    -rw-r--r--1 jas jas 2.1K Dec 92016 vpnagentd_init
    -rwxr-xr-x1 jas jas 424K Dec 92016 vpndownloader
    -rwxr-xr-x1 jas jas 396K Dec 92016 vpndownloader-cli
    -rwxr-xr-x1 jas jas 24K Dec 92016 vpn_install.sh
    -rwxr-xr-x1 jas jas 176K Dec 92016 vpnui
    -rwxr-xr-x1 jas jas 8.4K Dec 92016 vpn_uninstall.sh
    ~/Downloads/anyconnect-4.3.05017/vpn]$ sudo ./vpn_install.sh
    ...
    Do you accept the terms in the license agreement? [y/n] y
    You have accepted the license agreement.
    Please waitwhile Cisco AnyConnect Secure Mobility Client is being installed...
    Starting Cisco AnyConnect Secure Mobility Client Agent...
    Done!
    ~/Downloads/anyconnect-4.3.05017/vpn]$ _
  4. If you get the following message at the end instead:

    Failed to start vpnagentd.service: Unit vpnagentd.service failed to load: No such file or directory.

    it most likely means you did not install the two Ubuntu packages up in step 1, above.

    • However, if you have installed those two packages, and are still getting this error, then user Steve Murphy wrote me (2015-12-7) with the tip that running the following did install enough dependent packages as to make it work for him:

      $ sudoapt-get install network-manager-openconnect

      However, while this may help some users, this normally should not be necessary, and was not in my testing.

  5. Now reload systemd, scanning for new or changed units:

  6. The vpn client should now have been
    installed on your system and the vpnagentd process started. You can
    verify this by looking at the active processes:

    $ ps auxw |grep vpnagentd |grep-vgrep
    root 30490.00.21659608356 ? Sl 09:07 0:04 /opt/cisco/anyconnect/bin/vpnagentd
  7. During the installation, the vpnagentd daemon should now be set up
    to be started each time your system is booted. To verify:

    $ find/etc/rc?.d -type l -name'*vpnagentd*'
    /etc/rc2.d/K25vpnagentd
    /etc/rc2.d/S85vpnagentd
    /etc/rc3.d/K25vpnagentd
    /etc/rc3.d/S85vpnagentd
    /etc/rc4.d/K25vpnagentd
    /etc/rc4.d/S85vpnagentd
    /etc/rc5.d/K25vpnagentd
    /etc/rc5.d/S85vpnagentd

    or

    $ ls-l/etc/rc?.d/*vpn*
    lrwxrwxrwx 1 root root 21 Jun 5 09:07 /etc/rc2.d/K25vpnagentd ->/etc/init.d/vpnagentd*
    lrwxrwxrwx 1 root root 21 Jun 5 09:07 /etc/rc2.d/S85vpnagentd ->/etc/init.d/vpnagentd*
    lrwxrwxrwx 1 root root 21 Jun 5 09:07 /etc/rc3.d/K25vpnagentd ->/etc/init.d/vpnagentd*
    lrwxrwxrwx 1 root root 21 Jun 5 09:07 /etc/rc3.d/S85vpnagentd ->/etc/init.d/vpnagentd*
    lrwxrwxrwx 1 root root 21 Jun 5 09:07 /etc/rc4.d/K25vpnagentd ->/etc/init.d/vpnagentd*
    lrwxrwxrwx 1 root root 21 Jun 5 09:07 /etc/rc4.d/S85vpnagentd ->/etc/init.d/vpnagentd*
    lrwxrwxrwx 1 root root 21 Jun 5 09:07 /etc/rc5.d/K25vpnagentd ->/etc/init.d/vpnagentd*
    lrwxrwxrwx 1 root root 21 Jun 5 09:07 /etc/rc5.d/S85vpnagentd ->/etc/init.d/vpnagentd*
  8. Make command aliases to point to the vpn and vpnui commands:

    $ aliasvpn='/opt/cisco/anyconnect/bin/vpn'
    $ aliasvpnui='/opt/cisco/anyconnect/bin/vpnui'
  9. Also add these aliases to the end of your ~/.bashrc or ~/.bash_aliases file:

    $ cat>> ~/.bash_aliases
    aliasvpn='/opt/cisco/anyconnect/bin/vpn'
    aliasvpnui='/opt/cisco/anyconnect/bin/vpnui'
    ^D
    $ _

    (where you don’t actually type the “^D”: it means you hit Ctrl-D to finish).

    If you want to edit your aliases file instead directly, you can run a simple editor, ‘nano’, which is usually available on Debian and Ubuntu systems:

Connecting and Disconnecting

Connecting (Graphical window)

Just run:

$ vpnui

A window should appear. You’ll need to enter an address to connect to. Follow directions provided by your VPN provider. (For example, to connect to UC Berkeley’s VPN, use ‘ucbvpn.berkeley.edu’.)

If you get an error message about an untrusted server or certificate you can fix that following the instructions from Robert in the section NOTE 1 – Connect Error, below.

Cisco Anyconnect Client Ubuntu Windows 10

Cisco

(By the way, depending on how the installation went, and whatever of the Linux desktop environments you are using (Gnome, Unity, KDE, Mate, Cinnamon, XFCE, etc.) you may also find that the vpnui graphical client now also appears somewhere in your Applications menu. But don’t count on it! This is Linux, after all.. )

Connecting (via command-line)

  1. To start the client from a command-line prompt in a terminal window, using the alias you made above:

  2. At the VPN> prompt, type connect 'vpn.address.here' and press Enter. Where ‘vpn.address.here’ is the address to connect to your VPN. For example, to connect to UC Berkeley’s VPN, use ‘ucbvpn.berkeley.edu’. (If you get an error message about an untrusted server or certificate, you can fix that following the instructions from Robert in the section NOTE 1 – Connect-error, below.)

  3. Follow directions to choose a tunnel type and enter your username and password information. Your VPN provider should have instructions for how to do this.

  4. At the accept? [y/n]: prompt, type y and press Enter. You may get several notices the first time about the downloader performing update checks. At the end you should see a >> state: Connected message and a new VPN> prompt. You are now connected.

  5. Either leave the VPN> prompt open or if you want your terminal back just type quit at the VPN> prompt (the connection will remain active).

NOTE 1 – Connect-error

In most cases I have seen, a connection is made. I have, however, seen the below error before only once. It was when the person was installing on a netbook (running Gnome) which was on campus and using the campus wifi system (though I don’t know if those factors were the cause). It didn’t matter if they answered y or n, they continued to get the error and be denied connection.

------------------------------------------------------------------
Error:
VPN> connect vpn.uci.edu
connect vpn.uci.edu
>> contacting host (vpn.uci.edu)forlogin information...
>> notice: Contacting vpn.uci.edu.
VPN> AnyConnect cannot verify the VPN server: vpn.uci.edu
- Certificate is from an untrusted source.
Connecting to this server may result in a severe security compromise!
Most usersdo not connect to untrusted VPN servers unless the
reason for the error condition is known.
Connect Anyway? [y/n]:
------------------------------------------------------------------

Update 2015-12-6: “Robert” wrote me with a solution to this:

  • ..the connect error… can be resolved by sym-linking the cisco ca directory to the system ca directory as cisco only seems to include one root certificate by default. Or you can install the certificate chain from the VPN provider – sym-linking the system certs worked fine for me.

    $ cd/opt/.cisco/certificates
    $ sudomv ca ca.orig
    $ sudoln-sf/etc/ssl/certs/ ca
    $ sudo/etc/init.d/vpnagentd restart

    Credit goes to: https://plus.google.com/+AndreasKotowicz/posts/2afhvvNZpE6

Thank you, Robert!

To disconnect (gui)

  1. Just click disconnect in the window

To disconnect (command-line)

  1. At the VPN> prompt, type disconnect and hit Enter.

To exit (command-line)

Cisco anyconnect secure mobility client ubuntu 16.04

Cisco Anyconnect Client Download

  1. At the VPN> prompt, type quit and hit return.

De-installation / Removal

  1. Run Cisco’s provided un-install script

  2. Optionally, also remove the cisco directory (if you don’t need the .log files that were left behind):

    $ sudorm-rf/opt/cisco

Additional Hints, Tips, and Handling of Errors and Problems Contributed by Users

Anyconnect

Cisco Anyconnect Client Ubuntu Download

Several people have written in to me with some additional tips and solutions which I’ll add here:

Cisco Anyconnect Vpn Client

  • From pierrechauffour:

    Hi !

    Thank you for your web site, a lot of help.

    But in “Section 1”, lib32z1 and lib32ncurses5 are not avalaible for launch anyconnect

    Prefer libpangox-1_0-0 and pangox-compat

    I’m not on debian (DEB) but openSuse (RPM)

    Best regards

  • From zviad aburjania:

    Thank you for the instructions, it was very helpful so far but after I type vpn in terminal I get the message: /opt/cisco/anyconnect/bin/vpn: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory

    This turned out to be a missing library fixable by:

  • From zviad aburjania (2):

    Hello Jeff,

    Thank you for your advice! After installing the package you recommended I was able to make alias to point to the vpn command.

    After I did that and typed “vnp” I used to get the error message:
    >> error: VPN Service not available.
    unable to attach to VPN subsystem!

    after searching the internet I found this link that was helpful with that problem.

    After this everything seems to be fine.

    I just wanted to share my experience as I’m very grateful for your help.

    Thank you,
    Zviadi

    (If that link no longer works, it is just recommended to start /opt/cisco/anyconnect/bin/vpnagentd first.)

  • From pascal müller:

    Pascal researched and found that the error, anyconnect was not able to establish a connection to the specified secure gateway is a known problem with Cisco clients before version 4, when these earlier clients are installed on Ubuntu 16.04+. The solution is either to downgrade your Ubuntu, or upgrade your Cisco client. At my university we have upgraded to offering version 4 (anyconnect-predeploy-linux-64-4.3.05017-k9.tar.gz), and this supposedly works with the newer Ubuntus. I did not myself test the new version 4 Anyconnect client with Ubuntus 15.x and 16.x. But I have tested it today (April 27 2017) with my Ubuntu 17.04 system, and it works great.

Featured image source.