Problems with client-connect/client-disconnect script
Posted: Mon Jan 30, 2017 12:56 am
Hey guys,
I'm using auth-user-pass-verify, client-connect and client-disconnect to handle some database related stuff for my openvpn server. This works perfectly so far but now I'm having some big trouble for hours with my connect and disconnect script.
Inside both scripts I'm doing some database related stuff, now I wanted to extract information from "openvpn-status.log" to get information about bandwith usage but this is where my problems start.
First I tried using fopen(), but this causes the php script to "hang", when I do "ps -U openvpn" I see a running php process that never stops and freezes the whole VPN server.
Afterwards I tried to use fsockopen() to connect to the management interface, to get my information from there but this gives me the exact same result.
When I remove fopen()/fsockopen() the script runs perfectly. Funny thing is, that the script also works perfectly when I do it like this from command line:
Anways, as soon as OpenVPN itself executes the script the mentioned problems start to happen, somehow this is related to fopen() and fsockopen() but I have no idea what the reason is and why it works perfectly when I "manually" execute it from command line.
Thanks in advance and best regards
I'm using auth-user-pass-verify, client-connect and client-disconnect to handle some database related stuff for my openvpn server. This works perfectly so far but now I'm having some big trouble for hours with my connect and disconnect script.
Code: Select all
client-connect "/usr/bin/php scripts/connect.php"
client-disconnect "/usr/bin/php scripts/disconnect.php"
First I tried using fopen(), but this causes the php script to "hang", when I do "ps -U openvpn" I see a running php process that never stops and freezes the whole VPN server.
Afterwards I tried to use fsockopen() to connect to the management interface, to get my information from there but this gives me the exact same result.
When I remove fopen()/fsockopen() the script runs perfectly. Funny thing is, that the script also works perfectly when I do it like this from command line:
Code: Select all
common_name="xyz" php scripts/disconnect.php
Anways, as soon as OpenVPN itself executes the script the mentioned problems start to happen, somehow this is related to fopen() and fsockopen() but I have no idea what the reason is and why it works perfectly when I "manually" execute it from command line.
Thanks in advance and best regards