1
0
mirror of https://github.com/Nyr/openvpn-install.git synced 2024-11-24 05:56:08 +03:00

Added CLI Clients Management

This commit is contained in:
davift 2024-09-13 15:58:00 -04:00 committed by GitHub
parent 2826bbd741
commit 51adf8ae7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,7 +96,7 @@ new_client () {
echo "<tls-crypt>" echo "<tls-crypt>"
sed -ne '/BEGIN OpenVPN Static key/,$ p' /etc/openvpn/server/tc.key sed -ne '/BEGIN OpenVPN Static key/,$ p' /etc/openvpn/server/tc.key
echo "</tls-crypt>" echo "</tls-crypt>"
} > ~/"$client".ovpn } > /root/"$client".ovpn
} }
if [[ ! -e /etc/openvpn/server/server.conf ]]; then if [[ ! -e /etc/openvpn/server/server.conf ]]; then
@ -454,7 +454,7 @@ verb 3" > /etc/openvpn/server/client-common.txt
echo echo
echo "Finished!" echo "Finished!"
echo echo
echo "The client configuration is available in:" ~/"$client.ovpn" echo "The client configuration is available in:" /root/"$client.ovpn"
echo "New clients can be added by running this script again." echo "New clients can be added by running this script again."
else else
clear clear
@ -482,11 +482,12 @@ else
client=$(sed 's/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-]/_/g' <<< "$unsanitized_client") client=$(sed 's/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-]/_/g' <<< "$unsanitized_client")
done done
cd /etc/openvpn/server/easy-rsa/ cd /etc/openvpn/server/easy-rsa/
rm pki/reqs/$client.req
./easyrsa --batch --days=3650 build-client-full "$client" nopass ./easyrsa --batch --days=3650 build-client-full "$client" nopass
# Generates the custom client.ovpn # Generates the custom client.ovpn
new_client new_client
echo echo
echo "$client added. Configuration available in:" ~/"$client.ovpn" echo "$client added. Configuration available in:" /root/"$client.ovpn"
exit exit
;; ;;
2) 2)