Merge e8a76782631bddf3cfa8783cef74f28b3211fabf into 7e32f6ae8373fe66e657cb693518c45768d0ea6e

This commit is contained in:
Joel Ramos 2025-03-21 21:14:15 +05:00 committed by GitHub
commit 5685999d87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1115,8 +1115,8 @@ function newClient() {
read -rp "Select an option [1-2]: " -e -i 1 PASS read -rp "Select an option [1-2]: " -e -i 1 PASS
done done
CLIENTEXISTS=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep -c -E "/CN=$CLIENT\$") CLIENTEXISTS=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep -E "^V" | grep -c -E "/CN=$CLIENT\$")
if [[ $CLIENTEXISTS == '1' ]]; then if [[ $CLIENTEXISTS != '0' ]]; then
echo "" echo ""
echo "The specified client CN was already found in easy-rsa, please choose another name." echo "The specified client CN was already found in easy-rsa, please choose another name."
exit exit
@ -1216,6 +1216,7 @@ function revokeClient() {
CLIENT=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | sed -n "$CLIENTNUMBER"p) CLIENT=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | sed -n "$CLIENTNUMBER"p)
cd /etc/openvpn/easy-rsa/ || return cd /etc/openvpn/easy-rsa/ || return
./easyrsa --batch revoke "$CLIENT" ./easyrsa --batch revoke "$CLIENT"
./easyrsa upgrade ca
EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl
rm -f /etc/openvpn/crl.pem rm -f /etc/openvpn/crl.pem
cp /etc/openvpn/easy-rsa/pki/crl.pem /etc/openvpn/crl.pem cp /etc/openvpn/easy-rsa/pki/crl.pem /etc/openvpn/crl.pem