- 论坛徽章:
- 0
|
LINUX加固
1.禁止Ctrl+Alt+Delete重新启动机器
修改/etc/inittab文件,将“ca::ctrlaltdel:/sbin/shutdown -t3 -r now”一行注
释掉。
2.禁止非正常用户登录
# usermod –s /sbin/nologin adm,lp,mail,news,uucp,games,dip
3. 登录超时限制
Vi /etc/profile
TMOUT = 600
4. 设置密码长度
编辑login.defs文件(vi /etc/login.defs),把下面这行
PASS_MIN_LEN 8
5. 删减登录信息
编辑/etc/rc.d/rc.local将输出系统信息的如下行注释掉。
# This will overwrite /etc/issue at every boot. So,make any changes you
# want to make to /etc/issue here or you will lose them when you reboot
# echo "">/etc/issue
# echo "">>/etc/issue
# echo "Kernel 100 100uname -r) on 100 100uname -m)">>/etc/issue
# cp -f /etc/issue /etc/issue.net
# echo>>/etc/issue
然后,进行如下操作:
# rm -f /etc/issue
# rm -f /etc/issue.net
# touch /etc/issue
# touch /etc/issue.net
6.停止不需要的服务
# chkconfig –list
# chkconfig –level 3 servicename off
编辑修改/etc/rc.d/rc3.d 下的文件
7.禁止root用户远程登录:
编辑 /etc/ssh/sshd_config
PermitRootLogin no
8.防止IP欺骗
编辑host.conf文件并增加如下几行来防止IP欺骗攻击。
order bind,hosts
multi off
nospoof on
9.取消普通用户的控制台访问权限
比如shutdown、reboot、halt等命令。
# rm -f /etc/security/console.apps/
10.使用TCP_WRAPPERS
编辑hosts.deny文件(vi /etc/hosts.deny),加入下面这行
# Deny access to everyone.
ALL: ALL@ALL, PARANOID
编辑hosts.allow文件(vi /etc/hosts.allow),加入允许访问的主机列表,比如:
ftp: 202.54.15.99 foo.com
202.54.15.99和 foo.com是允许访问ftp服务的ip地址和主机名称。
tcpdchk程序是tepd wrapper设置检查程序。设置完后,运行下面这个命令:
# tcpdchk
11.禁止从不同的控制台进行root登陆
编辑"/etc/securetty"文件,不需要登陆的TTY设备前添加“#”标志,来禁止从该TTY设备进行root登陆。
12.限制"/etc/rc.d/init.d" 下script文件设置权限
# chmod -R 700 /etc/rc.d/init.d/*
只有root才允许读、写、执行该目录下的script文件。
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/51067/showart_1945512.html |
|