Skip to content

Commit

Permalink
Change OpenVPN auth to php-cgi for the time being. Fixes #4521
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-p committed Mar 15, 2021
1 parent f5ff5cd commit 1bfdb79
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/usr/local/sbin/ovpn_auth_verify
Expand Up @@ -24,14 +24,14 @@ if [ "$1" = "tls" ]; then
for check_depth in $(/usr/bin/seq ${3} -1 0)
do
eval serial="\$tls_serial_${check_depth}"
RESULT=$(/usr/local/sbin/fcgicli -f /etc/inc/openvpn.tls-verify.php -d "servercn=$2&depth=$3&certdepth=$4&certsubject=$5&serial=$serial&config=$config")
RESULT=$(/usr/local/bin/php-cgi -q /etc/inc/openvpn.tls-verify.php "servercn=$2&depth=$3&certdepth=$4&certsubject=$5&serial=$serial&config=$config")
done
else
# Single quoting $password breaks getting the value from the variable.
# Base64 and urlEncode usernames and passwords
password=$(echo -n "${password}" | openssl enc -base64 | sed -e 's_=_%3D_g;s_+_%2B_g;s_/_%2F_g')
username=$(echo -n "${username}" | openssl enc -base64 | sed -e 's_=_%3D_g;s_+_%2B_g;s_/_%2F_g')
RESULT=$(/usr/local/sbin/fcgicli -f /etc/inc/openvpn.auth-user.php -d "username=$username&password=$password&cn=$common_name&strictcn=$3&authcfg=$2&modeid=$4&nas_port=$5")
RESULT=$(/usr/local/bin/php-cgi -q /etc/inc/openvpn.auth-user.php "username=$username&password=$password&cn=$common_name&strictcn=$3&authcfg=$2&modeid=$4&nas_port=$5")
fi

if [ "${RESULT}" = "OK" ]; then
Expand Down
4 changes: 2 additions & 2 deletions src/usr/local/sbin/ovpn_auth_verify_async
Expand Up @@ -35,7 +35,7 @@
# nas_port - $5

# ---------- Command Definitions
fcgicli="/usr/local/sbin/fcgicli"
phpcgi="/usr/local/bin/php-cgi"
openssl="/usr/bin/openssl"
sed="/usr/bin/sed"
auth_user_php="/etc/inc/openvpn.auth-user.php"
Expand Down Expand Up @@ -66,7 +66,7 @@ auth_server_1="cn=${common_name}&strictcn=${strictcn}&authcfg=${authcfg}&dev=${d
auth_server_2="modeid=${modeid}&nas_port=${nas_port}"
auth_args="${auth_credentials}&${auth_server_1}&${auth_server_2}"

result=$("${fcgicli}" -f "${auth_user_php}" -d "${auth_args}")
result=$("${phpcgi}" -f "${auth_user_php}" "${auth_args}")

# ---------- Write the Result

Expand Down

0 comments on commit 1bfdb79

Please sign in to comment.