📌 置頂: 請把任何比你弱勢的用路人當作你的至親對待。跟前車保持安全車距 (2秒以上)。

Using OpenConnect for UNC-CH VPN on Linux

In

Tags:



by

I don’t have good luck with UNC-Chapel Hill’s VPN installation guide for Linux systems (KB0010220, login required). After several tests with Cisco AnyConnect provided in the KB post, they all end up with the following message:

$ sudo /opt/cisco/anyconnect/bin/vpn connect vpn.unc.edu

>> error: The service provider in your current location is restricting access to the Internet. You need to log on with the service provider before you can establish a VPN session. You can try this by visiting any website with your browser.

Fortunately, we can use OpenConnect to replace AnyConnect on this. First, since the VPN is self-signed, we will need to trust it anyway, by obtaining the server certificate with the highlight line (--servercert ....):

Then, we can connect to the VPN with the following command:

With group UNCCampus and your Onyen account name, password, and 2FA option (prefer push). You may need sudo for openconnect command if you received permission denied after all.


Update @ 06/09/2023

Months after this post, the original method shows the following error message:

At the first glance I thought it is caused by signer not found, and after searching online there were no solution for this from client side. Months later I realized the root cause is the CSD script where it shows -:1.1: Document is empty, this lead to this issue and this workaround.

By the workaround, using the following temporary OpenSSL config should fix this problem:

Then, invoke openconnect as the following to connect to the VPN:

Update @ 04/11/2024

The above method failed.

Change to use openconnect-sso to connect:


Comments

4 responses to “Using OpenConnect for UNC-CH VPN on Linux”

  1. Jesse Wei avatar
    Jesse Wei

    Cool post Louie!

  2. Mark Klose avatar
    Mark Klose

    I’m from EPID, trying to set up a NixOS system, and your post has been the most helpful/explanatory so far. I was unable to get openconnect-sso to work on the last suggestion, and I found a solution which finally works today (12/31/2024):


    sudo openconnect --user ONYEN --authgroup UNCCampus --useragent=AnyConnect --protocol=anyconnect --no-external-auth -v vpn.unc.edu

    Where `ONYEN` is replaced by your ONYEN username. This then shows a password field, which then triggers a Duo Push for me. I was able to SSH onto an on-campus machine, but I have not done further testing.

    1. louie.lu avatar
      louie.lu

      Thanks Mark, I’m glade this post helps other with the same problem!

      I tried your method but with no luck, I will add it to the post and specified this works on NixOS.

      Could you also share why openconnect-sso doesn’t work on NixOS? Is it because of installation or other dependency issue?

    2. Leonardo Atalla avatar
      Leonardo Atalla

      Thank you! Worked for me. When asking for your password, you also have the option to change the Duo authentication method by inputting “{password},{method}” where method is “push”, “sms”, or “phone”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.