Eleven Years of Service
Posts: 9
Threads: 3
how to prevent port scanning 06-08-2014, 01:45 PM
#1
I have a remote server that I access it via ssh. As I have seen many attempts to hack into, I disabled pass login, configured allowed host ip.
I want to change the default ssh port but a port scan (nmap) will tell the hacker about my open ssh port!!
so is there anyway to prevent port scanning (router has opening port at 22 and it forwards the ssh service to xx port number)? so that a hacker never finds my open port number. If one can do this then please provide me more detail, thanks
•
Thirteen Years of Service
Posts: 3,169
Threads: 99
RE: how to prevent port scanning 06-08-2014, 11:20 PM
#3
You cant prevent a portscan. Thats just stupid. You can make a portscan ineffective, but thats about it.
For extreme protection - I would recommend you google Portknocking. Im not gonna post an in depth tutorial because there are already plenty on Google.
But essentially, You block all the ports you want blocked with a firewall. Using an application or custom crafted rules, you then have the port opened in the firewall for your IP/session if and only if you connect to a series of other ports first (also closed).
So for example, if you connected to ports 1111, 2222, 3333, 4444 - in that order - Port 22 will be opened for you. Wont be accessible to anyone else however.
•
Twelve Years of Service
Posts: 3
Threads: 0
RE: how to prevent port scanning 06-10-2014, 09:54 PM
#4
Indeed. It is not possible to stop port scanning. You can only show the ports you have open, as closed.
•
Twelve Years of Service
Posts: 17
Threads: 1
RE: how to prevent port scanning 06-18-2014, 01:56 AM
#9
Well, one of the simplest ways to do it more or less effectuvely is to listen on random ports and block ip addresses that are trying to connect there. Well, thats could sound too much primitive, but it works de facto in most of cases.
•
Twelve Years of Service
Posts: 40
Threads: 3
RE: how to prevent port scanning 06-18-2014, 09:17 PM
#10
You can't actually block port scanners, this is because open ports need to allow incoming connections or they would be pointless.
However, you may install a firewall or use IPtables to detect and ban IP addresses that attempt to connect to multiple ports in a certain time frame.
•