LINUX安全配置手册.doc
文本预览下载声明
Linux安全配置手册
综述
本文档以典型安装的RedHat Linux为对象撰写而成,其他版本均基本类似,根据具体情况进行适当修改即可。
文档中的操作需要以root用户登录至控制台进行,不推荐使用网络远程的方式进行补丁及配置修改等加固操作。
部分操作需要重新启动服务器才会生效,注意某些数据库等应用需要先停止应用,然后才可以重新启动。
加固之前首先应对系统中的重要文件及可能修改的文件进行备份,可参照使用以下脚本:
for file in /etc/inetd.conf /etc/hosts.equiv /etc/ftpusers /etc/passwd /etc/shadow /etc/hosts.allow /etc/hosts.deny /etc/proftpd.conf /etc/rc.d/init.d/functions /etc/inittab /etc/sysconfig/sendmail /etc/security/limits.conf /etc/exports /etc/sysctl.conf /etc/syslog.conf /etc/fstab /etc/security.console.perms /root/.rhosts /root/.shosts /etc/shosts.equiv /etc/X11/xdm/Xservers /etc/X11/xinit/xserverrc /etc/X11/gdm/gdm.conf /etc/cron.allow /etc/cron.deny /etc/at.allow /etc/at.deny /etc/crontab /etc/motd /etc/issue /usr/share/config/kdm/kdmrc /etc/X11/gdm/gdm.conf /etc/securetty /etc/security/access.conf /etc/lilo.conf /etc/grub.conf /etc/login.defs /etc/group /etc/profile /etc/csh.login /etc/csh.cshrc /etc/bashrc /etc/ssh/sshd_config /etc/ssh/ssh_config /etc/cups/cupsd.conf /etc/{,vsftpd/}vsftpd.conf /etc/logrotate.conf /root/.bashrc /root/.bash_profile /root/.cshrc /root/.tcshrc /etc/vsftpd.ftpusers ; do
[ -f $file ] /bin/cp $file $file-preCIS
done
for dir in /etc/xinetd.d /etc/rc[0123456].d /var/spool/cron /etc/cron.* /etc/logrotate.d /var/log /etc/pam.d /etc/skel ; do
[ -d $dir ] /bin/cp -r $dir $dir-preCIS
done
补丁
系统补丁
系统内核版本使用uname -a查看。
软件版本和补丁使用rpm -qa查看。
使用up2date命令自动升级或去下载对应版本补丁手工单独安装。
其他应用补丁
除RedHat官方提供的系统补丁之外,系统也应对根据开放的服务和应用进行补丁,如APACHE、PHP、OPENSSL、MYSQL等应用进行补丁。
具体升级方法:
首先确认机器上安装了gcc及必要的库文件。
然后去应用的官方网站下载对应的源代码包,如 *.tar.gz
再解压
tar zxfv *.tar.gz
再根据使用情况对编译配置进行修改,或直接采用默认配置
cd *
./configure
再进行编译和安装
make
make install
最小化xinetd网络服务
停止默认服务
说明:
Xinetd是旧的inetd服务的替代,他提供了一些网络相关服务的启动调用方式。Xinetd应禁止以下默认服务的开放:
chargen chargen-udp cups-lpd daytime daytime-udp echo echo-udp eklogin finger gssftp imap imaps ipop2 ipop3 krb5-telnet klogin kshell ktalk ntalk pop3s rexec rlogin rsh rsync servers services
操作:
停止一个服务
chkconfig 服务名 o
显示全部