Skip to content

Instantly share code, notes, and snippets.

@dfrankland
Last active April 5, 2023 14:11
Show Gist options
  • Save dfrankland/1c6b10e78910180f7f197481d0e72a7f to your computer and use it in GitHub Desktop.
Save dfrankland/1c6b10e78910180f7f197481d0e72a7f to your computer and use it in GitHub Desktop.
Steps to use Pritunl on a server or headless environment

Steps to use Pritunl on a server

Install

Install Pritunl and it should include a CLI pritunl-client

https://client.pritunl.com/#install

Example for Ubuntu 20.04

sudo tee /etc/apt/sources.list.d/pritunl.list << EOF
deb https://repo.pritunl.com/stable/apt focal main
EOF

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
sudo apt-get update
sudo apt-get install pritunl-client-electron

Setup

Import your profiles. Only pritunl:// URLs are supported.

pritunl-client import pritunl://...

Check that things worked

This should show a list of IDs and Names of profiles to connect with.

pritunl-client list

Connecting to a VPN

Using the list from pritunl-client list, pick an ID to connect to. The ID can be partially specified for convience too.

pritunl-client start myidpartial --mode=ovpn --password=...

Check that the connection is online.

pritunl-client list

Using 2FA with passwords

To use a 2FA token with a password simply append the 2FA token to the end of the password.

Example

Password Token Combined CLI Password
123456 654321 123456654321

DNS resolution

DNS resolution is messed up with OpenVPN and systemd in Ubuntu, so you need to use this workaround.

Check for a new nameserver.

cat /run/systemd/resolve/resolv.conf

Use the new nameserver found with dig to find the IP of a domain you want to use in the VPN.

dig +short @XXX.XXX.XXX.XXX my.sweet.url

Now use the IP found instead of the URL of the service wherever it is needed e.g. with SSH.

@lolmaus
Copy link

lolmaus commented Apr 3, 2023

Thanks!

VPN worked fine for me on Ubuntu 22.04.

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