首页 > 系统服务 > 详细

Linux基础安全配置(centos7)

时间:2021-07-14 10:34:15      阅读:51      评论:0      收藏:0      [点我收藏+]

1、帐户口令的生存期不长于90天

sed -i.old s#99999#90#g /etc/login.defs
egrep "90" /etc/login.defs

2、密码强度
口令长度至少12位,并包括数字、小写字母、大写字母和特殊符号4类中至少3类, 更新的口令至少5次内不能重复。

sed -i.old 14apassword    requisite     pam_pwquality.so minlen=12 dcredit=-1 ucredit=-1 lcredit=-1 ocredit=-1 try_first_pass local_users_only retry=5 enforce_for_root authtok_type= /etc/pam.d/system-auth 
egrep "minlen=12" /etc/pam.d/system-auth

3、用户登录回话超时时间
设置回话超时时间为5分钟,如果用户登录5分钟无响应则中断回话

echo "export TMOUT=300" >>/etc/profile
source /etc/profile

4、账户锁定策略
当用户终端登录失败次数超过5次,锁定半小时

sed -i.old22 3aauth required pam_tally2.so deny=5 unlock_time=1800 even_deny_root root_unlock_time=1800 /etc/pam.d/system-auth 
egrep "unlock_time=1800" /etc/pam.d/system-auth

5、 系统审计日志开启

service auditd restart
service rsyslog restart
service auditd status|egrep running
service rsyslog status|egrep running

6、 防火墙开启

systemctl restart firewalld
systemctl status firewalld |egrep running

7、Root用户特定ip远程登录
指定跳板机和运维服务器登录,其他服务器禁止ssh登录

echo "AllowUsers root@10.0.2.35" >> /etc/ssh/sshd_config
systemctl restart sshd

  #删除该策略
  #sed -i ‘/^AllowUsers/d‘ /etc/ssh/sshd_config

8 应用最小化权限运行
Tomcat应用基本已经是appuser用户运行,检查是有遗漏的

ps -ef|grep java

9 检查是否存在空口令和root权限的账号

egrep ":0:0:" /etc/passwd |wc -l
egrep ":0:" /etc/group |wc -l

 

注:仅供参考,建议测环境测试,如若出了问题概不负责。

Linux基础安全配置(centos7)

原文:https://www.cnblogs.com/zhj5418/p/15009299.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!