Skip to content

Instantly share code, notes, and snippets.

@tmclnk
Last active December 30, 2020 19:20
Show Gist options
  • Save tmclnk/88fde354c904ec791ad042f35f8fc038 to your computer and use it in GitHub Desktop.
Save tmclnk/88fde354c904ec791ad042f35f8fc038 to your computer and use it in GitHub Desktop.
OpenVPN, but allow SSH
sudo apt install openvpn-systemd-resolved
#!/usr/bin/env bash
ip rule add from $(ip route get 1 | grep -Po '(?<=src )(\S+)') table 128
ip route add table 128 to $(ip route get 1 | grep -Po '(?<=src )(\S+)')/32 dev $(ip -4 route ls | grep default | grep -Po '(?<=dev )')
ip route add table 128 default via $(ip -4 route ls | grep default | grep -Po '(?<=via )(\S+)')
# To avoid password prompts you can create a file with
# username and password on lines 1 and 2 respectively,
# then add an auth-user-pass entry, e.g.
# auth-user-pass pass.txt
openvpn softether_vpn.ovpn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment