Created
March 11, 2019 17:23
-
-
Save erdnuesse/2cec690b94f80bfa18700f802df7f046 to your computer and use it in GitHub Desktop.
create vpn user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
user="$1" | |
############################ | |
# by KU / 2019 | |
# works only with symlink created in /root/ to easyrsa | |
# and after initialisation of pki and CA | |
# a tutorial is here. | |
# https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-debian-9 | |
# and here. | |
# https://medium.com/teendevs/setting-up-an-openvpn-server-on-google-compute-engine-9ff760d775d9 | |
# output should be an .ovpn with all necessary creds... | |
# RUN AS: ~# create-vpn-user.sh <USERNAME> | |
# username will be the common name | |
# output file lies in /root/client-configs/files/ | |
############################ | |
cd /root/easyrsa | |
./easyrsa gen-req $user nopass | |
./easyrsa import-req /root/easyrsa/pki/reqs/$user.req $user | |
./easyrsa sign-req client $user | |
cp /root/easyrsa/pki/issued/$user.crt /root/client-configs/keys/ | |
cp /root/easyrsa/pki/private/$user.key /root/client-configs/keys/ | |
cd /root/client-configs | |
./make_config.sh $user | |
cat /root/client-configs/files/$user.ovpn | |
echo done | |
echo "go to /root/client-configs/files/ for the .ovpn file." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment