I need to test whether an OpenVPN Service (ssl-vpn) is listening on a specific IP address and port from a linux box. I'd like to do that with a bash script or some code in python or c/c++ but that's not the problem - I can implement it as soon as I know how UDP works here.
My problem is: the VPN service on the remote machine is configured to use UDP and since UDP isn't a protocoll that supports connections like TCP I assume that any answer to a message/package that I sent to the remote machine is answered to another port on my local machine.
I know netcat but obviously I won't receive an answer using the connectionless UDP protocoll, so checking with nc -u ip port
won't work.
So, how do I check if VPN is really up and running behind an IP address and port.
Edit:
Is it possible to emulate the VPN with a bash script? Something like connecting with a HELO like in SMTP and checking if the VPN server sent an answer back? I'd know how this works with tcp but I have no clue how to do that with UDP.
Edit2:
I just found this answer. So, how do I listen to ICMP packages that should be answered when the remote server isn't available? Is that possible with bash/python/c/c++ or netcat? How do I know if the server is there, listening to requests (there shouldn't be an ICMP response then, right?)?
The only way I think you can reliably test this would be to simply establish a connectionto the VPN.
As you said OpenVPN while using TCP cannot be tested using a simple TCP connect. I suspect the only way to test is by speaking the OpenVPN protocol.
I soppose it could be possible to modify the client to test while not fully connecting.
This is from my previous answer to a similar question.
How to check that an OpenVPN server is listening on a remote port without using OpenVPN client?
If you are using tls authentication (tls-auth configuration line) this is not working, but you can get the idea of UDP conversation.