ovpn_auth_verify 564 Bytes
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1
#!/bin/sh
2

Ad Schellevis's avatar
Ad Schellevis committed
3
if [ "$1" = "tls" ]; then
4
	/usr/local/bin/php /usr/local/etc/inc/openvpn.tls-verify.php -d "$2" "$3"
Ad Schellevis's avatar
Ad Schellevis committed
5 6
else
	# Single quoting $password breaks getting the value from the variable.
7 8 9
	# XXX I really don't like going through openssl for this...
	password=$(echo -n "${password}" | /usr/local/bin/openssl enc -base64 | sed -e 's/=/%3D/g')
	username=$(echo -n "${username}" | /usr/local/bin/openssl enc -base64 | sed -e 's/=/%3D/g')
10

11
	/usr/local/bin/php /usr/local/etc/inc/openvpn.auth-user.php "$username" "$password" "$common_name" "$3" "$2" "$4"
Ad Schellevis's avatar
Ad Schellevis committed
12 13
fi

14
exit $?