Jan,
Thank you for the quick response, I appreciate it!
I think I may not have explained what I need and what I was doing very well.
First, what I need:
On the server side, I need to be able to determine the reason a connection was closed. Specifically, I need to know whether the connection timed out or the user explicitly closed it. This is important because we need to know whether most of our users' connections are being properly shut down or whether there is some other system or network problem that is causing the disconnect. What I
REALLY need is for the Radius plugin to OpenVPN to put this into a Radius Stop record as the
Acct-Terminate-Cause field, but it appears as if this is not possible without modifying the plugin code as there is no plumbing for this field in the current code. I obviously can't modify the code to set this field, however, if I can't retrieve the disconnect cause at the time of the client-disconnect (which is when the Stop record is created).
What I was doing:
I am using a Linux OpenVPN virtual machine as a client talking to another Linux OpenVPN virtual machine acting as the server. There are two instances of OpenVPN running on the server: one for UDP and one for TCP and both are using the Radius plugin. I have turned the OpenVPN logging verbosity up to 6 on the server. I realize that I need to use the explicit-exit-notify option with the UDP protocol (and I push it to the client from the server for that configuration), but I have noticed that it was not necessary for TCP. Based on your response, I added it anyway and it didn't seem to make a difference. When I disconnect the client by properly shutting down OpenVPN on the client, I see the relevant disconnect cause in the server log immediately before the client-disconnect logic is run in the Radius plugin and the client-disconnect shell script is run in OpenVPN. Presumably these happen simultaneously or very close to one another.
When the connection times out (e.g. the network cable is pulled), the server's OpenVPN log shows:
Code: Select all
Tue Oct 11 12:12:06 2011 us=600539 <user>@<domain>/<client_ip>:<client_port> SIGUSR1[soft,ping-restart] received, client-instance restarting
When the connection stops by gracefully shutting down the OpenVPN client, the server's OpenVPN log shows:
Code: Select all
Mon Oct 10 16:55:45 2011 us=122944 <user>@<domain>/<client_ip>:<client_port> SIGUSR1[soft,connection-reset] received, client-instance restarting
So my question is still: How do I get access to these different disconnect causes (ping-restart vs. connection-reset) in the client-disconnect scope? Based on the logging, they appear to be available shortly
before the client-disconnect scope, so I hope I can get at them without having to modify code to do so.
Thanks!