Skip to content

Instantly share code, notes, and snippets.

@bigpresh
Created September 17, 2019 09:50
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 bigpresh/aadf6c04c7a930b2895714d3840d4a43 to your computer and use it in GitHub Desktop.
Save bigpresh/aadf6c04c7a930b2895714d3840d4a43 to your computer and use it in GitHub Desktop.
gen-client-tarball.sh
[davidp@supernova:~/openvpn-easy-rsa]$ cat gen-client-tarball
#!/bin/bash
# Call with a client name, it will create a tarball named after that client
# containing keys/$CLIENT.{key,crt} and keys/ca.crt ready to provide
CLIENT=$1
TARBALL=$CLIENT-openvpn-keys.tar.gz
if [[ ! -f keys/$CLIENT.key ]]; then
echo "FAIL: keys/$CLIENT.key not found";
echo "Did you typo, or forget to generate them with ./build-key $CLIENT ?"
exit 1;
fi
tar cvvfz $TARBALL -C keys/ $CLIENT.{crt,key} ca.crt
echo "Keys and CA cert should be in $TARBALL"
echo "Copy it to the client, then extract to /etc/openvpn, e.g.:"
echo "sudo tar -C /etc/openvpn -xzvf $CLIENT-openvpn-keys.tar.gz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment