Created
April 12, 2017 10:11
-
-
Save nathando/0998e7224d59cbe706143155cd6422c9 to your computer and use it in GitHub Desktop.
Generate and copy client certs from OpenVPN server
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 | |
| server="xxx.xxx.xxx.xxx" | |
| client=$1 | |
| ssh root@$server client=$client 'bash -s' <<'ENDSSH' | |
| cd /etc/openvpn/easy-rsa | |
| . ./vars | |
| ./build-key --batch $client | |
| ENDSSH | |
| scp root@$server:/etc/openvpn/easy-rsa/keys/$client.crt . | |
| scp root@$server:/etc/openvpn/easy-rsa/keys/$client.key . | |
| scp root@$server:/etc/openvpn/easy-rsa/keys/client.ovpn ./$client.ovpn | |
| scp root@$server:/etc/openvpn/ca.crt . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment