Page 1 of 1

Script client-connect

Posted: Thu Aug 01, 2019 7:03 am
by islthirion
Hello

I have a connect.sh script in which i control the mac address of the client to check that it is in the list of allowed addresses

I would like the client to receive an AUTH_FAILED code to refuse the connection

Code: Select all

test_macaddress=`grep -r "$IV_HWADDR" /etc/openvpn/macaddress.txt`

if [ ${#test_macaddress} -eq 0 ]
then
        (
       echo $common_name $IV_HWADDR "MAC_NOK" >>/var/log/openvpn/macaddr.log
        exit 1
        )
else
        (
        echo $common_name $IV_HWADDR "MAC_OK" >>/var/log/openvpn/macaddr.log
        exit 0
        )
fi
if the mac address is not in the list the connection is accepted even with exit code 1

how to deny the client connection ?

Thanks for your help

Stéphane

Re: Script client-connect

Posted: Thu Aug 01, 2019 1:34 pm
by islthirion
I solved my problem by use the script in the OpenVPN server parameter : auth-user-pass-verify /etc/openvpn/scripts/verif_macaddress.sh via-file

Everything it's OK

Bye