Skip to content

Instantly share code, notes, and snippets.

@flickerfly
Created December 9, 2013 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flickerfly/7873733 to your computer and use it in GitHub Desktop.
Save flickerfly/7873733 to your computer and use it in GitHub Desktop.
Create a new user and assemble the required files to setup the VPN connection on the client side. First argument on the command line is the username.
#!/bin/sh
user=$1
vpnconf="/etc/openvpn"
rsa="$vpnconf/easy-rsa"
cd $rsa
source vars
./build-key $user
mkdir ~/$user.vpnfiles
cp $vpnconf/ca.crt ~/$user.vpnfiles/
cp $vpnconf/client.conf ~/$user.vpnfiles/Org_Name.ovpn
cp $rsa/keys/$user.crt ~/$user.vpnfiles/
cp $rsa/keys/$user.key ~/$user.vpnfiles/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment