Skip to content

Instantly share code, notes, and snippets.

@cjwomack
Last active August 31, 2022 16:42
Show Gist options
  • Save cjwomack/9f3566765916c2600a5d4bd80461bb4c to your computer and use it in GitHub Desktop.
Save cjwomack/9f3566765916c2600a5d4bd80461bb4c to your computer and use it in GitHub Desktop.
Run anyconnect VPN in WSL in Ubuntu 22.04 (So only ssh traffic, sftp flows through VPN)

I'm doing a Uni course where I have to use a server which requires a VPN to access it. VPN is annoying as it slows doing your internet searches which don't require Uni network (unless using Library suff)

There was also the option of logging into a ssh server which doesn't require a VPN...

Anyway, I needed to copy a jupyter notebook and it needed two copy operations to copy any file. This file didn't copy properly using filezilla then scp... One hop is easier to troubleshoot

So it seemed hard doing the route option because I wasn't sure what arguments were and there were no images with circles around the various outputs of commands

So I read use a VM... then it occurred to me I could use WSL and it has a virtual adapter.

Login into VPN url in web browser so it thinks it is linux (Use a linux user agent or download a browser into WSL distro and configure using X and VcXsrv)

  1. Download the file for installation

TO PREVENT THIS """ /opt/cisco/anyconnect/bin/vpnui

uq/opt/cisco/anyconnect/bin/acwebhelper: error while loading shared libraries: libwebkit2gtk-4.0.so.37: cannot open shared object file: No such file or directory /opt/cisco/anyconnect/bin/acwebhelper: error while loading shared libraries: libwebkit2gtk-4.0.so.37: cannot open shared object file: No such file or directory /opt/cisco/anyconnect/bin/acwebhelper: error while loading shared libraries: libwebkit2gtk-4.0.so.37: cannot open shared object file: No such file or directory """ DO THE INSTALL BELOW

  1. sudo apt install libwebkit2gtk-4.0-37

  2. sudo bash anyconnect-linux64-4.10.05111-core-vpn-webdeploy-k9.sh (anyconnect-linux....)

TO PREVENT THIS

/opt/cisco/anyconnect/bin/vp(WebKitWebProcess:11454): Gdk-ERROR **: 13:27:25.753: The program 'WebKitWebProcess' received an X Window System error. This probably reflects a bug in the program. The error was 'GLXBadFBConfig'. (Details: serial 202 error_code 163 request_code 149 (GLX) minor_code 21) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the GDK_SYNCHRONIZE environment variable to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.)

ADD ENVIRONMENT VARIABLE BEFORE PROGRAM (AS LISTED BELOW)

Doesn't show the login window unless the environment variable is set as below then it works

  1. WEBKIT_DISABLE_COMPOSITING_MODE=1 /opt/cisco/anyconnect/bin/vpnui

  2. Optional - install Filezilla (sudo apt-get install filezilla) if you are a Uni student working late on your project, it's easier to drag and drop (you should still scp at times) You need to get the IP address of the display when not connected to VPN. Maybe create a variable WIN_DISP=a_value and then do export DISPLAY=$WIN_DISP before running filezilla and other apps

PS If configuring X for WSL remember there are differences in .bashrc for WSL 1 and WSL 2.

PS this is a draft but I've pasted various error messages for people attempting this so perhaps an unpolished gist is better than no gist at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment