diff --git a/add-usr.sh b/add-usr.sh new file mode 100644 index 0000000..9147953 --- /dev/null +++ b/add-usr.sh @@ -0,0 +1,34 @@ +#!/bin/bash + + +new_client () { +# Generates the custom client.ovpn +{ +NEW_CLIENT=$1 +cat /etc/openvpn/server/client-common.txt + echo "" + cat /etc/openvpn/server/easy-rsa/pki/ca.crt + echo "" + echo "" + sed -ne '/BEGIN CERTIFICATE/,$ p' /etc/openvpn/server/easy-rsa/pki/issued/$NEW_CLIENT.crt + echo "" + echo "" + cat /etc/openvpn/server/easy-rsa/pki/private/$NEW_CLIENT.key + echo "" + echo "" + sed -ne '/BEGIN OpenVPN Static key/,$ p' /etc/openvpn/server/tc.key + echo "" + } > /etc/openvpn/client/$NEW_CLIENT.ovpn +} + + +for NEW_USER in "$@" +do +echo "New client certification generation for: " $NEW_USER +bash /etc/openvpn/server/easy-rsa/easyrsa build-client-full $NEW_USER nopass + +new_client $NEW_USER + +done + +