云计算百科
云计算领域专业知识百科平台

CentOS基线脚本,三级等保服务器系统安全配置脚本_centos 日志 等保三

echo \”……[Y] Password Validity Period: $PASS\\_MAX\\_DAYS days\”
else
sed -i \’/PASS\\_MAX\\_DAYS/s/\’\”${PASS\\_MAX\\_DAYS}\”\’/90/g\’ /etc/login.defs

PASS_MAX_DAYS=cat /etc/login.defs | grep PASS\\_MAX\\_DAYS | grep -v ^# | awk \'{print $2}\’ if [ $PASS_MAX_DAYS -le 90 -a $PASS_MAX_DAYS -ge 30 ];then echo “…[Y] Password Validity Period: $PASS_MAX_DAYS days” else echo “…[N] Password Validity Period: Reset failed” fi fi }

#检查日志保留时间 function CheckLogBackupTime() {

Log_Backup_Time=cat /etc/logrotate.conf |head -n 10|grep \”rotate \”| grep -v ^# | head -n 1|awk \'{print $2}\’ if [ -z $Log_Backup_Time ];then

sed -i ‘s/#rotate/rotate/’ /etc/logrotate.conf Log_Backup_Time=cat /etc/logrotate.conf |head -n 10|grep \”rotate \”| grep -v ^# | head -n 1|awk \'{print $2}\’ fi if [ -z $Log_Backup_Time ];then echo “…[N] Log backup Time,Configuration does not exist” elif [ $Log_Backup_Time -ge 26 ];then echo “…[Y] Log backup Time: L o g _ B a c k u p _ T i m e w e e k s \” e l s e s e d − i ′ / r o t a t e / s / ′ \” Log\\_Backup\\_Time weeks\” else sed -i \’/rotate/s/\’\” Log_Backup_Timeweeks\”elsesedi/rotate/s/\”{Log_Backup_Time}”‘/26/g’ /etc/logrotate.conf Log_Backup_Time=cat /etc/logrotate.conf |head -n 10|grep \”rotate \”| grep -v ^# | head -n 1|awk \'{print $2}\’ if [ $Log_Backup_Time -ge 26 ];then echo “…[Y] Log backup Time: $Log_Backup_Time weeks” else echo “…[N] Log backup Time,Reset failed” fi fi }

#检查会话超时时间 function CheckConnectionTimeout() {
Connection_Timeout=cat /etc/profile | grep \’export TMOUT\’ | grep -v ^# | cut -d= -f2 if [ -z C o n n e c t i o n _ T i m e o u t ] ; t h e n s e d − i ′ Connection\\_Timeout ];then sed -i \’ Connection_Timeout];thensedi<

赞(0)
未经允许不得转载:网硕互联帮助中心 » CentOS基线脚本,三级等保服务器系统安全配置脚本_centos 日志 等保三
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!