




已阅读5页,还剩25页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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-preCISdonefor dir in /etc/xinetd.d /etc/rc0123456.d /var/spool/cron /etc/cron.* /etc/logrotate.d /var/log /etc/pam.d /etc/skel ; do -d $dir & /bin/cp -r $dir $dir-preCISdone补丁系统补丁系统内核版本使用uname -a查看。软件版本和补丁使用rpm -qa查看。使用up2date命令自动升级或去下载对应版本补丁手工单独安装。其他应用补丁除RedHat官方提供的系统补丁之外,系统也应对根据开放的服务和应用进行补丁,如APACHE、PHP、OPENSSL、MYSQL等应用进行补丁。具体升级方法:首先确认机器上安装了gcc及必要的库文件。然后去应用的官方网站下载对应的源代码包,如 *.tar.gz再解压tar zxfv *.tar.gz再根据使用情况对编译配置进行修改,或直接采用默认配置cd *./configure再进行编译和安装makemake 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 服务名 off打开一个服务chkconfig 服务名 on也可以使用ntsysv命令进行服务开关调整其他说明:对于xinet必须开放的服务,应该注意服务软件的升级和安全配置,并推荐使用SSH和SSL对原明文的服务进行替换。如果条件允许,可以使用系统自带的iptables或tcp-wrapper功能对访问IP地址进行限制。操作:Xinetd、SSH和SSL、防火墙配置参见对应系统的用户手册,此不详述。最小化启动服务设置daemon权限unmask说明:默认系统umask至少为022,以防止daemon被其他低权限用户修改。操作:vi修改/etc/rc.d/init.d文件,umask 值为022。同时检查/etc/rc.d/init.d中其他启动脚本权限是否为755。关闭xinetd服务说明:如果前面第二章关闭xinetd服务中所列的服务,都不需要开放,则可以直接关闭xinetd服务。操作:chkconfig -level 12345 xinetd off关闭邮件服务说明:1) 如果系统不需要作为邮件服务器,并不需要向外面发邮件,可以直接关闭邮件服务。2) 如果不需要作为邮件服务器,但是允许用户发送邮件,可以设置Sendmail不运行在daemon模式。操作:1) chkconfig -level 12345 sendmail off2) 编辑/etc/sysconfig/senmail文件增添以下行DAEMON=noQUEUE=1h设置cd /etc/sysconfig/bin/chown root:root sendmail/bin/chmod 644 sendmail关闭图形登录服务说明:一般来说,大部分软件的安装和运行都不需要图形环境。如果不需要图形环境进行登录和操作,可以关闭X Windows的运行。操作:cp /etc/inittab /etc/inittab.bak编辑/etc/inittab文件修改id:5:initdefault:行为id:3:initdefault:chown root:root /etc/inittabchmod 0600 /etc/inittab如需要X Windows的时候,可运行startx命令启动图形界面。关闭X字体服务器说明:如果关闭了X Windows服务,则X font服务器服务也应该进行关闭。操作:chkconfig xfs off关闭其他默认启动服务说明:系统启动时会启动很多不必要的服务,这些不必要的服务均存在一定的安全隐患。一般可能存在以下不必要的服务:apmd canna FreeWnn gpm hpoj innd irda isdn kdcrotate lvs mars-nwe oki4daemon privoxy rstatd rusersd rwalld rwhod spamassassin wine nfs nfslock autofs ypbind ypserv yppasswdd portmap smb netfs lpd apache httpd tux snmpd named postgresql mysqld webmin kudzu squid cups加固时,应根据机器具体配置使用和应用情况对开放的服务进行调整,关闭不需要的服务。服务运行脚本一般都放在/etc/rc.d/rc*.d进行启动,可以使用chkconfig工具直接进行管理。对于必须通过/etc/rc.d/rc*.d开放的服务,应确保都已打上过最新的补丁。操作:chkconfig -level 12345 服务名 off如果关闭了特定的服务,也应该同时对这些服务在系统中的用户加以锁定或删除可能包括以下用户rpc rpcuser lp apache http httpd named dns mysql postgres squidusermod -L 要锁定的用户调整SMB服务说明:Samba服务器一般用来提供与Windows类似的文件和打印共享服务。除非十分必要,否则应关闭SMB(Windows文件共享)服务。可采用以下方式开放SMB服务。操作:chkconfig smb on调整NFS服务器服务说明:NFS漏洞较多,经常被利用来取得未授权的文件或系统权限。除非十分必要,否则应关闭NFS服务。可采用以下方式开放SMB服务,并应该限制export文件系统的中的IP地址范围,以及增添只读权限。操作:chkconfig -level 345 nfs on调整NFS客户端服务说明:NFS客户端服务一般用来访问其他NFS服务器。除非十分必要,否则应关闭此服务。可采用以下方式开放此服务。操作:chkconfig -level 345 nfslock onchkconfig -level 345 autofs on调整NIS服务器服务说明:NIS用来提供基于UNIX的域管理和认证手段。除非十分必要,否则应关闭此服务。可采用以下方式开放此服务。操作:chkconfig ypserv onchkconfig yppasswdd on调整NIS客户端服务说明:NIS客户端用来访问其他NIS服务器。除非十分必要,否则应关闭此服务。可采用以下方式开放此服务。操作:chkconfig ypbind on调整RPC端口映射服务说明:RPC协议一般经过比较简单的或不经认证就可以得到一些非常敏感的信息。并且RPC系列服务都存在一些缓冲区溢出问题。在以下情况下可以考虑关闭RPC端口映射服务:服务器不是NFS服务器或客户端;服务器不是NIS服务器或客户端;服务器没有运行其它依赖于RPC服务的第三方软件;服务器不运行图形界面(x-windows)。操作:chkconfig -level 345 portmap on调整netfs服务说明:此服务会作为客户端挂接网络中的磁盘。如果没有网络文件共享协议如NFS,NovellNetware或Windows文件共享使用,则可以关闭此服务。操作:chkconfig -level 345 netfs on调整打印机服务说明:UNIX打印服务存在较多的安全漏洞。如果系统不作为网络中的打印机服务器,则可以关闭此服务。如果必须使用此服务,首先应保证软件都经过最新的补丁,然和设置cupsd进程运行在非root用户和组。操作:if -e /etc/init.d/cups ; thenchkconfig cups onsed s/#User lp/User lp/ /etc/cups/cupsd.conf /etc/cups/cupsd.conf.newsed s/#Group sys/Group sys/ /etc/cups/cupsd.conf.new /etc/cups/cupsd.confrm -f /etc/cups/cupsd.conf.new/bin/chown lp:sys /etc/cups/cupsd.conf/bin/chmod 600 /etc/cups/cupsd.conffichkconfig hpoj onchkconfig lpd on调整Web服务器服务说明:如果服务器必须开放Web,则需要作如下设置。应注意web目录权限设置,不要允许目录list。操作:chkconfig apahce on或chkconfig httpd on调整SNMP服务说明:简单网络管理协议SNMP一般用来监控网络上主机或设备的运行情况。如果必须打开,则必须更改默认通讯字。操作:chkconfig snmpd on编辑/etc/snmp/snmpd.confcom2sec notConfigUser default public修改public为其他一个足够复杂的密码。调整DNS服务器服务说明:DNS服务器服务用来为其他机器提供DNS解析,一般来说都可以关掉。如果必须进行开放,则必须升级至最新版本,并推荐设置chroot环境,还需要注意限制DNS配置文件中的区域传输等设置(加密码或加IP地址限制)。操作:chkconfig named on调整SSHD服务器服务说明:SSHD服务器服务用来提供SSH Server的服务。如果必须进行开放,则必须升级至最新版本,并推荐设置chroot环境,还需要注意限制SSH配置文件中的区域传输等设置,需要在SSHD配置文件中禁用ssh1方式连接,因ssh1方式连接是非完全加密。操作: 如使用Openssh,则检查/etc/ssh/sshd_config grep Protocol /etc/ssh/sshd_config 如使用SSH.com的SSHD,需要检查/etc/ssh2/sshd2_configgrep Protocol /etc/ssh2/sshd2_config调整SQL服务器服务说明:如果不需要数据库服务,则可以关闭此服务。如果必须进行开放,则注意修改数据库用户的密码,并增加数据库用户IP访问限制。操作:chkconfig postgresql onchkconfig mysqld on调整Webmin服务说明:Webmin是一个通过HTTP协议控制linux的工具,一般推荐使用SSH进行系统管理而不要使用此工具。操作:chkconfig webmin on调整Squid服务说明:Squid服务是客户端与服务器之间的代理服务。Squid服务已出现过很多安全漏洞,并且如果设置不当的话,可能导致被利用来作为内外网之间的跳板。如果不需要,则可以关闭此服务。如果必须打开,则需要设置允许访问的地址列表及认证。操作:chkconfig squid on调整kudzu硬件探测服务说明:Kudzu服务是linux的硬件探测程序,一般设置为启动系统的时候运行。他会检测系统中的硬件的改变,并且会提示进行配置等。未经授权的新设备存在的一定的安全风险,系统启动时控制台就可以配置任何新增添的设备。如果不需要经常的改动硬件,则需要进行关闭。可以在增添新设备时手工运行/etc/rc.d/init.d/kudzu启动此服务。操作:chkconfig -level 345 kudzu on内核参数网络参数调整说明:Linux支持的对网络参数进行调整。具体参数详细说明,可参见http:/lxr.linux.no/source/Documentation/networking/ip-sysctl.txt。操作:编辑/etc/sysctl.conf增加net.ipv4.tcp_max_syn_backlog = 4096net.ipv4.conf.all.rp_filter = 1net.ipv4.conf.all.accept_source_route = 0net.ipv4.conf.all.accept_redirects = 0net.ipv4.conf.all.secure_redirects = 0net.ipv4.conf.default.rp_filter = 1net.ipv4.conf.default.accept_source_route =net.ipv4.conf.default.accept_redirects = 0net.ipv4.conf.default.secure_redirects = 0/bin/chown root:root /etc/sysctl.conf/bin/chmod 0600 /etc/sysctl.conf更多的网络参数调整说明:如果系统不作为在不同网络之间的防火墙或网关时,可进行如下设置。具体参数详细说明,可参见http:/lxr.linux.no/source/Documentation/networking/ip-sysctl.txt操作:编辑/etc/sysctl.conf增加net.ipv4.ip_forward = 0net.ipv4.conf.all.send_redirects = 0net.ipv4.conf.default.send_redirects = 0/bin/chown root:root /etc/sysctl.conf/bin/chmod 0600 /etc/sysctl.conf日志系统认证日志配置说明:不是所有版本的linux都会在日之中记录登陆信息。一般需要对这些重要的安全相关的信息进行保存,(如成功或失败su,失败的登陆,root登陆等)。这些将会被记录在/var/log/secure文件里。操作:编辑/etc/syslog.conf确认有如下行authpriv.* /var/log/securetouch /var/log/secure/bin/chown root:root /var/log/secure/bin/chmod 600 /var/log/secureFTP进程日志配置说明:系统默认会记录wu-ftpd和vsftpd所有的连接和文件传输。以下将会确认所有法发送到服务期的命令将会被记录。wu-ftpd将会把安全相关的或是策略边界的行为记忆文件传输记录到syslog里,默认位于/var/log/xferlog。操作:编辑/etc/xinetd.d/wu-ftpd文件确认有如下行server_args = -l -a -d/bin/chown root:root wu-ftpd/bin/chmod 644 wu-ftpd编辑/etc/vsftpd.conf或/etc/vsftpd/vsftpd.conf文件确认有如下行xferlog_std_format=NOlog_ftp_protocol=YESlog_ftp_protocol=YES/bin/chmod 0600 vsftpd.conf/bin/chown root:root vsftpd.conf确认系统日志权限说明:保护系统日志文件不会被非授权的用户所修改。操作:cd /var/log/bin/chmod o-w boot.log* cron* dmesg ksyms* httpd/* maillog* messages* news/* pgsql rpmpkgs* samba/* scrollkeeper.log secure* spooler* squid/* vbox/* wtmp/bin/chmod o-rx boot.log* cron* maillog* messages* pgsql secure* spooler* squid/*/bin/chmod g-w boot.log* cron* dmesg httpd/* ksyms* maillog* messages* pgsql rpmpkgs* samba/* scrollkeeper.log secure* spooler*/bin/chmod g-rx boot.log* cron* maillog* messages* pgsql secure* spooler*/bin/chmod o-w gdm/ httpd/ news/ samba/ squid/ vbox/bin/chmod o-rx httpd/ samba/ squid/bin/chmod g-w gdm/ httpd/ news/ samba/ squid/ vbox/bin/chmod g-rx httpd/ samba/bin/chown -R root:root ./bin/chgrp utmp wtmp/bin/chown -R news:news news/bin/chown postgres:postgres pgsql/bin/chown -R squid:squid squid文件/目录权限/etc/fstab中适当分区增加“nodev”选项说明:在我们已知不包含设备的分区增添nodev参数,防止用户挂接分区中未授权设备。此项加固要比较慎重。操作:编辑/etc/fstab文件在非/的ext2和ext3分区后增添nodev参数/bin/chown root:root /etc/fstab/bin/chmod 0644 /etc/fstab/etc/fstab中移动设备增加“nosuid”“nodev”选项说明:可移动的媒体可能导致恶意的程序进入系统。可以将这些文件系统设置nosuid选项,此选项可以防止用户使用CD-ROM或软盘将设置了SUID的程序带到系统里。参照上节,这些文件系统也应当设置nodev选项。操作:编辑/etc/fstab文件在floppy和cdrom分区后增添nosuid,nodev参数/bin/chown root:root /etc/fstab/bin/chmod 0644 /etc/fstab禁止用户挂接可移动文件系统说明:PAM模块中的pam console参数给控制台的用户临时的额外特权。其配置位于/etc/security/console.perms文件。默认设置允许控制台用户控制可以与其他主机共享的软盘和CD-ROM设备。这些可移动媒体存在着一定的安全风险。以下禁止这些设备的额外特权。操作:编辑/etc/security/console.perms文件修改其中的console行,删除以下设备之外的行/sound|fb|kbd|joystick|v4l|mainboard|gpm|scanner/bin/chown root:root console.perms/bin/chmod 0600 console.perms检查passwd,shadow和group文件权限说明:检查以下文件的默认权限。操作:cd /etc/bin/chown root:root passwd shadow group/bin/chmod 644 passwd group/bin/chmod 400 shadow全局可写目录应设置粘滞位说明:当一个目录设置了粘滞位之后,只有文件的属主可以删除此目录中的文件。设置粘滞位可以防止用户覆盖其他用户的文件。如/tmp目录。操作:find / -xdev -type d -perm -0002 -a ! -perm -1000 -print找出未授权的全局可写目录说明:全局可写文件可以被任意用户修改。全局可写文件可能造成一些脚本或程序被恶意修改后造成更大的危害,一般应拒绝其他组的用户的写权限。操作:find / -perm -0002 -type f -xdev -printchmod o-w 找出未授权的SUID/SGID文件说明:管理员应当检查没有其他非授权的SUID/SGID在系统内。操作:find / -perm -04000 -o -perm -02000 -type f -xdev -print找出异常和隐藏的文件说明:入侵者容易将恶意文件放在这目录中或命名这样的文件名。对于检查出来的数据需要核对与否系统自身的文件。操作:find / -name . -exec ls -ldb ;find / -name .* -exec ls -ldb ;系统访问,授权和认证删除.rhosts文件说明:R系列服务(rlogin,rsh,rcp)使用.rhosts文件,它使用基于网络地址或主机名的远端机算计弱认证(很容易被伪造)。如果必须使用R系列服务,则必须保证.rhosts文件中没有“+”,并且同时指定对方系统和用户名。如果有防火墙,则应该在过滤外部网段至内部的全部R系列服务访问。同时需要保证.rhosts文件仅可以被所有者读取(600)。操作:for file in /etc/pam.d/* ; dogrep -v rhosts_auth $file $file.new/bin/mv $file.new $file/bin/chown root:root $file/bin/chmod 644 $filedone创建危险文件的链接说明:防止创建危险的/root/.rhosts,/root/.shosts,/etc/hosts.equiv和/etc/shosts.equiv文件。操作:/bin/rm /root/.rhostsln -s /dev/null /root/.rhosts/bin/rm /root/.shostsln -s /dev/null /root/.shosts/bin/rm /etc/hosts.equivln -s /dev/null /etc/hosts.equiv/bin/rm /etc/shosts.equivln -s /dev/null /etc/shosts.equiv创建ftpuser文件说明: /etc/ftpusers和/etc/vsftp.ftpusers文件里的用户列表里的用户将拒绝通过WU-FTPD和vsftpd访问系统。通常情况下,应当不允许一些系统用户访问FTP,并且任何时候都不应当使用root用户访问FTP。 /etc/vsftpd.user类似上述功能。操作:for name in cut -d: -f1 /etc/passwddoif id -u $name -lt 500 thenecho $name /etc/ftpusersfidone/bin/chown root:root /etc/ftpusers/bin/chmod 600 /etc/ftpusersif -e /etc/vsftpd.conf | -e /etc/vsftpd/vsftpd.conf ; then/bin/rm -f /etc/vsftpd.ftpusers/bin/cp /etc/ftpusers /etc/vsftpd.ftpusersfi关闭X-Windows的开放端口说明:X服务器在6000/tcp监听远端客户端的连接。X-Windows使用相对不安全的认证方式,取得X认证的用户很容易就可以控制整台服务器。删除选项中的“-nolisten tcp”可以使X服务器不再监听6000/tcp端口。操作:if -e /etc/X11/xdm/Xservers ; thencd /etc/X11/xdmawk ($1 ! /#/ & $3 = /usr/X11R6/bin/X) $3 = $3 -nolisten tcp ; print Xservers Xservers.new/bin/mv Xservers.new Xservers/bin/chown root:root Xservers/bin/chmod 444 Xserversfiif -e /etc/X11/gdm/gdm.conf ; thencd /etc/X11/gdmawk -F= ($2 /X$/) printf(%s -nolisten tcpn, $0); next ; print gdm.conf gdm.conf.new/bin/mv gdm.conf.new gdm.conf/bin/chown root:root gdm.conf/bin/chmod 644 gdm.conffiif -d /etc/X11/xinit ; thencd /etc/X11/xinitif -e xserverrc ; thenawk /X/ & !/#/ print $0 :0 -nolisten tcp $; next ; print xserverrc xserverrc.new/bin/mv xserverrc.new xserverrcelsecat xserverrc#!/bin/bashexec X :0 -nolisten tcp $ENDfi/bin/chown root:root xserverrc/bin/chmod 755 xserverrcfi限制只有授权用户可以访问at/cron说明:cron.allow和at.allow可以指定允许运行crontab和at命令的用户列表。一般直应该允许管理员有权利运行计划任务。操作:cd /etc/bin/rm -f cron.deny at.denyecho root cron.allowecho root at.allow/bin/chown root:root cron.allow at.allow/bin/chmod 400 cron.allow at.allow限制crontab文件的权限说明:系统的crontab文件应该只能被cron daemon(以超级用户权限运行)和crontab命令(SUID)。操作:/bin/chown root:root /etc/crontab/bin/chmod 400 /etc/crontab/bin/chown -R root:root /var/spool/cron/bin/chmod -R go-rwx /var/spool/cron/bin/chown -R root:root /etc/cron.*/bin/chmod -R go-rwx /etc/cron.*创建警示BANNER说明:创建警示BANNER可以对恶意攻击者或尝试者起到警示作用。操作:1) 创建控制台和X模式BANNERif egrep -l Authorized /etc/motd = ; thenecho Authorized uses only. All activity may be monitored and reported. /etc/motdfiif egrep -l Authorized /etc/issue = ; thenecho Authorized uses only. All activity may be monitored and reported. /etc/issuefiif egrep -l Authorized /etc/ = ; thenecho Authorized uses only. All activity may be monitored and reported. /etc/fi/bin/chown root:root /etc/motd /etc/issue /etc//bin/chmod 644 /etc/motd /etc/issue /etc/if -e /etc/X11/xdm/kdmrc ; thencd /etc/X11/xdmawk /GreetString=/ print GreetString=Authorized uses only!; next ; print kdmrc kdmrc.new/bin/mv kdmrc.new kdmrc/bin/chown root:root kdmrc/bin/chmod 644 kdmrcfiif -e /etc/X11/gdm/gdm.conf ; thencd /etc/X11/gdmawk /Greeter=/ & /gdmgreeter/ printf(#%sn, $0); next ;/#Greeter=/ & /gdmlogin/ $1 = Greeter=/usr/bin/gdmlogin ;/Welcome=/ print Welcome=Authorized uses only!; next ; print gdm.conf gdm.conf.new/bin/mv gdm.conf.new gdm.conf/bin/chown root:root gdm.conf/bin/chmod 644 gdm.conffi2) 适应TCP Wrappers创建“authorized only”的网络服务BANNER。mkdir /etc/banners ; cd /etc/bannersif -e /usr/doc/tcp_wrappers-7.6/Banners.Makefile ; thenfile=/usr/doc/tcp_wrappers-7.6/Banners.Makefileelsefile=/usr/share/doc/tcp_wrappers-7.6/Banners.Makefileficp $file Makefileecho Authorized uses only. All activity may be monitored and reported. prototypemakecd /etc/xinetd.dfor file in telnet krb5-telnet ; doif -f $file ; thenawk ( $1 = ) print banner = /etc/banners/in.telnetd ; print $file $file.new/bin/mv $file.new $filefidonefor file in wu-ftpd gssftp ; doif -f $file ; thenawk ( $1 = ) print banner = /etc/banners/in.ftpd ; print $file $file.new/bin/mv $file.new $filefidonefor file in rsh kshell ; doif -f $file ; thenawk ( $1 = ) print banner = /etc/banners/in.rshd ; print $file $file.new/bin/mv $file.new $filefidonefor file in rlogin klogin eklogin ; doif -f $file ; thenawk ( $1 = ) print banner = /etc/banners/in.rlogind ; print $file $file.new/bin/mv $file.new $filefi ; done/bin/chown root:root krb5-,telnet gssftp wu-ftpd rsh kshell rlogin klogin eklogin/bin/chmod 644 krb5-,telnet gssftp wu-ftpd rsh kshell rlogin klogin eklogin3) 创建vsftpd的“authorized only”BANNERcd /etcif -d vsftpd ; thencd vsftpdfiif -e vsftpd.conf ; thenecho ftpd_banner=Authorized uses only. All activity may be monitored and reported. vsftpd.conffi配置xinetd访问控制说明:配制xinetd使用简单的访问控制和日志。操作:在/etc/xinetd.conf插入“defaults”段only_from=/ /使用允许使用的网络和掩码。示例:only_from=/24将会限制只有/24的网络可以访问。限制root只能在控制台登录说明:root应该限制在只允许控制台登陆,一般情况下应该使用一般权限用户进行操作,仅在必要时su成为root进行操作。操作:/bin/cp /dev/null /etc/securettyfor i in 1 2 3 4 5 6; doecho tty$i /etc/securettyecho vc/$i /etc/securettydoneecho console /etc/securetty/bin/chown root:root /etc/securetty/bin/chmod 400 /etc/securetty设置LILO/GRUB密码说明:默认情况下,任何本地用户都可以在控制台重新启动机器,并很容易就可以控制正常的启动进程。LILO和GRUB密码可以在系统启动时要求密码。注意以下操作只应设置与十分注重本地安全的情况下。操作:LILO1) 增加下列行到/etc/lilo.confrestrictedpassword=更改为自己指定的密码。2) 以root身份执行以下命令/bin/chown root:root /etc/lilo.conf/bin/chmod 600 /etc/lilo.confliloGRUB1) 增加下列行到/etc/grub.confpassword 2) 以root身份执行以下命令/bin/chown root:root /etc/grub.conf/bin/chmod 600 /etc/grub.conf设置单用户默认认证说明:Linux默认可以在启动时键入“linux single”进入到单用户模式。单用户模式可以不使用密码就可以进行一些管理员操作,一般用来恢复忘记root密码等。不加密码的单用户模式可能导致可以本地接触到服务器的用户直接控制系统。操作:cd /etcif grep -l sulogin inittab = ; thenawk print ;/id:0123456sS:initdefault:/ print :S:wait:/sbin/sulogin inittab inittab.new/bin/mv inittab.new inittab/bin/chown root:root inittab/bin/chmod 644 inittabfi限制NFS客户端特权端口说明:设置secure参数可以使本地系统的NFS服务器进程拒绝没有使用特权端口(小于1024)的NFS客户端访问。这个设置不会影响NFS操作员的操作,但是会拒绝非授权用户的自动的NFS攻击。操作:增加/etc/exports文件中的secure选项,可以使用以下perl脚本perl -i.orig -pe next if (/s*#/ | /s*$/);($res, hst) = split( );foreach
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年中华传统木雕工艺师认证考试模拟题库
- 2025年中国农业科技发展高峰论坛专家讲座要点预测题
- 拉晶清装工安全知识培训课件
- 拉力试验培训课件
- 护士肝病科普知识培训课件
- 抢车安全知识培训内容课件
- 2025年环氧丙烷项目发展计划
- 2025年计算机数字信号处理板卡项目发展计划
- 2024-2025学年湖南省常德市石门县九年级(上)期末数学试卷(含答案)
- 2025年煤制合成氨项目建议书
- 医院信息安全与保密承诺书2篇
- 物料分类账详解
- 康复护理学-康复评定认知功能评定
- 泰来2井三级井喷事故分解析
- 船舶常用英语名称
- 超市标准商品分类表
- 《导游业务》教案资料.docx
- 最全的食物相克表(打印版)
- 河南省科技版三年级劳动与技术上册教案
- 施工现场安全标志和安全防护设施设置方案
- QC课题衬衣小扣外观解析PPT课件
评论
0/150
提交评论