码迷,mamicode.com
首页 > 其他好文 > 详细

SSH安全加固

时间:2017-08-01 21:49:59      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:安全   ssh   配置   

  • 清空SSH登录的bannner   默认为空

  • 清除ssh的版本信息

    # strings /usr/sbin/sshd | grep 6.6

    # sed -i ‘s/OpenSSH_6.6.1/OpenSSH_8.8/g‘/usr/sbin/sshd

  • SSH使用版本2

 # Protocol = 2

  • 不允许root远程登录;

 # PermitRootLogin no #禁止root登录SSH

  • 不允许空密码

  • 不允许rlogin、rhost登录

 # IgnoreRhosts =yes

  • 配置并限制允许登录的IP地址与账户

 # cat /etc/ssh/sshd_config显示控制可访问的IP和账户

   AllowUsersuser1 user2

 或# more /etc/hosts.allow 

   sshd:10.0.0.1:allow

  • 更改默认监听端口,设置非标准端口

  • 密码重试次数

MaxAuthTries=6

  • 禁用ssh弱加密

# vim /etc/ssh/sshd_config

Ciphers aes192-ctr,aes256-ctr,arcfour256

MACs hmac-sha1,hmac-ripemd160

#查看命令

ssh -vv -oCiphers=aes128-cbc,3des-cbc,blowfish-cbc <serverIP>

  #验证:ssh -vv -o Ciphers=aes192-ctr,aes256-ctr serverIP

会提示passwd登录证明已经匹配

 

使用密钥认证登录服务器


本文出自 “流星工作室” 博客,请务必保留此出处http://redone.blog.51cto.com/5382451/1952688

SSH安全加固

标签:安全   ssh   配置   

原文地址:http://redone.blog.51cto.com/5382451/1952688

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!