經典文檔:Linux網絡服務器配置詳解 2
發表于:2007-05-26來源:作者:點擊數:
標簽:
該文件指定如何解析主機名。 Linux 通過解析器庫來獲得主機名對應的IP地址。下面是一個/etc/host.conf的示例: order bind,hosts multi on ospoof on order bind,hosts 指定主機名查詢順序,這里規定先使用DNS來解析域名,然后再查詢/etc/hosts文件(也可以相
該文件指定如何解析主機名。Linux通過解析器庫來獲得主機名對應的IP地址。下面是一個“/etc/host.conf”的示例:
order bind,hosts
multi on
ospoof on
“order bind,hosts”
|
指定主機名查詢順序,這里規定先使用DNS來解析域名,然后再查詢“/etc/hosts”文件(也可以相反)。
“multi on”指定是否“/etc/hosts”文件中指定的主機可以有多個地址,擁有多個IP地址的主機一般稱為多穴主機。
“nospoof on”指不允許對該服務器進行IP地址欺騙。IP欺騙是一種攻擊系統安全的手段,通過把IP地址偽裝成別的計算機,來取得其它計算機的信任。
*/etc/sysconfig/network 文件
該文件用來指定服務器上的網絡配置信息,下面是一個示例:
NETWORK=yes
RORWARD_IPV4=yes
HOSTNAME=deep.openarch.com
GAREWAY=0.0.0.0
GATEWAYDEV=
NETWORK=yes/no
網絡是否被配置;
FORWARD_IPV4=yes/no
是否開啟IP轉發功能
HOSTNAME=hostname hostname
表示服務器的主機名
GAREWAY=gw-ip
gw-ip表示網絡網關的IP地址
GAREWAYDEV=gw-dev
gw-dw表示網關的設備名,如:etho等
注意:為了和老的軟件相兼容,“/etc/HOSTNAME”文件應該用和HOSTNAME=hostname相同的主機名。
*/etc/hosts 文件
當機器啟動時,在可以查詢DNS以前,機器需要查詢一些主機名到IP地址的匹配。這些匹配信息存放在/etc/hosts文件中。在沒有域名服務器情況下,系統上的所有網絡程序都通過查詢該文件來解析對應于某個主機名的IP地址。
下面是一個“/etc/hosts”文件的示例:
最左邊一列是主機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文件,你必須先清除這個不允許改變的標志:
[root@deep]# chattr -i /etc/inetd.conf
|
但是對于諸如sendmail,named,www等服務,由于它們不象finger,telnet等服務,在請求到來時由inet守護進程啟動相應的進程提供服務,而是在系統啟動時,作為守護進程運行的。
而對于redhat linux,提供了一個linuxconfig命令,可以通過它在圖形界面下交互式地設置是否在啟動時運行相關服務。也可以通過命令來設置是否啟動時啟動某個服務,如:[root@deep]# chkconfig –level 35 named off。
原文轉自:http://www.kjueaiud.com
老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月
|