OpenVPN peer-to-peer server status of "WAIT"
-
Through a misconfiguration I created a situation where the OpenVPN client would have a status of "up" but the Server on the other side would be blank for its status.
Would be good to display something like "waiting for connection" when the OpenVPN server is up but no client is connected to it instead of the status being just blank.
So what I am proposing is to add:
if (strstr($line,"WAIT")) { $client['status']="waiting for connection"; }
in the while (!feof($fp)) { … } section of function openvpn_get_client_status in openvpn.inc.
Thanks,
Shahid
-
When my server is just waiting for a connection from the client (before anything at all has been received from the client), the code goes straight through to:
/* parse end of output line */ if (strstr($line, "END") || strstr($line, "ERROR")) break;
It seems that this "if" could put something in $client array that indicates the server is just sitting, waiting.
Do you also have a situation where the client has started to connect, the server has done some bit of the response and is somehow in an interim state where the server management daemon returns "WAIT" like in your code example?
If so, then for that case it would be useful to put something like:
if (strstr($line,"WAIT")) { $client['status']="waiting for client to finalise connection"; }
-
You are right. It puts the same status in the client as well. Not only when there has been some initial transaction between the client and the server but also when the server is completely down and the client has not been able to contact the server.
What was going through my mind when I saw the client status being up and the server status on the other end being blank was that the server was probably spitting out an unhandled status.
Probably best to leave it as-is.