CommunityData:Northwestern VPN: Difference between revisions

From CommunityData
 
(13 intermediate revisions by 5 users not shown)
Line 3: Line 3:
Northwestern IT has instructions for how to set up VPN on multiple operating systems using the GlobalConnect client. For most people, [https://kb.northwestern.edu/94726 their instructions] should work fine.
Northwestern IT has instructions for how to set up VPN on multiple operating systems using the GlobalConnect client. For most people, [https://kb.northwestern.edu/94726 their instructions] should work fine.


== Alternative Linux configuration options (may be deprecated after April 1, 2020) ==
== Alternative Linux option ==


'''The following used to work before NU migrated all VPN connections to GlobalConnect. It may or may not work anymore with GlobalConnect and should be tested/revised accordingly.'''  
[[Mako]] has built an alternative configuration (suitable for anybody running Debian or Ubuntu is) that doesn't require the GlobalConnect client. This has two main benefits: (1) it doesn't require installing the normal client which includes a proprietary sort of spyware tool that sends details on what packages are installed to NU every time you use it, and (2) it allows you to proxy only a single ssh connection and ''not'' your entire Internet connection. Folks who are not at NU may want to use this.


Depending on your setup, the Linux instructions may be a bit lacking. Here are step-by-step instructions for Ubuntu 18.04. It should be similar for other Debian-based systems and very similar if you are using Gnome 3.  Alternatively, you can connect to Kibo using the [[ CommunityData:Northwestern VPN#SSH Config | configuration]] that mako developed.
To install it you can download the software from the [[CommunityData:Git|CDSC Git repository]] like:


<code>
    gitea@gitea.communitydata.science:collective/nu-vpn-proxy.git
sudo apt install network-manager-openconnect-gnome
</code>


Open Settings > Networks > Add VPN
Details on how to set use that code are up are in the <code>README-CDSC</code> file in that repostiroy.


[[File:Add-vpn.png|500px]]
There are two modes supported by the scripts:


Choose the openconnect option
# A mode that proxies '''only''' for SSH connections to kibo.
# A mode that proxies your  entire connection.


[[File:Anyconnect-vpn.png|500px]]
Please commit any changes to the code and/or or the documentation in the git repository.


Edit the settings:


Gateway: `vpn-nu.vpn.northwestern.edu`
=== Troubleshooting ===
Token mode: `TOTP -- manually entered`


[[File:Vpn-settings.png|500px]]
New versions of openconnect and openssl can cause a few issues.


Click connect and log in using your NU netid and password
==== OpenSSL error ====
If you get an error saying "UNSAFE_RENEGOTIATION DISABLED", this is because our setup relies on Python library that is using an older  deprecated ("unsafe") protocol. Until we get it fixed on the server, you need to disable checking on your local machine.


[[File:Vpn-connect.png|500px]]
The simplest thing (described in [https://stackoverflow.com/a/72245418 this stackoverflow suggestion]). Basically, it should be possible to add this line to the following files (after the fourth line): <code>openconnect_command-general.sh</code>, <code>openconnect_command-http.sh</code>, <code>openconnect_command-ssh.sh</code>:


== SSH Config ==
:<code>export OPENSSL_CONF=./openssl.conf</code>


To connect to kibo using ssh.  
The downside to this is that will require that the command be run ''from the local directory''. Alternatively, you can put the full path to the <code>openssl.conf</code> file that is shipped with the repository into the line above (e.g., <code>/home/mako/bin/nu-vpn-proxy/openssl.conf</code>).


1. Install netcat-bsd and ocproxy
Another option is to change your systemwide OpenSSL configuration as described in comment 7 on [https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1963834 this bug report]. This is probably more dangerous.


  sudo apt install ocproxy netcat-openbsd
==== Openconnect error ====


2. Add the following to your ~/.ssh/config. Replace <YOUR NU USERNAME>.
The other error that you may get is: <code>Failed to parse server response</code>


  Host kibo kibo.soc.northwestern.edu
If you get this error, it's likely because there was a bug in openconnect. The bug seems to have begun in openconnect 8.2 and been fixed at some point before openconnect 9.0. Basically,that breaks when upgrading to openconnect version 8.20+ but less than 9.0.
    Hostname kibo.soc.northwestern.edu
    User <YOUR NU USERNAME>
    ProxyCommand ~/bin/nu-vpn-proxy %h %p


3. Create the file ~/bin/nu-vpn-proxy with the following. Replace <YOUR NU NETID> and <YOUR NU PASSWORD>.  
If you can upgrade to 9.0, that is best. If you cannot easily do this, it is likely best to downgrade to 8.1.


Instructions for Ubuntu:


    #!/bin/bash
1. Uninstall <code>openconnect</code> and <code>libopenconnect5</code>
   
    # connects to SSH through openconnect and VPN
    # for use with ProxyCommand in SSH
   
    # first run openconnect
   
    /sbin/start-stop-daemon --pidfile /tmp/nu-vpn-openconnect.pid --make-pidfile -b -S --startas /bin/bash -- -c '/usr/sbin/openconnect --reconnect-timeout 60 --script-tun --script "ocproxy -D 9052" --user <YOUR NU NETID> vpn-nu.vpn.northwestern.edu < <(echo <YOUR NU PASSWORD>)' &
   
    sleep 3
   
    # kill connection on exit
    function cleanup {
      /sbin/start-stop-daemon --stop --pidfile /tmp/nu-vpn-openconnect.pid
    }
    trap cleanup EXIT
   
    # redirect traffic (standard input and output) through VPN
    /bin/nc.openbsd -X 5 -x 127.0.0.1:9052 $1 $2


Make the file executable using <code> chmod +x ~/bin/nu-vpn-proxy </code>
    sudo apt remove openconnect libopenconnect5


Now you should be able to login to kibo. <code> ssh kibo </code>.
2. Download version 8.10
 
    cd ~/Some/dir
    wget https://www.infradead.org/openconnect/download/openconnect-8.10.tar.gz
    tar -xvf ./openconnect-8.10.tar.gz
    cd ./openconnect-8.10
 
3. Install openconnect following [https://www.infradead.org/openconnect/building.html these instructions]
 
    ./configure
    make
    make install
 
4. Cross your fingers and try to connect to the VPN again (e.g., with <code>ssh kibo</code>).

Latest revision as of 01:53, 15 June 2024

NUIT instructions (works for most)[edit]

Northwestern IT has instructions for how to set up VPN on multiple operating systems using the GlobalConnect client. For most people, their instructions should work fine.

Alternative Linux option[edit]

Mako has built an alternative configuration (suitable for anybody running Debian or Ubuntu is) that doesn't require the GlobalConnect client. This has two main benefits: (1) it doesn't require installing the normal client which includes a proprietary sort of spyware tool that sends details on what packages are installed to NU every time you use it, and (2) it allows you to proxy only a single ssh connection and not your entire Internet connection. Folks who are not at NU may want to use this.

To install it you can download the software from the CDSC Git repository like:

   gitea@gitea.communitydata.science:collective/nu-vpn-proxy.git

Details on how to set use that code are up are in the README-CDSC file in that repostiroy.

There are two modes supported by the scripts:

  1. A mode that proxies only for SSH connections to kibo.
  2. A mode that proxies your entire connection.

Please commit any changes to the code and/or or the documentation in the git repository.


Troubleshooting[edit]

New versions of openconnect and openssl can cause a few issues.

OpenSSL error[edit]

If you get an error saying "UNSAFE_RENEGOTIATION DISABLED", this is because our setup relies on Python library that is using an older deprecated ("unsafe") protocol. Until we get it fixed on the server, you need to disable checking on your local machine.

The simplest thing (described in this stackoverflow suggestion). Basically, it should be possible to add this line to the following files (after the fourth line): openconnect_command-general.sh, openconnect_command-http.sh, openconnect_command-ssh.sh:

export OPENSSL_CONF=./openssl.conf

The downside to this is that will require that the command be run from the local directory. Alternatively, you can put the full path to the openssl.conf file that is shipped with the repository into the line above (e.g., /home/mako/bin/nu-vpn-proxy/openssl.conf).

Another option is to change your systemwide OpenSSL configuration as described in comment 7 on this bug report. This is probably more dangerous.

Openconnect error[edit]

The other error that you may get is: Failed to parse server response

If you get this error, it's likely because there was a bug in openconnect. The bug seems to have begun in openconnect 8.2 and been fixed at some point before openconnect 9.0. Basically,that breaks when upgrading to openconnect version 8.20+ but less than 9.0.

If you can upgrade to 9.0, that is best. If you cannot easily do this, it is likely best to downgrade to 8.1.

Instructions for Ubuntu:

1. Uninstall openconnect and libopenconnect5

   sudo apt remove openconnect libopenconnect5

2. Download version 8.10

   cd ~/Some/dir
   wget https://www.infradead.org/openconnect/download/openconnect-8.10.tar.gz
   tar -xvf ./openconnect-8.10.tar.gz
   cd ./openconnect-8.10

3. Install openconnect following these instructions

   ./configure
   make
   make install

4. Cross your fingers and try to connect to the VPN again (e.g., with ssh kibo).