说明:因工作需要,特此写本博文,方便以后查阅。如文中有问题之处,望指点,拍砖请轻拍,谢谢合作。
/*******************************************************************
*加固系统:ubuntu14.04
********************************************************************/
一、禁止root远程登录
加固步骤:
1、修改sshd_config文件
root@xxx:/# vim /etc/ssh/sshd_config
将默认访问端口22,修改为Port 222
将SSH协议改为SSH2,修改为Protocol 2
将PermitRootLogin yes改为PermitRootLogin no ,禁止root远程登录。
将RSAAuthentication yes改为RSAAuthentication no,关闭RSA密钥验证,此验证只针对SSH1。(sshd_config/ssh_config)
将UseDNS yes改为UseDNS no,不使用DNS反向解析。
如需设置部分用户通过ssh登录,可在文件中加入AllowUsers user1 user2(user1 user2 为用户名)。
2、查看securetty文件
root@xxx:/# more /etc/securetty
是否有下列行pts/x(x为一个十进制整数),不存在pts/x则禁止了telnet登录,存在将其所在行注释#。
3、重启ssh生效
root@xxx:/# sevice ssh restart
二、设置远程登录时提示信息
加固步骤:
1、执行如下命令创建banner信息文件
root@xxx:/# touch /etc/sshbanner
root@xxx:/# chown bin:bin /etc/sshbanner
root@xxx:/# chmod 644 /etc/sshbanner
root@xxx:/# echo "Authorized users only. All activity may be monitored and reported!" >/etc/sshbanner
2、修改/etc/ssh/sshd_config文件, 将#Bannder /etc/sshbanner 前#去掉。
或直接在文件末尾添加Bannder /etc/sshbanner。
3、重启ssh生效
root@xxx:/# sevice ssh restart
三、口令锁定策略
加固步骤:
1、执行备份:
root@xxx:/# cp -p /etc/pam.d/common-auth /etc/pam.d/common-auth.bak
2、修改策略设置:
root@xxx:/# vim /etc/pam.d/common-auth
增加auth requisite pam_tally2.so deny=5 onerr=fail even_deny_root unlock_time=100 root_unlock_time=150
到第二行,保存退出.
ubuntu14.04系统加固(4)
最新推荐文章于 2024-05-28 14:22:12 发布