Make OpenVPN username case insensitive
This commit is contained in:
parent
e6f33e3015
commit
f35d41bc3a
@ -21,8 +21,8 @@ if [ -f "/etc/openvpn/easy-rsa/pki/issued/$CLIENT_NAME.crt" ]; then
|
||||
exit 1
|
||||
fi
|
||||
if grep -q "^auth-user-pass-verify" "/etc/openvpn/myserver.conf"; then
|
||||
read -e -p "Enter username: " -i "$CLIENT_USERNAME" CLIENT_USERNAME
|
||||
if grep -q "^$CLIENT_USERNAME" "/etc/openvpn/credentials"; then
|
||||
read -e -p "Enter username: " -i "$CLIENT_NAME" CLIENT_USERNAME
|
||||
if grep -i -q "^$CLIENT_USERNAME" "/etc/openvpn/credentials"; then
|
||||
echo "Username $CLIENT_USERNAME already exists"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -144,8 +144,8 @@ if [ -f "/etc/openvpn/easy-rsa/pki/issued/$CLIENT_NAME.crt" ]; then
|
||||
exit 1
|
||||
fi
|
||||
if grep -q "^auth-user-pass-verify" "/etc/openvpn/myserver.conf"; then
|
||||
read -e -p "Enter username: " -i "$CLIENT_USERNAME" CLIENT_USERNAME
|
||||
if grep -q "^$CLIENT_USERNAME" "/etc/openvpn/credentials"; then
|
||||
read -e -p "Enter username: " -i "$CLIENT_NAME" CLIENT_USERNAME
|
||||
if grep -i -q "^$CLIENT_USERNAME" "/etc/openvpn/credentials"; then
|
||||
echo "Username $CLIENT_USERNAME already exists"
|
||||
exit 1
|
||||
fi
|
||||
@ -217,7 +217,7 @@ readarray -t lines < $1
|
||||
username=${lines[0]}
|
||||
password=${lines[1]}
|
||||
password_hash=$(echo -n "$password" | sha256sum | awk '{print $1}')
|
||||
if grep -q "^$username:$password_hash:" "/etc/openvpn/credentials"; then
|
||||
if grep -i -q "^$username:$password_hash:" "/etc/openvpn/credentials"; then
|
||||
exit 0 # Authentication success
|
||||
else
|
||||
exit 1 # Authentication failed
|
||||
|
Loading…
x
Reference in New Issue
Block a user