SSH安全加固

  • 隱藏SSH登錄的bannner   默認爲空

  • 修改ssh的版本信息

  • # cp /usr/sbin/sshd /usr/sbin/sshd.bak

    # strings /usr/sbin/sshd | grep 6.6

    # sed -i 's/OpenSSH_6.6/OpenSSH_8.8/g' /usr/sbin/sshd

    # service restart 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登錄證明已經匹配


使用密鑰認證登錄服務器


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章