




下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、LINUX 安全配置手册综述本文档以典型安装的 RedHat Linux 为对象撰写而成,其他版本均差不 多类似,按照具体情形进行适当修改即可文档中的操作需要以 root 用户登录至操纵台进行,不举荐使用网络远 程的方式进行补丁及配置修改等加固操作。 部分操作需要重新启动服务器才会生效,注意某些数据库等应用需要 先停止应用,然后才能够重新启动。加固之前第一应对系统中的重要文件及可能修改的文件进行备份,可 参照使用以下脚本:for file in /etc/inetd.conf /etc/hosts.equiv/etc/ftpusers /etc/passwd /etc/shadow /etc/
2、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/x
3、init/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.l
4、ogin /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
5、.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-preCIS done 补丁系统补丁 系统内核版本使用 uname -a 查看。 软件版本和补丁使用 rpm -qa 查看。其他应用补丁除 RedHat 官方提供的系统补丁之外, 系统也应对按照开放的服务和应 用进行补丁,如 APACHE、 PHP、OPENSSL、MYSQL 等应用进行补丁。 具体升级方法:第一确认机器
6、上安装了 gcc 及必要的库文件。 然后去应用的官方网站下载对应的源代码包,如 *.tar.gz 再解压tar zxfv *.tar.gz 再按照使用情形对编译配置进行修改,或直截了当采纳默认配置 cd *./configure 再进行编译和安装 makemake install最小化 xinetd 网络服务停止默认服务讲明:Xinetd 是旧的 inetd 服务的替代,他提供了一些网络有关服务的启动调 用方式。 Xinetd 应禁止以下默认服务的开放:操作: 停止一个服务 chkconfig 服务名 off打开一个服务chkconfig 服务名 on也能够使用 ntsysv 命令进行服务开关
7、调整其他讲明:关于 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 中其他
8、启动脚本权限是否为 755。关闭 xinetd 服务讲明:如果前面第二章关闭 xinetd 服务中所列的服务,都不需要开放,则能 够直截了当关闭 xinetd 服务。操作:chkconfig -level 12345 xinetd off关闭邮件服务讲明: 如果系统不需要作为邮件服务器,并不需要向别处发邮件,能够直截 了当关闭邮件服务。如果不需要作为邮件服务器,然而承诺用户发送邮件,能够设置 Send mail 不运行在 daemon模式。操作:chkconfig -level 12345 sendmail off 编辑 /etc/sysconfig/senmail文件 增加以下行DAEMON
9、=no QUEUE=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/i
10、nittab如需要 X Windows 的时候,可运行 startx 命令启动图形界面。 关闭 X 字体服务器讲明:如果关闭了 X Windows 服务,则 X font 服务器服务也应该进行关闭 操作:chkconfig xfs off 关闭其他默认启动服务 讲明:系统启动时会启动专门多不必要的服务,这些不必要的服务均存在一 定的安全隐患。一样可能存在以下不必要的服务:apmd canna FreeWnn gpm hpoj innd irda isdn kdcrotate lvs mars-nw e oki4daemon privoxy rstatd rusersd rwalld rwhod
11、 spamassassinw ine nfs nfslock autofs ypbind ypserv yppasswdd portmap smb netfs lpd apache htt pd tux snmpd named postgresql mysqld webmin kudzu squid cups 加固时,应按照机器具体配置使用和应用情形对开放的服务进行调整, 关闭不需要的服务。服务运行脚本一样都放在 /etc/rc.d/rc*.d 进行启动,能够使用 chkconfig 工具直截了当进行治理。关于必须通过 /etc/rc.d/rc*.d 开放的服务,应确保都已打上过最新的补 丁。
12、操作: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
13、漏洞较多,经常被利用来取得未授权的文件或系统权限。除非十 分必要,否则应关闭 NFS服务。可采纳以下方式开放 SMB 服务,并应该 限制 export文件系统的中的 IP 地址范畴,以及增加只读权限。操作:chkconfig -level 345 nfs on调整 NFS 客户端服务讲明:NFS 客户端服务一样用来访咨询其他 NFS 服务器。除非十分必要,否 则应关闭此服务。可采纳以下方式开放此服务。操作:chkconfig -level 345 nfslock onchkconfig -level 345 autofs on调整 NIS 服务器服务讲明:NIS 用来提供基于 UNIX 的域治
14、理和认证手段。 除非十分必要, 否则应 关闭此服务。可采纳以下方式开放此服务。操作:chkconfig ypserv onchkconfig yppasswdd on调整 NIS 客户端服务讲明:NIS 客户端用来访咨询其他 NIS 服务器。除非十分必要,否则应关闭 此服务。可采纳以下方式开放此服务。操作:chkconfig ypbind on调整 RPC 端口映射服务讲明:RPC 协议一样通过比较简单的或不经认证就能够得到一些专门敏锐的 信息。同时 RPC 系列服务都存在一些缓冲区溢出咨询题。在以下情形下能够考虑关闭 RPC 端口映射服务: 服务器不是 NFS 服务器或客户端; 服务器不是
15、NIS 服务器或客户端;服务器没有运行其它依靠于 RPC 服务的第三方软件; 服务器不运行图形界面( x-windows )。操作:chkconfig -level 345 portmap on 调整 netfs 服务 讲明: 此服务会作为客户端挂接网络中的磁盘。如果没有网络文件共享协议 如 NFS, NovellNetware 或 Windows 文件共享使用,则能够关闭此服务。操作:chkconfig -level 345 netfs on 调整打印机服务讲明:UNIX 打印服务存在较多的安全漏洞。 如果系统不作为网络中的打印机 服务器,则能够关闭此服务。如果必须使用此服务,第一应保证软件
16、都通 过最新的补丁,然和设置 cupsd进程运行在非 root 用户和组。操作:if -e /etc/init.d/cups ; then chkconfig cups onsed 's/#User lp/User lp/' /etc/cups/cupsd.conf >/etc/cups/cupsd.conf.new sed 's/#Group sys/Group sys/'/etc/cups/cupsd.conf.new >/etc/cups/cupsd.conf rm -f /etc/cups/cupsd.conf.new /bin/chown
17、lp:sys /etc/cups/cupsd.conf /bin/chmod 600 /etc/cups/cupsd.conf fichkconfig hpoj onchkconfig lpd on调整 Web 服务器服务讲明:如果服务器必须开放 Web,则需要作如下设置。应注意 web 名目权限 设置,不要承诺名目 list 。操作:chkconfig apahce on或chkconfig httpd on调整 SNMP 服务讲明:简单网络治理协议 SNMP 一样用来监控网络上主机或设备的运行情 形。如果必须打开,则必须更换默认通讯字。操作:chkconfig snmpd on编辑 /et
18、c/snmp/snmpd.confcom2sec notConfigUser default public修改 public 为其他一个足够复杂的密码。调整 DNS 服务器服务讲明:DNS 服务器服务用来为其他机器提供 DNS 解析,一样来讲都能够关掉。 如果必须进行开放,则必须升级至最新版本,并举荐设置 chroot 环境,还 需要注意限制 DNS 配置文件中的区域传输等设置(加密码或加 IP 地址限 制)。操作:chkconfig named on调整 SSHD 服务器服务 讲明:SSHD服务器服务用来提供 SSH Server的服务。如果必须进行开放, 则必须升级至最新版本,并举荐设置
19、chroot 环境,还需要注意限制 SSH配 置文件中的区域传输等设置, 需要在 SSHD 配置文件中禁用 ssh1方式连接, 因 ssh1 方式连接是非完全加密。操作:如使用 Openssh,则检查 /etc/ssh/sshd_configgrep Protocol /etc/ssh/sshd_configgrep Protocol /etc/ssh2/sshd2_config调整 SQL 服务器服务讲明: 如果不需要数据库服务,则能够关闭此服务。如果必须进行开放,则 注意修改数据库用户的密码,并增加数据库用户 IP 访咨询限制。操作:chkconfig postgresql onchkco
20、nfig mysqld on调整 Webmin 服务讲明:Webmin是一个通过 HTTP协议操纵 linux 的工具,一样举荐使用 SSH 进行系统治理而不要使用此工具。操作:chkconfig webmin on调整 Squid 服务讲明:Squid 服务是客户端与服务器之间的代理服务。 Squid 服务已显现过专 门多安全漏洞,同时如果设置不当的话,可能导致被利用来作为内外网之 间的跳板。如果不需要,则能够关闭此服务。如果必须打开,则需要设置 承诺访咨询的地址列表及认证。操作:chkconfig squid on调整 kudzu 硬件探测服务讲明:Kudzu 服务是 linux 的硬件探
21、测程序, 一样设置为启动系统的时候运行 他会检测系统中的硬件的改变,同时会提示进行配置等。未经授权的新设 备存在的一定的安全风险,系统启动时操纵台就能够配置任何新增加的设 备。如果不需要经常的改动硬件,则需要进行关闭。能够在增加新设备时 手工运行 /etc/rc.d/init.d/kudzu 启动此服务。操作:chkconfig -level 345 kudzu on 内核参数网络参数调整讲明:Linux 支持的对网络参数进行调整。 具体参数详细讲明,可参见 http:/lxr.linux.no/source/Documentation/networking/ip-sysctl.txt 。操作
22、:编辑 /etc/sysctl.conf增加net.ipv4.tcp_max_syn_backlog = 4096net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.all.accept_source_route = 0 net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route= net.ipv4.con
23、f.default.accept_redirects = 0 net.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
24、_forward = 0net.ipv4.conf.all.send_redirects = 0 net.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.
25、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 文件确认有
26、如下行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/ch
27、mod 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* p
28、gsql 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/ch
29、own -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
30、/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禁止用户挂接可移动
31、文件系统 讲明: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/
32、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 ! -per
33、m -1000 -print 找出未授权的全局可写名目讲明: 全局可写文件能够被任意用户修改。全局可写文件可能造成一些脚本 或程序被恶意修改后造成更大的危害,一样应拒绝其他组的用户的写权限操作:find / -perm -0002 -type f -xdev -printchmod o-w <filename>找出未授权的 SUID/SGID 文件讲明: 治理员应当检查没有其他非授权的 SUID/SGID 在系统内。操作:find / -perm -04000 -o -perm -02000 -type f -xdev -print 找出专门和隐藏的文件讲明: 入侵者容易将恶意文件
34、放在这名目中或命名如此的文件名。关于检查 出来的数据需要核对与否系统自身的文件。操作:find / -name ". " -exec ls -ldb ;find / -name ".*" -exec ls -ldb ;系统访咨询,授权和认证删除.rhosts文件讲明:R 系列服务( rlogin ,rsh,rcp)使用 .rhosts文件,它使用基于网络地址 或主机名的远端机算计弱认证 (专门容易被伪造)。如果必须使用 R 系列服 务,则必须保证 .rhosts文件中没有“ +”,同时同时指定对方系统和用户名。 如果有防火墙,则应该在过滤外部网段至内部的
35、全部 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/.rh
36、ostsln -s /dev/null /root/.rhosts/bin/rm /root/.shostsln -s /dev/null /root/.shosts/bin/rm /etc/hosts.equiv ln -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访咨询系统。 通常情形下, 应当不承诺
37、一些系统用户访 咨询 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
38、-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 = &
39、quot;/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 Xservers fiif -e /etc/X11/gdm/gdm.conf ; then cd /etc/X11/gdm awk -F= '($2 /X$/) printf("%s -nolisten tcpn"
40、;, $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.conf fiif -d /etc/X11/xinit ; thencd /etc/X11/xinitif -e xserverrc ; then awk '/X/ && !/#/ print $0 " :0 -nolisten tcp $" next ; print ' xser
41、verrc > xserverrc.new /bin/mv xserverrc.new xserverrc else cat <<END >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/
42、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
43、 -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 能够对恶意攻击者或尝试者起到警示作用 操作:创建操纵台和 X 模式 BANNER if "egrep -l Authorized /etc/motd" = "" ; then echo "Authorized uses only. A
44、ll activity may be monitored and reported." >>/etc/motd fiif "egrep -l Authorized /etc/issue" = "" ; then echo "Authorized uses only. All activity may be monitored and reported." >>/etc/issue fiif "egrep -l Authorized /etc/" = "" ; t
45、hen echo "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 ; then cd /etc/X11/xdm awk '/GreetString=/ print "GreetString=Authorized
46、uses only!" next ; print ' kdmrc >kdmrc.new/bin/mv kdmrc.new kdmrc /bin/chown root:root kdmrc /bin/chmod 644 kdmrc fiif -e /etc/X11/gdm/gdm.conf ; then cd /etc/X11/gdmawk '/Greeter=/ && /gdmgreeter/ printf("#%sn", $0); next ;/#Greeter=/ && /gdmlogin/ $1 = &q
47、uot;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.conffi习惯 TCP Wrappers创建“ authorized only ”的网络服务 BANNER mkdir /etc/banners ; cd /etc
48、/bannersif -e /usr/doc/tcp_wrappers-7.6/Banners.Makefile ; then file=/usr/doc/tcp_wrappers-7.6/Banners.Makefile elsefile=/usr/share/doc/tcp_wrappers-7.6/Banners.Makefileficp $file Makefileecho "Authorized uses only. All activity may bemonitored and reported." > prototypemakecd /etc/xine
49、td.dif -f $file ; thenawk '( $1 = "" ) print ' $file >$file.new/bin/mv $file.new $filefi donefor file in wu-ftpd gssftp ; doif -f $file ; thenawk '( $1 = "" ) print "banner = /etc/banners/in.ftpd" ; print ' $file >$file.new/bin/mv $file.new $filefi
50、donefor 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 = /e
51、tc/banners/in.rlogind" ; print ' $file >$file.new/bin/mv $file.new $filefi ; donekshell rlogin klogin ekloginrlogin klogin eklogin创建 vsftpd 的“ authorized only”BANNER cd /etcif -d vsftpd ; thencd vsftpdfi if -e vsftpd.conf ; thenecho "ftpd_banner=Authorized uses only. All activity ma
52、y be monitored and reported." >> vsftpd.conf fi配置 xinetd 访咨询操纵讲明:配制 xinetd 使用简单的访咨询操纵和日志。操作:在/etc/xinetd.conf 插入“ defaults”段 only_from=<net>/<num_bits> <net>/<num_bits><net>/<num_bits>使用承诺使用的网络和掩码。 示例:only_from=/24 将会限制只有 /24的网络能够访
53、咨 询。限制 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 /
54、etc/securetty设置 LILO/GRUB 密码讲明: 默认情形下,任何本地用户都能够在操纵台重新启动机器,并专门容 易就能够操纵正常的启动进程。 LILO 和 GRUB 密码能够在系统启动时要求 密码。注意以下操作只应当设置与十分注重本地安全的情形下。操作:LILO增加下列行到 /etc/lilo.conf restricted password=<password> <password>更换为自己指定的密码。以 root 身份执行以下命令/bin/chown root:root /etc/lilo.conf/bin/chmod 600 /etc/lilo.c
55、onfliloGRUB增加下列行到 /etc/grub.conf password <password> 以 root 身份执行以下命令 /bin/chown root:root /etc/grub.conf /bin/chmod 600 /etc/grub.conf设置单用户默认认证讲明:Linux 默认能够在启动时键入“ linux single”进入到单用户模式。 单用户模式能够不使用密码就能够进行一些治理员操作,一样用来复 原不记得 root 密码等。不加密码的单用户模式可能导致能够本地接触到服 务器的用户直截了当操纵系统。操作:cd /etcif "grep -
56、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 服务器进程拒绝没有使用特权 端口(小于 10
57、24)的 NFS 客户端访咨询。那个设置可不能阻碍 NFS 操作 员的操作,然而会拒绝非授权用户的自动的 NFS 攻击。操作:增加/etc/exports文件中的 secure选项,能够使用以下 perl 脚本perl -i.orig -pe'next if (/s*#/ | /s*$/);($res, hst) = split(" ");foreach $ent (hst) undef(%set);($optlist) = $ent = /(.*?)/;foreach $opt (split(/,/, $optlist) $set$opt = 1;delete($
58、set"insecure");$set"secure" = 1;$ent = s/(.*?)/;$ent .= "(" . join(",", keys(%set) . ")"$hst0 = "(secure)" unless (hst);$_ = "$rest" . join(" ", hst) . "n"'/etc/exports 用户帐户和环境 系统无用帐户 讲明: 系统中的非使用人员帐号应当被锁定,同时设置他们的 shell 为非 /etc/s hells 里面的(即没有默认能够登陆的 shell,如 /dev/null )。操作: 以下脚本锁定全部非 root 用户 for name in cut -d
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 第五级数学测试题及答案
- 陕师大教育学试题及答案
- 网络操作流程优化试题及答案
- 二级计算机考试考前模拟题及答案
- 体外短波的试题及答案
- 信息管理三级考试内容总结及答案
- 资阳化学考试题及答案
- 音乐调考试题及答案
- 系统分析师考试考试常识洞察试题及答案
- 基药试题及答案
- 把我的奶名儿叫混声合唱谱
- 风筝的力学原理
- 爱是我的眼睛合唱谱
- 中国缺血性卒中和短暂性脑缺血发作二级预防指南(2022年版)解读
- 初中化学实验教学进度表
- 桥梁病害诊断及维修加固
- 关税系统岗位练兵业务知识测试题库(关税业务知识)(单项选择题)附答案
- 2023年云南高中数学会考真题
- LY/T 1783.2-2017黑熊繁育利用技术规范第2部分:饲养管理
- 接触网施工计算课件
- 标本的运送流程课件
评论
0/150
提交评论