- 论坛徽章:
- 0
|
编号
项目
注释
1
清除系统帐号
#!/bin/shfor user in uucp operatordouserdel $userdonefor user in bin daemon adm lp shutdown halt mail dnscache dnslog ftp games gdm gopher halt htdig ident mail mailnull named news nobody nscd postfix postgres netdump qmaild qmaill qmailp qmailq qmailr qmails rpc rpcuser squid sympa sync xfs sshd mysql pcap smmsp pegasusdo usermod -L -s /dev/null $userdone
2
检查shadow中空口令帐号
awk -F: '($2 == "") { print $1 }' /etc/shadow
3
检查系统内具有root权限的帐号
awk -F: '($3 == 0) { print $1 }' /etc/passwd
4
用户目录/home 许可权限是否为755或更严格的限制
#!/bin/shfor dir in `ls` do chmod -R 755 /home/$dir done
5
为用户设置合适的缺省umask值:
#!/bin/shcd /etcfor file in profile csh.login csh.cshrc bashrcdoif [ `grep -c umask $file` -eq 0 ];thenecho "umask 022" >> $filefichown root:root $filechmod 444 $file
done
编号
项目
注释
1
禁止普通用户mount文件系统
cd /etc/security
egrep -v '(floppy|cdrom)' console.perms \
> console.perms.new
mv console.perms.new console.perms
grep -v supermount /etc/fstab > /etc/fstab.new
mv /etc/fstab.new /etc/fstab
chown root:root console.perms /etc/fstab
chmod 0600 console.perms
chmod 0644 /etc/fstab
2
对passwd, shadow, 和group文件设置正确的许可权限
3
查找未认证的SUID/SGID可程序:
for part in \
`awk '($3 == "ext2" || $3 == “ext3”) \
{ print $2 }' /etc/fstab`
do
find $part \( -perm -04000 -o -perm -02000 \) \
-type f -xdev -print
done
4
passwd shadow group gshadow 加不可更改属性
chattr +i /etc/passwd
chattr +i /etc/shadow
chattr +i /etc/group
chattr +i /etc/pgshadow
5
资源限制
对你的系统上所有的用户设置资源限制可以防止DoS类型攻击(denial of service attacks)
如最大进程数,内存数量等。例如,对所有用户的限制象下面这样:
编辑/etc/security/limits.conf加
* hard core 0
* hard rss 5000
* hard nproc 20
你也必须编辑/etc/pam.d/login文件加/检查这一行的存在
session required /lib/security/pam_limits.so
上面的命令禁止core files“core 0”,限制进程数为“nproc 50“,且限制内存使用
为5M“rss 5000”。
6
禁止 Control-Alt-Delete 重启动机器命令
vi /etc/inittab
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
改成
#ca::ctrlaltdel:/sbin/shutdown -t3 -r now
init q 重新挂起
7
重新设置/etc/rc.d/init.d/目录下所有文件的许可权限
chmod -R 700 /etc/rc.d/init.d/*
仅仅root可以读,写,执行上述所有script file.
8
去掉issue版本说明
echo “echo “”> /etc/issue”>> /etc/rc.d/rc.local
暴露过的系统信息
9
防止单用户登陆
vi /etc/inittab
插入~~:S:wait:/sbin/sulogin
接触到了硬件其实没安全可言
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/31547/showart_347264.html |
|