I need to check that an OpenVPN (UDP) server is up and accessible on a given host:port.
I only have a plain Windows XP computer with no OpenVPN client (and no chance to install it) and no keys needed to connect to the server - just common WinXP command line tools, a browser and PuTTY are in my disposition.
If I was testing something like an SMTP or POP3 servert I'd use telnet and see if it responds, but how to do this with OpenVPN (UDP)?
Here is a shell one-liner:
if there is an openvpn on the other end the output will be
otherwise it will just be mute and timeout after 10 seconds or display something different.
NOTE: this works only if
tls-auth
config option is not active, otherwise the server rejects messages with incorrect HMAC.Sorry if I'm a bit late with my answer ;)
Send an udp packet with the following content:
$38$01$00$00$00$00$00$00$00
The server must respond something.
You can forge udp packets with python like this:
For anyone running across this who's trying to monitor a server that has
tls-auth
enabled, you can use the python script here: https://github.com/liquidat/nagios-icinga-openvpnThe output is formatted for use in Nagios or Icinga, but it can be run by anything/anyone, provided you have python and the tls keyfile available.
For example, if you are using
SHA256
as your digest, you'd use something like:python check-openvpn.py -p 1194 --tls-auth ta.key --digest SHA256 vpn-server.example.com
Note: you might need to add
--tls-auth-inverse
depending on the server'skey-direction
value.You can try to run the following at the CLI
This should list all processes that are listening on your server/system. Grep for the port number you want
If you can get an pcap of valid OpenVPN Client to OpenVPN server interaction, you could model the initial set of packets with something like netcat, as suggested by TiZon.
Basically, you want enough of a valid first packet to get the server to respond with at least an error message, so it doesn't have to be perfect, just good enough.
I tried going to http://pcapr.net, but I didn't see an OpenVPN example there. Perhaps, if someone else is claiming the service is up, you could get that other person to grab a pcap of the transaction.
if you have setup openvpn on a tcp listen then its as simple as
assuming 1194 is the port you have it listening on
this should give you a response of some sort to show that the openvpn server is listening