Linux服务器常见安全策略设置

您所在的位置:网站首页 linux设置口令最小长度 Linux服务器常见安全策略设置

Linux服务器常见安全策略设置

2023-12-21 10:01| 来源: 网络整理| 查看: 265

一、     Linux安全设置 1、口令长度限制

设定用户默认密码长度不小于10位(数字、字母、特殊字符) 说明:该限制只是警告提示,不是强制要求

     检查项:设置用户密码最小长度  加固建议:在/etc/security/pwquality.conf中取消minlen注释符号#,同时设置最小密码长度建议10位以上 检查项:设置用户密码数字位数  加固建议:在/etc/security/pwquality.conf中取消dcredit注释符号#,同时设置为负数建议-1最少包含1位数字 检查项:设置用户密码小写字母位数  加固建议:在/etc/security/pwquality.conf中取消lcredit注释符号#,同时设置为负数建议-1最少包含1位小写字母 检查项:设置用户密码特殊字符位数  加固建议:在/etc/security/pwquality.conf中取消ocredit注释符号#,同时设置为负数建议-1最少包含1位特殊字符 2、         登录失败锁定

设定用户登录超时退出,普通用户登录失败超过5次锁定1800s.

l  tty登录限制,普通用户登录失败5分钟后锁定300s,root锁定1800s

        echo " auth        required    pam_tally2.so deny=5 unlock_time=300 even_deny_root root_unlock_time=1800" >>/etc/pam.d/login

 

l  ssh登录限制,普通用户登录失败5分钟后锁定300s,root锁定1800s

        echo " auth        required    pam_tally2.so deny=5 unlock_time=300 even_deny_root root_unlock_time=1800" >>/etc/pam.d/sshd

 

3、         设置tty登录超时自动退出

        /etc/profile 中新增

        TMOUT=600       

 

        设置bash命令保留的历史条数为10条(系统默认是1K)

        /etc/profile 中HISTSIZE改成10

 

https://blog.csdn.net/dbvasp/article/details/78717445

4、         ssh安全性配置

内置一个普通用户user,该用户的口令与root口令不一样

        useradd user

  passwd user

 

禁止SSH root登录 /etc/ssh/sshd_config

        PermitRootLogin no

       

修改ssh的端口

        Port 50060

 

禁止SSH空密码登录

        PermitEmptyPasswords no

 

开启SSH 警告标语,提高安全意识。补充:该提示支持自定义

        banner /etc/issue

       

设置ssh连接超时退出

ClientAliveInterval 60 每隔60秒向客户端发送一个“空包”,以保持于客户端的连接ClientAliveCountMax 10 总共发送10次“空包”,之后断开它们之间的连接

 

配置生效需要重启sshd服务,systemctl restart sshd

 

linux上远程的命令是  ssh -p 50060 [email protected]

本地远程命令是  ssh [email protected] 50060      

  4、禁止USB外设

echo "install usb-storage /bin/false" > /etc/modprobe.d/usb-storage.conf

https://blog.csdn.net/F8qG7f9YD02Pe/article/details/78817166

 

        不妨碍键盘鼠标的使用

5、配置恶意软件防范策略

        安装iptables服务

        rpm -ivh iptables-services-1.4.21-24.el7.x86_64.rpm

 

        开启iptables

        systemctl enable iptables && systemctl start iptables

        systemctl stop firewalld && systemctl disable firewalld

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3