#!/bin/ksh ########################################################## ## ## ## It was used for AIX OS Security configuration check ## ## ## ########################################################## ##检查主机是否关闭了不必要的服务## echo ‘###检查主机是否关闭了不必要的服务###‘ cat /etc/inetd.conf |sed ‘/^#/d‘|sed ‘/^$/d‘|egrep "uucp|bootps|finger|tftp|ntalk|discard|daytime|chargen|sendmail" echo "result="`cat /etc/inetd.conf |sed ‘/^#/d‘|sed ‘/^$/d‘|egrep "uucp|bootps|finger|tftp|ntalk|discard|daytime|chargen|sendmail"|wc -l` ##检查用户口令策略是否符合安全要求## echo ‘###检查用户口令策略是否符合安全要求###‘ lssec -f /etc/security/user -s default -a minlen -a minalpha -a mindiff -a minother -a pwdwarntime -a histexpire -a histsize -a loginretries ##检查FTP是否禁止匿名登录## echo ‘###检查FTP是否禁止匿名登录###‘ ##检查SNMP是否修改默认通讯字符串## echo ‘###检查SNMP是否修改默认通讯字符串###‘ cat /etc/rc.tcpip|grep snmp cat /etc/snmpd.conf|egrep "public|private"|grep -v "#" ##检查操作系统帐号是否存在弱口令。## echo ‘###检查操作系统帐号是否存在弱口令。###‘ cat /etc/security/passwd ##检查系统是否启用信任主机方式,配置文件是否配置妥当;## echo ‘###检查系统是否启用信任主机方式,配置文件是否配置妥当;###‘ cat /.rhosts|grep "++" cat /etc/hosts.equiv|grep "++" ##设备安全事件审计## echo ‘###设备安全事件审计###‘ cat /etc/syslog.conf |sed ‘/^#/d‘|sed ‘/^$/d‘|awk ‘($2!~/\*/ && $2!~/-/) {printf $1"\t"$2"\n"}‘ ##检测特定系统自带的与设备运行、维护等工作无关的账号是否被删除或锁定## echo ‘###检测特定系统自带的与设备运行、维护等工作无关的账号是否被删除或锁定###‘ lsuser -a login rlogin "ALL" |egrep "deamon|bin|sys|adm|uucp|nuucp|printq|guest|nobody|lpd" ##密码文件的访问权限## echo ‘###密码文件的访问权限###‘ uname ls -ld /etc/passwd /etc/group /etc/security | awk ‘{print $1":"$9}‘ ##检查root是否可以直接登录## echo ‘###检查root是否可以直接登录###‘ SSHSTATUS=`netstat -an|grep -i listen|grep -w "\*.22"|wc -l` TELSTATUS=`netstat -an|grep -i listen|grep -w "\*.23"|wc -l` if [ $SSHSTATUS != 0 ]; then echo "result_ssh="`cat /etc/ssh/sshd_config |sed ‘/^#/d‘|sed ‘/^$/d‘|grep "PermitRootLogin no"|wc -l`; else echo "result_ssh=1"; fi if [ $TELSTATUS != 0 ]; then echo "result_telnet="`lssec -f /etc/security/user -s root -a rlogin|grep "false"|wc -l`; else echo "telnet not running ,result_telnet=1"; fi unset SSHSTATUS TELSTATUS ##检查SSH安全配置## echo ‘###检查SSH安全配置###‘ grep "Protocol" /etc/ssh/sshd_config|grep -v ‘^#‘ ##检查是否设置帐户定时自动登出## echo ‘###检查是否设置帐户定时自动登出###‘ grep "^TMOUT" /etc/profile /etc/environment /etc/security/.profile ##检查补丁更新情况## echo ‘###检查补丁更新情况###‘ oslevel -r instfix -i|grep `oslevel -r`|grep ML
时间: 2024-10-08 09:29:50