[SOLVED] howto know status of openvpn client ?

All comments and questions related to the functionality of the OpenVPN web pages and forum should go here.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Locked
tushar.sharma
OpenVPN Power User
Posts: 58
Joined: Fri Oct 07, 2011 12:23 pm
Location: Pune
Contact:

[SOLVED] howto know status of openvpn client ?

Post by tushar.sharma » Thu Feb 02, 2012 1:28 pm

Hello All,

howto know status of openvpn client connected to server.
in openvpn --status when done with server side it shows status of all connected client,
but if I am running as client mode and connecting to server in daemon mode
how can i know status of client ( what if there are many ?) ? like in --status ?

Thanking YOu
Tushar

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: howto know status of openvpn client ?

Post by janjust » Thu Feb 02, 2012 10:16 pm

you can use --status or at least the management interface on the client side as well - this gives you a programmatic way to check if a client is up and running.

tushar.sharma
OpenVPN Power User
Posts: 58
Joined: Fri Oct 07, 2011 12:23 pm
Location: Pune
Contact:

Re: howto know status of openvpn client ?

Post by tushar.sharma » Fri Feb 03, 2012 5:46 am

Dear Jan Just,

--status on client side shows like this

Status
OPen VPN STATISTICS
Updated Fri Feb 10:43
TUN/TAP read bytes 1231
TUN/TAP write bytes 1072
Auth read bytes xxxx
END

I don't know to parse this whether client is connected or not.

and using management interface i need to telnet to particular, I want that whenever client succesfully authenticates its status something like Peer Connection With 192.168.103.61 Initiated to be stored in file so that i can retrieve it any time.

can i use ?
--client-connect script
--route-up



Thanking You
Tushar

tushar.sharma
OpenVPN Power User
Posts: 58
Joined: Fri Oct 07, 2011 12:23 pm
Location: Pune
Contact:

Re: howto know status of openvpn client ?

Post by tushar.sharma » Fri Feb 03, 2012 6:16 am

i have even tried changing status-version 1,2,3 but same results.

Thanking You
Tushar

tushar.sharma
OpenVPN Power User
Posts: 58
Joined: Fri Oct 07, 2011 12:23 pm
Location: Pune
Contact:

Re: howto know status of openvpn client ?

Post by tushar.sharma » Tue Feb 07, 2012 5:41 am

Do i need to grep output from log files ??

Thanking You
Tushar

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: howto know status of openvpn client ?

Post by janjust » Tue Feb 07, 2012 9:52 am

TUN/TAP read bytes 1231
TUN/TAP write bytes 1072
the fact that bytes are read from and written to the tun/tap adapter is an indication that the VPN is functional; other than that there is no (easy) method to see whether the VPN is active; your best bet is to simply ping the VPN server IP.

tushar.sharma
OpenVPN Power User
Posts: 58
Joined: Fri Oct 07, 2011 12:23 pm
Location: Pune
Contact:

Re: howto know status of openvpn client ?

Post by tushar.sharma » Tue Feb 07, 2012 1:57 pm

Dear JanJust,


I got some info regarding use of management client to display status of client on GUI interface, I didnt exactly
got what they actually want to convey but i will try other way and will try to look in more detail what you have suggested.

tushar.sharma
OpenVPN Power User
Posts: 58
Joined: Fri Oct 07, 2011 12:23 pm
Location: Pune
Contact:

Re: howto know status of openvpn client ?

Post by tushar.sharma » Mon Feb 13, 2012 4:32 am

Hey JanJust, i have determine whether client is connected or not using management interface
and state command in that. I have opened tcp socket on management interface and determine status of client using state command.

Still It is giving only whether client is connected or not, and i want time too i.e from when since client is connected. This information is even not there in status command.

From where can i get whether particular client instance is connected and time since when it is connected. ?

Thanking You
tushar

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: howto know status of openvpn client ?

Post by janjust » Mon Feb 13, 2012 3:24 pm

you can only get that information by parsing the client connect logs; alternatively you could use an 'up' and 'down' script to launch an external program which records the date&time.

tushar.sharma
OpenVPN Power User
Posts: 58
Joined: Fri Oct 07, 2011 12:23 pm
Location: Pune
Contact:

Re: howto know status of openvpn client ?

Post by tushar.sharma » Tue Feb 14, 2012 5:46 am

Dear JanJust,

Done that using up and down script as suggest by Dazo on irc channel..Thanks for replying.

Thanking You,
Tushar

Locked