|
|
 |
 |
|
|
 |
|
linux SSH 的一些安全小技巧
|
|
|
|
编辑:华夏媒体 作者:未知 来源:网络 时间:2006-07-29 总浏览量:1644 |
|
文字大小:[ 大 中 小 ]
文字颜色: 双击滚屏/单击停止 |
|
[上一页] [1] [2] [3] [4] [5] [下一页]
|
chain_name=ssh_rules mail_to=root
# clear chain if exits, or create chain. iptables -L -n | /bin/grep -q "^Chain $chain_name" && { iptables -F $chain_name true } || { iptables -N $chain_name iptables -I INPUT -p tcp --dport 22 -j $chain_name }
# clear chain when needed [ "$1" = clear ] && { iptables -F $chain_name exit 0 }
# do nothing while list is empty [ -s $list_file ] || exit 1
# add rule iptables -A $chain_name -p tcp --dport 22 -s $(< $list_file) -j ACCEPT && \ echo "ssh opened to $(< $list_file) on $(date)" | mail -s "sshopen" $mail_to END # chmod +x /etc/iptables/sshopen.sh # echo -e ’sshopen\t\t1234/tcp’ >> /etc/services # cat > /etc/xinetd.d/sshopen <<END service sshopen { disable = no socket_type = stream protocol = tcp wait = no user = root server = /etc/iptables/sshopen.sh } # iptables -I INPUT -p tcp --dport 1234 -j ACCEPT # cat > /etc/cron.d/sshopen <<END */5 * * * * root /etc/iptables/sshopen.sh clear END
--------------------------- 转往 client 端 在 browser URL 输入: http://server.machine/ssh_open/ssh_open.php?myip=1.2.3.4 (若不指定 ?myip=1.2.3.4 则以 client 当时 IP 为准, 若没经 proxy 的话.)
|
|
[上一页] [1] [2] [3] [4] [5] [下一页]
|
|
|
打印 收藏 关闭 至顶部 |
|
 |
|