|
|
本帖最后由 yywudi 于 2014-1-26 10:29 编辑
我居然看完了...
反正我觉得这篇文章有几点可以看看:
1,小于1024的端口是系统占用的,如果是一个自定义的大端口比如52214之类来做ssh的,那么恶意程序可以开启并伪装成这个端口来监听你的数据窥伺你的密码 -->这点比较坑,谁能知道你的端口呢?扫一遍?
- Now, back to SSH: when we start SSH on port 22, we know for a fact that this is done by root or a root-process since no other user could possibly open that port. But what happens when we move SSH to port 2222? This port can be opened without a privileged account, which means I can write a simple script that listens to port 2222 and mimics SSH in order to capture your passwords. And this can easily be done with simple tools commonly available on every linux system/server. So running SSH on a non-privileged port makes it potentially LESS secure, not MORE. You have no way of knowing if you are talking to the real SSH server or not. This reason, and this reason alone makes it that you should NEVER EVER use a non-privileged port for running your SSH server.
复制代码
2,大多数程序会默认ssh是22端口,如果改成其他端口的,可能会有兼容、维护之类的问题
3,如果服务器在防火墙后面,22端口一般而言是默认放行的,如果改成其他的,可能会有网络方面的需要配置,增加麻烦
4,指出:只要做到禁止root登录,禁止密码登录改成ssh key,尽管放心大胆的用22 端口吧~~~
5,最后介绍了一种神奇的方法:按照下面说明的例子来配置iptables,先访问一个随便乱七八糟的端口(啥也没有)来设置一个'portknock' “端口敲门” 的标签,然后再访问22端口,iptables则会检查访问22端口的ip,在过去的60秒内有没有被设置为'portknock' 标签,如果有,好的放你进来,如果没有,直接咔嚓。
- Iptables has got a very nifty module called “recent”, which allows you to create simple – yet effective – port knocking sequences.
- Take a look at the following example:
- ${IPTABLES} -A INPUT -p tcp --dport 3456 -m recent --set --name portknock
- ${IPTABLES} -A INPUT -p tcp --syn --dport 22 -m recent --rcheck \
- --seconds 60 --name portknock -j ACCEPT
- ${IPTABLES} -A INPUT -p tcp --syn --dport 22 -j DENY
- What this does, is that as soon as something tries to connect to port 3456 (yes, a non-privileged port, but no problem, nothing is running on it), it will set a flag called “portknock”. Now, when we try to setup a connection to the SSH port, it will check to see if your IP has set a “portknock” flag during the last 60 seconds. If not, it will not accept the connection. And the third line will by default deny any access to SSH together as a failsafe.
复制代码
最后的方法谁可以试试看 |
|