五、文件系统安全
1、检查Set-id程序
# find / \( -perm -4000 -o -perm -2000 \) -type f -exec ls -ld {} \;
# chmod u-s /usr/sbin/swinstall
# chmod u-s /usr/sbin/vgcreate
# chmod u-s /sbin/vgcreate
可以采用下列方法,将所有文件的set-id位去掉,然后对一些需要的程序单独加上suid位(可根据情况选择):
# find / -perm -4000 -type f -exec chmod u-s {} \;
# find / -perm -2000 -type f -exec chmod g-s {} \;
# chmod u+s /usr/bin/su
# chmod u+s /usr/bin/passwd
采用这种方法后,普通用户将无法使用很多系统命令,如bdf, uptime ,arp等:
$ bdf /dev/vg00/lvol3
bdf: /dev/vg00/lvol3: Permission denied
2. 修改重要文件权限
# chmod 1777 /tmp /var/tmp /var/preserve (加上粘滞位)
# chmod 666 /dev/null
六、网络参数调整
利用ndd命令,可以检测或者更改网络设备驱动程序的特性。在/etc/rc.config.d/nddconf启动脚本中增加以下各条命令,然后重启系统,可以提高网络的安全性。
格式如下:
/usr/sbin/ndd -set /dev/ip ip_forward_directed_broadcasts 0
Network device
Parameter
Default value
Suggested value
Comment
/dev/ip
ip_forward_directed_broadcasts
1
0
不转发定向广播包
/dev/ip
ip_forward_src_routed
1
0
不转发原路由包
/dev/ip
ip_forwarding
2
0
禁止包转发
/dev/ip
ip_pmtu_strategy
2
1
不采用echo-request PMTU策略
/dev/ip
ip_send_redirects
1
0
不发ICMP重定向包
/dev/ip
ip_send_source_quench
1
0
不发ICMP源结束包
/dev/tcp
tcp_conn_request_max
20
500
增加TCP监听数最大值,提高性能
/dev/tcp
tcp_syn_rcvd_max
500
500
HP SYN flood保护
/dev/ip
ip_respond_to_echo_broadcast
1
0
不响应ICMP echo请求广播包
由于ndd调用前,已经启动网卡参数,所以可能不能正确设置。
可以采用下列方法,建立一个启动脚本。
# cp /tmp/secconf /etc/rc.config.d
# chmod 444 /etc/rc.config.d/secconf
# cp /tmp/sectune /sbin/init.d
# chmod 555 /sbin/init.d/sectune
# ln -s /sbin/init.d/sectune /sbin/rc2.d/S009sectune