Connecting to the CS VPN Using OpenConnect for Linux

  1. Install OpenConnect for Ubuntu/Debian based Linux Distributions (Please see below for other distributions) 
    Open a terminal window and type in "sudo apt install openconnect"

    localadmin@localadmin-VirtualBox:~/Downloads$ sudo apt install openconnect
    Reading package list... Done
    Building dependency tree
    Reading state information.. Done
    The following packages were automatically installed and are no longer required:
      linux-headers-5.13.0-30-generic linux-hwe-5.13-headers-5.13.0-30
      linux-image-5.13.0-30-generic linux-modules-5.13.0-30-generic
      linux-modules-extra-5.13.0-30-generic
    Use 'sudo apt autoremove' to remove them.
    The following NEW packages will be installed:
      openconnect
    0 upgraded, 1 newly installed, 0 to remove and 162 not upgraded.
    Need to get 464 kB of archives.
    After this operation, 2,750 kB of additional disk space will be used.
    Get:1 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 openconnect amd64 8.05-1 [464 kB]
    Fetched 464 kB in 1s (530 kB/s)
    Selecting previously unselected package openconnect.
    (Reading database ... 214328 files and directories currently installed.)
    Preparing to unpack .../openconnect_8.05-1_amd64.deb ...
    Unpacking openconnect (8.05-1) ...
    Setting up openconnect (8.0.5-1) ...
    Processing triggers for man-db (2.9.1-1) ...

  2. Connect to the VPN
    1. Use the following command to initiate connection to the VPN: sudo openconnect --protocol=gp --background --user='cs\username' vpn.cs.stonybrook.edu
    2. When prompted enter your CS password.

      localadmin@localadmin-VirtualBox:~/Downloads$ sudo openconnect --protocol=gp --background --user='cs\vpntest' vpn.cs.stonybrook.edu
      POST https://vpn.cs.stonybrook.edu/ssl-vpn/prelogin.esp?tmp=tmp&clientVer=4100&clientos=Linux
      Connected to 130.245.5.137:443
      SSL negotiation with vpn.cs.stonybrook.edu
      Connected to HTTPS on vpn.cs.stonybrook.edu
      Enter login credentials
      Password:

    3. When connected successful you will receive similar information below. The connection will run in the background.

      POST https://vpn.cs.stonybrook.edu/ssl-vpn/prelogin.esp?tmp=tmp&clientVer=4100&clientos=Linux
      Connected to 130.245.5.137:443
      SSL negotiation with vpn.cs.stonybrook.edu
      Connected to HTTPS on vpn.cs.stonybrook.edu
      Enter login credentials
      Password:
      POST https://vpn.cs.stonybrook.edu/ssl-vpn/login.esp
      GlobalProtect login returned authentication-source=Ldap-auth-prof
      POST https://vpn.cs.stonybrook.edu/ssl-vpn/getconfig.esp
      Session will expire after 43200 minutes.
      Tunnel timeout (rekey interval) is 180 minutes.
      Idle timeout is 180 minutes.
      Potential IPv6-related GlobalProtect config tag : no
      This build does not support GlobalProtect IPv6 due to a lack of
      of information on how it is configured. Please report this to 
      No MTU received. Calculated 1422 for ESP tunnel
      POST httpsL//vpn.cs.stonybrook.edu/ssl-vpn/hipreportcheck.esp
      WARNING: Server asked us to submit HIP report with md5sum cf3fc363f563f2cb410e1cb113406ec9
      VPN connectivity may be disabled or limited without HIP report submission.
      You need to provide a --csd-wrapper argument with the HIP report submission script.
      Connected as 130.245.77.245, using SSL, with ESP in progress
      Continuing in background: pid 8714

  3. Disconnect from VPN
    1. To disconnect from the VPN use the following commands: pgrep -a openconnect and note the process id number.

      localadmin@localadmin-VirtualBox:~/Downloads$ pgrep -a openconnect
      9089 openconnect --protocol=gp --background --user=cs\mdelgrosso vpn.cs.stonybrook.edu

    2. Type sudo kill <Process-ID Number>. You will be successfully disconnected

      localadmin@localadmin-VirtualBox:~/Downloads$ sudo kill 9089
      POST https://vpn.cs.stonybrook.edu/ssl-vpn/logout.esp
      SSL negotiation with vpn.cs.stonybrook.edu
      localadmin@localadmin-VirtualBox:~/Downloads$ Connected to HTTPS on vpn.cs.stonybrook.edu
      Logout successful
      RTNETLINK answers: No such process
      RTNETLINK answers: No such process
      User cancelled (SIGINT/SIGTERM): exiting.

**Installation Commands for other Distributions

Centos sudo yum install openconnect

Fedora sudo dnf install openconnect