1
|
#!/bin/sh
|
2
|
|
3
|
if [ "$1" = "tls" ]; then
|
4
|
RESULT=$(/usr/local/sbin/fcgicli -f /etc/inc/openvpn.tls-verify.php -d "servercn=$2&depth=$3&certdepth=$4&certsubject=$5")
|
5
|
else
|
6
|
# Single quoting $password breaks getting the value from the variable.
|
7
|
password=$(echo -n "${password}" | openssl enc -base64 | sed -e 's/=/%3D/g')
|
8
|
username=$(echo -n "${username}" | openssl enc -base64 | sed -e 's/=/%3D/g')
|
9
|
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")
|
10
|
fi
|
11
|
|
12
|
if [ "${RESULT}" = "OK" ]; then
|
13
|
exit 0
|
14
|
fi
|
15
|
|
16
|
exit 1
|