Skip to content

Instantly share code, notes, and snippets.

@oalee
Last active April 14, 2016 10:35
Show Gist options
  • Save oalee/a8f9899a08fc869511c681881347ea4f to your computer and use it in GitHub Desktop.
Save oalee/a8f9899a08fc869511c681881347ea4f to your computer and use it in GitHub Desktop.
Openvpn scripts

this is some scripts for using openvpn in linux easier.

vpn function usage

use vpn server . example :

vpn de

Requirements

make .openvpn_profile in your home directory . this file format is

yes
username
password

Other notes

  • use vpnkill to disconnect
  • use isvpnconnected to know if the vpn is connected !
  • there might be some errors , you can always see the log by watching ~/.vpn_log file .for example cat ~/.vpn_log
  • this scripts will work with VPN Makres servers , if you have another openvpn provider , change the vpn function server name to match that
  • add this scripts to your bash_profile or bashrc so you wont have to run this script every time ;)
function vpn
{
sudo openconnect -b $1.cisadd.com < ~/.openvpn_profile > ~/.vpn_log 2> ~/.vpn_log
}
alias vpnkill="sudo pkill -SIGINT openconnect"
alias isvpnconnected="ifconfig | grep -ic tun"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment