OpenVPN-Auth
| Inhaltsverzeichnis |
Installation
apt-get install sasl2-bin
Konfiguration
in der datei /etc/default/saslauthd prüfen ob folgenden dinge gesetzt sind:
START=yes
für den automatischen start beim systemstart
MECHANISMS="pam"
um auf die systembenutzer zurückgreifen zu können
Server
zur Server Konfiguration folgendes hinzufügen:
script-security 3 auth-user-pass-verify /etc/openvpn/auth.sh via-env
das Script /etc/openvpn/auth.sh
#!/bin/sh
echo user: $username
echo passwd: $password
in_vpn="no"
# for all group that the user is in
list=`groups $username`
for item in $list; do
# if gout vpn is found
if [ "$item" == "vpn" ]; then
echo group: vpn
in_vpn=yes
break
fi
done
# if the user not in group vpn fail
if [ "$in_vpn" == "no" ]; then
echo 1: FAIL "user not in group vpn"
exit 1
fi
# test username and password with sasl
testsaslauthd -u $username -p $password
if [ $? -eq 0 ]; then
#Auth OK
exit 0
else
# Auth Faild
exit 1
fi
Client
in der Clientconf hinzufügen
auth-user-pass
