Hi,
I'm using an ActiveDirectory Authentication plus a custom python script for authorization:
[oconf=]
plugin /usr/lib/openvpn/openvpn-auth-ldap.so /etc/openvpn/server/config/AD-ldap.conf
client-connect /etc/openvpn/server/scripts/access.py
[/oconf]
Everything is working and the user authenticated and authorized can connect safely.
When the user fails the authentication the client process exits as expected:
[olog=]
Wed Apr 10 17:03:46 2019 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Wed Apr 10 17:03:46 2019 AUTH: Received control message: AUTH_FAILED
Wed Apr 10 17:03:46 2019 SIGTERM[soft,auth-failure] received, process exiting
[/olog]
but I cannot manage to obtain the same when the authentication is ok but the authorization fails (the script exits with 1).
In fact the client keeps trying and trying:
CLIENT:
[olog=]
Wed Apr 10 17:08:20 2019 [server] Peer Connection Initiated with [AF_INET]
Wed Apr 10 17:08:21 2019 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Wed Apr 10 17:08:26 2019 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Wed Apr 10 17:08:31 2019 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
[/olog]
SERVER:
[olog=]
Apr 10 17:08:20 ares ovpn-server_UDP[38724]: Beppe/1.2.3.4:40839 PLUGIN_CALL: POST /usr/lib/openvpn/openvpn-auth-ldap.so/PLUGIN_CLIENT_CONNECT status=0
Apr 10 17:08:20 ares ovpn-server_UDP[38724]: Beppe/1.2.3.4:40839 OPTIONS IMPORT: reading client specific options from: /tmp/openvpn_cc_1f6bec0bd1abbb4523d69f7555b449d8.tmp
Apr 10 17:08:20 ares ovpn-server_UDP[38724]: Beppe/1.2.3.4:40839 WARNING: Failed running command (--client-connect): external program exited with error status: 1
Apr 10 17:08:22 ares ovpn-server_UDP[38724]: Beppe/1.2.3.4:40839 PUSH: Received control message: 'PUSH_REQUEST'
Apr 10 17:08:26 ares ovpn-server_UDP[38724]: Beppe/1.2.3.4:40839 PUSH: Received control message: 'PUSH_REQUEST'
[/olog]
Is there anything that I need to do on the custom script to simply close the connection in the same way as the ldap auth plugin is doing?
Thanks
Giuseppe