Hi,

On 02/06/21 23:07, Aleksandar Ivanisevic wrote:
is there a way to figure out which client is connected to which IP address 
(i.e. interface) other than to grep the logs?

I have a multihomed system where one uplink is of higher quality than the 
others and I would like to keep the more important tunnels on that one (if 
available, of course). I regularly have longer lasting tunnels than I normally 
keep the logs and would not like to keep them longer if not necessary.

Is that info passed to the client-connect script? Maybe I could do some 
accounting in there unless there is a more elegant way. I’ve skimmed through 
whats passed in environment variables and in the config files to it but 
couldn’t find a possible candidate on the first glance.

I need y.y.y.y%iface part from the log line below.

Jun  2 13:35:53 qbs01 openvpn[31600]: x.x.x.x:54912 [vpn] Peer Connection 
Initiated with [AF_INET]x.x.x.x:54912 (via [AF_INET]y.y.y.y%iface)

from reading the 2.5.1 sources I cannot find any environment variables being set that reflect the "incoming" IP address or interface;   I would think that during 'client-connect' time you can determine from which IP the client is connecting, e.g. by looking at the connection details at the OS level.  This may not be fool proof, however.

It may be best to actually grep the logs, especially as you can easily grep for "Peer Connection Initiated".

HTH,

JJK

PS now waiting for Gert to prove me wrong ;)



_______________________________________________
Openvpn-users mailing list
Openvpn-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-users

Reply via email to