How to check is OpenVPN port is open
Hi all,
briefly: I'm helping in the development of an educational software to apply online tests. The client will connect to the server through OpenVPN to perform the test. I would like to check if the OpenVPN port is alive and accepting connections (check if there is port filtering, and so on.. ).
I'm programming in python.
Does someone know to achieve that? I'm trying to create a socket and send any message to the server, but no response, is there any kind of "hello" or something like this?
I'm a begginer programmer, maybe this is really easy, but I didn't figure it out and neither found at google.
Thanks in advance.
Lucas.
Quoted 11 lines · Lucas Mocellin
Hi all,
briefly: I'm helping in the development of an educational software to apply
online tests. The client will connect to the server through OpenVPN to
perform the test. I would like to check if the OpenVPN port is alive and
accepting connections (check if there is port filtering, and so on.. ).
Quoted 7 lines
I'm programming in python.
Does someone know to achieve that? I'm trying to create a socket and send
any message to the server, but no response, is there any kind of "hello" or
something like this?
You could re-implement the beginning of the connection but why not simply use the subprocess module to run openvpn? You can see if it succeeds and if not you can capture output and have a real log from which the user (broadly speaking) can diagnose the problem.
Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
Hi again,
I forgot to say that I'm working with UDP, and all the problem is around this protocol connectionless.
I tried to sniff and redo the "connection start", but always the packages are different but actually, I didn't figured it out completely, and probably I won't studi the OpenVPN protocol deeply right now for that.
ngrep:
#
U 2009/10/29 09:33:07.954515 192.168.9.129:57691 -> 192.168.9.127:1194
8..Rao.T..........
#
U 2009/10/29 09:33:07.955865 192.168.9.127:1194 -> 192.168.9.129:57691
@6..............Rao.T.....
#
U 2009/10/29 09:33:07.956913 192.168.9.129:57691 -> 192.168.9.127:1194
(..Rao.T......6.......
the first packet always start with an "8" and has a fixed lenght of 18 characters:
8.....7U..........
8..XyR............
8......h..........
but I don't know if I just can send this "info" like a string creating a UDP socket, I tried and it didn't work, maybe some mistake, I can try again.
I can't just start an OpenVPN because I don't have the key yet, this verification is done before the OpenVPN connection.
I got this from another FORUM:
"The trouble with verifying UDP ports as open is that if a UDP port is open, you get no response from it. That's also the case when it's filtered of course. "
I understand but not at all, if there is no response, there is no communication.. hehe
another manner of how to check if an OpenVPN UDP port is open?
Thanks for the answers folks!
Lucas.
Quoted 22 lines · Yevgeny Kosarzhevsky
Hi,
Quoted 7 lines · Lucas Mocellin
Hi all,
briefly: I'm helping in the development of an educational software to apply online tests. The client will connect to the server through OpenVPN to perform the test. I would like to check if the OpenVPN port is alive and accepting connections (check if there is port filtering, and so on.. ).
Quoted 6 lines
I'm programming in python.
Does someone know to achieve that? I'm trying to create a socket and send any message to the server, but no response, is there any kind of "hello" or something like this?
You can test it with netcat utility which is run on the server in listen mode and on client in client mode.
Hello,
again I fell in this problem, I must solve this now, so if someone has a better idea than trying to reproduce the OpenVPN protocol begin and see if there is any answer, I will have to figure out how to send the OpenVPN protocol by UDP manually.
I would like to see if there is a simpler manner to check if OpenVPN is listenning and accepting connections.
any help is welcome.
Thanks in advance,
Lucas.
Quoted 77 lines · Lucas Mocellin
Hi again,
I forgot to say that I'm working with UDP, and all the problem is around this protocol connectionless.
I tried to sniff and redo the "connection start", but always the packages are different but actually, I didn't figured it out completely, and probably I won't studi the OpenVPN protocol deeply right now for that.
ngrep:
#
U 2009/10/29 09:33:07.954515 192.168.9.129:57691 -> 192.168.9.127:1194
8..Rao.T..........
#
U 2009/10/29 09:33:07.955865 192.168.9.127:1194 -> 192.168.9.129:57691@6..............Rao.T.....
#
U 2009/10/29 09:33:07.956913 192.168.9.129:57691 -> 192.168.9.127:1194(..Rao.T......6.......
the first packet always start with an "8" and has a fixed lenght of 18 characters:
8.....7U..........
8..XyR............
8......h..........but I don't know if I just can send this "info" like a string creating a UDP socket, I tried and it didn't work, maybe some mistake, I can try again.
I can't just start an OpenVPN because I don't have the key yet, this verification is done before the OpenVPN connection.
I got this from another FORUM:
"The trouble with verifying UDP ports as open is that if a UDP port is open, you get no response from it. That's also the case when it's filtered of course. "I understand but not at all, if there is no response, there is no communication.. hehe
another manner of how to check if an OpenVPN UDP port is open?
Thanks for the answers folks!
Lucas.
Quoted 22 lines · Yevgeny Kosarzhevsky
Hi,
Quoted 7 lines · Lucas Mocellin
Hi all,
briefly: I'm helping in the development of an educational software to apply online tests. The client will connect to the server through OpenVPN to perform the test. I would like to check if the OpenVPN port is alive and accepting connections (check if there is port filtering, and so on.. ).
Quoted 6 lines
I'm programming in python.
Does someone know to achieve that? I'm trying to create a socket and send any message to the server, but no response, is there any kind of "hello" or something like this?
You can test it with netcat utility which is run on the server in listen mode and on client in client mode.
I have everything filtered. and the problem is that I should this from the server, and that's not what I need, I need to check from the client if the server is running. But probably this server works as NMAP or NC, look at this part of man nmap:
UDP scan works by sending an empty (no data) UDP header to every targeted port. If an ICMP port unreachable error (type 3, code 3) is
returned, the port is closed. Other ICMP unreachable errors
(type 3, codes 1, 2, 9, 10, or 13) mark the port as filtered. Occasionally, a
service will respond with a UDP packet, proving that it is
open. If no response is received after retransmissions, the port is classified
as open|filtered. This means that the port could be open, or
perhaps packet filters are blocking the communication. Versions scan (-sV) can
be used to help differentiate the truly open ports from the
filtered ones.
Quoted 21 lines · Thomas Reifferscheid
Point your browser to http://www.utorrent.com/testport?port=1194
to get an idea if there is a [openvpn] daemon listening on udp/1194HTH
TLucas Mocellin schrieb:
Hello,
Quoted 9 lines
again I fell in this problem, I must solve this now, so if someone has a better idea than trying to reproduce the OpenVPN protocol begin and see if there is any answer, I will have to figure out how to send the OpenVPN protocol by UDP manually.
I would like to see if there is a simpler manner to check if OpenVPN is listenning and accepting connections.
...