centos 阿里云优化建议

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sfmcatl/article/details/82957971

检查项目 : 确保禁止数据包重定向发送

加固建议: 在 /etc/sysctl.conf 文件中设置以下参数: net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 运行以下命令来设置活动的内核参数: $ sysctl -w net.ipv4.conf.all.send_redirects=0 $ sysctl -w net.ipv4.conf.default.send_redirects=0 $ sysctl -w net.ipv4.route.flush=1

检查项目 : 确保不接受ICMP重定向

加固建议: 在 /etc/sysctl.conf 文件中设置以下参数: net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 运行以下命令来设置活动的内核参数: $ sysctl -w net.ipv4.conf.all.accept_redirects=0 $ sysctl -w net.ipv4.conf.default.accept_redirects=0 $ sysctl -w net.ipv4.route.flush=1

检查项目 : 确保不接受安全的ICMP重定向

加固建议: 在 /etc/sysctl.conf 文件中设置以下参数: net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 运行以下命令来设置活动的内核参数: $ sysctl -w net.ipv4.conf.all.secure_redirects=0 $ sysctl -w net.ipv4.conf.default.secure_redirects=0 $ sysctl -w net.ipv4.route.flush=1

检查项目 : 确保已配置rsyslog默认文件权限

加固建议: 编辑/etc/rsyslog.conf并将 $FileCreateMode 设置为 0640 或更具限制性: $FileCreateMode 0640

检查项目 : 确保配置/etc/crontab上的权限

加固建议: 运行以下命令以在49304381??005478634026上设置所有权和权限: $ chown root:root /etc/crontab $ chmod og-rwx /etc/crontab

检查项目 : 确保配置/etc/cron.hourly上的权限

加固建议: 运行以下命令以设置 /etc/cron.hourly 的所有权和权限: $ chown root:root /etc/cron.hourly $ chmod og-rwx /etc/cron.hourly

检查项目 : 确保配置/etc/cron.weekly上的权限

加固建议: 运行以下命令以设置 /etc/cron.weekly 上的所有权和权限: $ chown root:root /etc/cron.weekly $ chmod og-rwx /etc/cron.weekly

检查项目 : 确保配置/etc/cron.daily上的权限

加固建议: 运行以下命令以设置 /etc/cron.daily 上的所有权和权限: $ chown root:root /etc/cron.daily $ chmod og-rwx /etc/cron.daily

检查项目 : 确保配置/etc/cron.monthly上的权限

加固建议: 运行以下命令以设置所有权和权限 /etc/cron.monthly : $ chown root:root /etc/cron.monthly $ chmod og-rwx /etc/cron.monthly

检查项目 : 确保配置/etc/cron.d上的权限

加固建议: 运行以下命令以在 /etc/cron.d 上设置所有权和权限: $ chown root:root /etc/cron.d $ chmod og-rwx /etc/cron.d

检查项目 : 确保SSH LogLevel设置为INFO

加固建议: 编辑 /etc/ssh/sshd_config 文件以按如下方式设置参数: LogLevel INFO

检查项目 : 确保禁用SSH X11转发

加固建议: 编辑 /etc/ssh/sshd_config 文件以设置参数,如下所示: X11Forwarding no

检查项目 : 确保SSH MaxAuthTries设置为4或更少

加固建议: 编辑 /etc/ssh/sshd_config 文件以设置参数,如下所示: MaxAuthTries 4

检查项目 : 确保禁用SSH根登录

加固建议: 编辑 /etc/ssh/sshd_config 文件以按如下方式设置参数: PermitRootLogin no

检查项目 : 确保配置了SSH警告标语

加固建议: 编辑 /etc/ssh/sshd_config 文件以设置参数,如下所示: Banner /etc/issue.net 5.3配置PAM PAM(可插入认证模块)是一种在UNIX系统上实现模块化认证模块的服务。 PAM被实现为一组共享对象,当程序需要对用户进行身份验证时,该对象被加载并执行。 PAM的文件通常位于 /etc/pam.d 目录中。必须仔细配置PAM以确保系统身份验证。虽然本节介绍了一些PAM,但请参阅其他PAM资源以充分了解配置功能。

检查项目 : 确保默认用户umask是027或更多的限制

加固建议: 编辑 /etc/bashrc 和 /etc/profile 文件(以及系统支持的任何其他shell的相应文件),并添加或编辑任何umask参数,如下所示: umask 027

检查项目 : 确保对su命令的访问受到限制

加固建议: 将以下行添加到 /etc/pam.d/su 文件中: auth required pam_wheel.so use_uid 在 /etc/group 文件的wheel语句中创建逗号分隔的用户列表: wheel:x:10:root,<user list>

检查项目 : 确保配置/ etc / shadow上的权限

加固建议: 运行以下命令以在 /etc/shadow 上设置权限: $ chown root:root /etc/shadow $ chmod 000 /etc/shadow

检查项目 : 确保配置/ etc / gshadow上的权限

加固建议: 运行以下chown在 /etc/gshadow 上设置权限: $ chown root:root /etc/gshadow $ chmod 000 /etc/gshadow

检查项目 : 确保密码重用是有限的

加固建议: 编辑 /etc/pam.d/password-auth 和 /etc/pam.d/system-auth 文件以包含 remember 选项并符合站点策略,如图所示: password sufficient pam_unix.so remember=5

检查项目 : 确保密码到期时间为90天或更短

加固建议: 在 /etc/login.defs 中将 PASS_MAX_DAYS 参数设置为 90 : PASS_MAX_DAYS 90 修改所有用户密码设置为匹配的用户参数: $ chage --maxdays 90 <user>

检查项目 : 确保密码更改之间的最短天数为7或更多

加固建议: 在 /etc/login.defs 中将 PASS_MIN_DAYS 参数设置为7: PASS_MIN_DAYS 7 修改密码设置为匹配的所有用户的用户参数: $ chage --mindays 7 <user>

检查项目 : 确保密码到期警告天数为7或更多

加固建议: 在 /etc/login.defs 中将 PASS_WARN_AGE 参数设置为7: PASS_WARN_AGE 7 修改密码设置为匹配的所有用户的用户参数: $ chage --warndays 7 <user>

检查项目 : 确保无效的密码锁定时间为30天或更短

加固建议: 运行以下命令将默认密码非活动期设置为30天: $ useradd -D -f 30 修改密码设置为匹配的所有用户的用户参数: $ chage --inactive 30 <user>

猜你喜欢

转载自blog.csdn.net/sfmcatl/article/details/82957971
今日推荐