4.4 防止root远程登陆 编辑/etc/default/login,加上: CONSOLE=/dev/console # If CONSOLE is set, root can only login on that device.
4.5 记录所有root登陆尝试 # SYSLOG determines whether the syslog(3) LOG_AUTH facility should be used # to log all root logins at level LOG_NOTICE and multiple failed login # attempts at LOG_C SYSLOG=YES
4.6 设置session超时时间 编辑/etc/default/login,加上: # TIMEOUT sets the number of seconds (between 0 and 900) to wait before # abandoning a login session. TIMEOUT=120
6. 启动时提供的服务(rc.x) 6.1 禁止所有不需要的服务 在rc.x目录中将不需要的服务改名,比如 Example: mv /etc/rc3.d/S92volmgt /etc/rc3.d/KS92volmgt 以下服务应该禁止(根据需要自己决定): snmpdx autofs (Automounter) volmgt (Volume Deamon) lpsched (LP print service) nscd (Name Service Cache Daemon) Sendmail keyserv (Keyserv Deamon is only used if NIS+ or NFS are installed, if used start with –d option so that the defaults “nobody” key is not allowed) rpcbind提供远程呼叫,依靠远程系统的ip地址和远程用户的ID进行验证,这样很容易伪造和改变
7.3 设置in.routed运行在静态路由模式 创建文件/usr/sbin/in.routed为以下内容: #! /bin/sh /usr/sbin/in.routed.orig –q 改变文件属性: chmod 0755 /usr/sbin/in.routed # 动态路由可能会收到错误的路由信息,所以建议使用静态路由 Consider to use static routes (routes added via the route commands in startup files) rather than the routing daemons
8.2 删除所有不使用的sgid文件 列出系统中所有 suid 文件 find / -type f /( -perm -2000 /) –exec ls –al {} /; find / -type f /( -perm -2000 /) –exec ls –al {} /; > $HOME/search-4-sgid-files.txt 首先备份 sgid 文件: mkdir /opt/backup/sgid find / -type f /( -perm -2000 /) -print |cpio -pudm /opt/backup/sgid 删除前建立tar备份,不要删除sgid-files.tar!! cd /opt/backup; tar –cvpf sgid-files.tar /opt/backup/sgid/* rm –r /opt/backup/sgid 去除所有sgid 文件中的sgid 位 find / -type f /( -perm -2000 /) –exec chmod –s {} /; 再查一遍 find / -type f /( -perm –2000 /) –exec ls –al {} /; 对一些常用文件建立sgid 位
8.3 删除/etc下所有组可写文件 find /etc -type f /( -perm -20 /) –exec ls –al {} /; find /etc -type f /( -perm -20 /) –exec ls –al {} /; > search-4-group-writeable-in-etc.txt /etc下不应有组可写文件,去掉写权限 find /etc -type f /( -perm –20 /) –exec chmod g-w {} /;
8.4 删除/etc下所有world可写文件 find /etc -type f /( -perm -2 /) –exec xargs ls –als {} /; find /etc -type f /( -perm -2 /) –exec xargs ls –als {} /; > search-4-world-writeable-in-etc.txt /etc下不应有world可写文件,去掉写权限 find /etc -type f /( -perm –2 /) –exec xargs chmod w-w {} /;
8.5 将权限为rw-rw-rw-的文件改为rw-r—r— find / -type f -perm 666 |xargs ls -al > perm-666-before-change.txt decide if one of these files are critical find / -type f -perm 666 –exec chmod 644 {} /; find / -type f -perm 666 –exec xargs ls –al {} /; > perm-666-after-change.txt
8.6 改变rwxrwxrwx文件的权限 find / -type f -perm 777 –exec xargs ls -al {} /; > perm-777-before-change.txt decide if one of these files are critical find / -type f -perm 777 –exec xargs chmod 755 {} /; find / -type f -perm 777 –exec xargs ls -al {} /; > perm-777-after-change.txt
本文参考资料(主要为翻译整理) Hardening_Solaris_CSNC_V1.0.pdf Author: Ivan Buetler, Compass Security AG UNIX Computer Security Checklist (Version 1.1) by Australian CERT Solaris Security Step by Step by sans.org