Automated OpenVPN 3 wrapper for Linux with Sophos 2FA support and self-healing configuration management. Start | Stop | Status VPN session with 2FA made easy.
- Automatic Profile Management: Detects and purges duplicate configuration paths before importing fresh profiles.
- 2FA Integration: Uses
expectto automate the handshake between your credentials and the Sophos/OpenVPN MFA prompt. - Session Self-Healing: Automatically identifies and closes "stuck" sessions (tun interfaces) before attempting a new connection.
- Detailed Verbosity: Built-in status and stop commands for easy CLI management.
Ensure you have the following installed:
openvpn3-linuxInstallexpectgrep,awk,xargs(standard on most distros)
-
Clone the repo:
git clone https://github.com/hopgausi/openvpn3-autowrap.git cd openvpn3-autowrap chmod +x vpn.sh mkdir -p ~/bin cp vpn.sh ~/bin/vpn
-
Configure your credentials and ovpn filepath: Edit the top of the vpn script with your VPN username, password and path to your .ovpn file.
nano ~/bin/vpn -
Usage
| Command | Action |
|---|---|
vpn start |
Cleans duplicates, imports config, and starts session with 2FA |
vpn stop |
Safely disconnects all active sessions |
vpn status |
Shows current session info and connection paths |
To see your VPN status in the GNOME top bar at all times:
-
Install the monitor:
sudo apt update && sudo apt install indicator-sysmonitor -
Launch it and go to
Preferences->Advanced. -
Create a new sensor called "VPN":
- Command:
IP=$(openvpn3 sessions-list | grep "Connected to:" | awk -F: '{print $3}' | head -n 1); if [ -z "$IP" ]; then echo "off"; else echo "on($IP)"; fi
- Command:
-
Add
vpn: {VPN}to your customization line in the Sensors tab. -
You should be able to see the vpn status in the top bar of the system monitor