A tiny wrapper for the official openvpn3 Linux client. It provides a few user-friendly commands to start a session, stop a session, and get status of an active session.
- Make sure you have openvpn3 Linux client installed.
- Make sure you have
Node.js
installed. - openvpn connection profile file. i.e
client.ovpn
-
Navigate to the release page and download the latest version of the source code.
-
Extract the source and copy the
dist/client.js
to wherever you want. -
Add the following commands to the shell profile. i.e
~/.bash_profile
,~/.zshrc
,~/.profile
, or~/.bashrc
export VPN_PROFILE_PATH=</path/to/openvpn/connection/profile> alias vpn='/path/to/downloaded/client.js'
VPN_PROFILE_PATH
- Absolute path to the openvpn connection profile file.alias vpn
- The entry point to the script. By default, the alias name isvpn
but, you can name it whatever you want. The value should be an absolute path to the downloadedclient.js
. (step 2) -
Source the modified shell profile. e.g.
source .zshrc
Optionally, you can provide auth credentials (username & password) to the above script to autofill when the start command (to start a new VPN session) prompts for credentials.
alias vpn='/path/to/downloaded/client.js username=foo password="abc123"'
Note - If the username or password contains special characters, then you should escape it to prevent parameter expansion. e.g.
password=foo$d
=> password=foo\$d
Usage: vpn [options]
options:
start - start a new session
stop - stop the current session
status - print the session status
MIT License © Sureshraj