下面是个“/etc/hosts”文档的示例:
IP Address Hostname Alias
127.0.0.1 Localhost Gate.openarch.com
208.164.186.1 gate.openarch.com Gate
………… ………… ………
最左边一列是主机IP信息,中间一列是主机名。任何后面的列都是该主机的别名。一旦配置完机器的网络配置文档,应该重新启动网络以使修改生效。使用下面的命令来重新启动网络:/etc/rc.d/init.d/network restart
* /etc/inetd.conf 文档
众所周知,作为服务器来说,服务端口开放越多,系统安全稳定性越难以确保。所以提供特定服务的服务器应该尽可能开放提供服务必不可少的端口,而将和服务器服务无关的服务关闭,比如:一台作为www和ftp服务器的机器,应该只开放80 和25端口,而将其他无关的服务如:finger auth等服务关掉,以减少系统漏洞。
而inetd,也叫作“终极服务器”,就是监控一些网络请求的守护进程,其根据网络请求来调用相应的服务进程来处理连接请求。inetd.conf则是inetd的配置文档。inetd.conf文档告诉inetd监听哪些网络端口,为每个端口启动哪个服务。在任何的网络环境中使用Linux系统,第一件要做的事就是了解一下服务器到底要提供哪些服务。无需的那些服务应该被禁止掉,最好卸载掉,这样黑客就少了一些攻击系统的机会。查看“/etc/inetd.conf”文档,了解一下inetd提供哪些服务。用加上注释的方法(在一行的开头加上#号),禁止任何无需的服务,再给inetd进程发一个SIGHUP信号。
第一步:把文档的许可权限改成600。
[root@deep]# chmod 600 /etc/inetd.conf
第二步:确信文档的任何者是root。
[root@deep]# stat /etc/inetd.conf
第三步:编辑“inetd.conf”文档(vi /etc/inetd.conf),禁止任何无需的服务,如:ftp、 telnet、 shell、 login、 exec、talk、ntalk、 imap、 pop-2、pop-3、finger、auth,等等。假如您觉得某些服务有用,能够不禁止这些服务。但是,把这些服务禁止掉,系统受攻击的可能性就会小很多。改变后的“inetd.conf”文档的内容如下面所示:
# To re-read this file after changes, just do a 'killall -HUP inetd'
#
#echo stream tcp nowait root internal
#echo dgram udp wait root internal
#discard stream tcp nowait root internal
#discard dgram udp wait root internal
#daytime stream tcp nowait root internal
#daytime dgram udp wait root internal
#chargen stream tcp nowait root internal
#chargen dgram udp wait root internal
#time stream tcp nowait root internal
#time dgram udp wait root internal
#
# These are standard services.
#
#ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
#telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd
#
# Shell, login, exec, comsat and talk are BSD protocols.
#
#shell stream tcp nowait root /usr/sbin/tcpd in.rshd
#login stream tcp nowait root /usr/sbin/tcpd in.rlogind
#exec stream tcp nowait root /usr/sbin/tcpd in.rexecd
#comsat dgram udp wait root /usr/sbin/tcpd in.comsat
#talk dgram udp wait root /usr/sbin/tcpd in.talkd
#ntalk dgram udp wait root /usr/sbin/tcpd in.ntalkd
#dtalk stream tcp wait nobody /usr/sbin/tcpd in.dtalkd
#
# Pop and imap mail services et al
#
#pop-2 stream tcp nowait root /usr/sbin/tcpd ipop2d
#pop-3 stream tcp nowait root /usr/sbin/tcpd ipop3d
#imap stream tcp nowait root /usr/sbin/tcpd imapd
#
# The Internet UUCP service.
#
#uucp stream tcp nowait uucp /usr/sbin/tcpd /usr/lib/uucp/uucico -l
#
# Tftp service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers." Do not uncomment
# this unless you *need* it.
#
#tftp dgram udp wait root /usr/sbin/tcpd in.tftpd
#bootps dgram udp wait root /usr/sbin/tcpd bootpd
#
# Finger, systat and netstat give out user information which may be
# valuable to potential "system crackers." Many sites choose to disable
# some or all of these services to improve security.
#
#finger stream tcp nowait root /usr/sbin/tcpd in.fingerd
#cfinger stream tcp nowait root /usr/sbin/tcpd in.cfingerd
#systat stream tcp nowait guest /usr/sbin/tcpd /bin/ps -auwwx
#netstat stream tcp nowait guest /usr/sbin/tcpd /bin/netstat -f inet
#
# Authentication
#
#auth stream tcp nowait nobody /usr/sbin/in.identd in.identd -l -e -o
#
# End of inetd.conf
注意:改变了“inetd.conf”文档之后,别忘了给inetd进程发一个SIGHUP信号(killall –HUP inetd)。
[root@deep /root]# killall -HUP inetd
第四步:
为了确保“inetd.conf”文档的安全,能够用chattr命令把他设成不可改变。把文档设成不可改变的只要用下面的命令:
[root@deep]# chattr i /etc/inetd.conf
这样能够避免“inetd.conf”文档的任何改变(意外或是别的原因)。一个有“i”属性的文档是不能被改变的:不能删除或重命名,不能创建这个文档的链接,不能往这个文档里写数据。只有系统管理员才能配置和清除这个属性。假如要改变inetd.conf文档,您必须先清除这个不允许改变的标志:
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




