?? linux網(wǎng)絡(luò)服務(wù)器配置詳解.txt
字號(hào):
當(dāng)機(jī)器啟動(dòng)時(shí),在可以查詢DNS以前,機(jī)器需要查詢一些主機(jī)名到IP地址的匹配。這些匹配信息存放在/etc/hosts文件中。在沒有域名服務(wù)器情況下,系統(tǒng)上的所有網(wǎng)絡(luò)程序都通過查詢?cè)撐募斫馕鰧?duì)應(yīng)于某個(gè)主機(jī)名的IP地址。
下面是一個(gè)“/etc/hosts”文件的示例:
最左邊一列是主機(jī)IP信息,中間一列是主機(jī)名。任何后面的列都是該主機(jī)的別名。一旦配置完機(jī)器的網(wǎng)絡(luò)配置文件,應(yīng)該重新啟動(dòng)網(wǎng)絡(luò)以使修改生效。使用下面的命令來重新啟動(dòng)網(wǎng)絡(luò):
/etc/rc.d/init.d/network restart
* /etc/inetd.conf 文件
眾所周知,作為服務(wù)器來說,服務(wù)端口開放越多,系統(tǒng)安全穩(wěn)定性越難以保證。所以提供特定服務(wù)的服務(wù)器應(yīng)該盡可能開放提供服務(wù)必不可少的端口,而將與服務(wù)器服務(wù)無關(guān)的服務(wù)關(guān)閉,比如:一臺(tái)作為www和ftp服務(wù)器的機(jī)器,應(yīng)該只開放80和25端口,而將其他無關(guān)的服務(wù)如:finger
auth等服務(wù)關(guān)掉,以減少系統(tǒng)漏洞。
而inetd,也叫作“超級(jí)服務(wù)器”,就是監(jiān)視一些網(wǎng)絡(luò)請(qǐng)求的守護(hù)進(jìn)程,其根據(jù)網(wǎng)絡(luò)請(qǐng)求來調(diào)用相應(yīng)的服務(wù)進(jìn)程來處理連接請(qǐng)求。inetd.conf則是inetd的配置文件。inetd.conf文件告訴inetd監(jiān)聽哪些網(wǎng)絡(luò)端口,為每個(gè)端口啟動(dòng)哪個(gè)服務(wù)。
在任何的網(wǎng)絡(luò)環(huán)境中使用Linux系統(tǒng),第一件要做的事就是了解一下服務(wù)器到底要提供哪些服務(wù)。不需要的那些服務(wù)應(yīng)該被禁止掉,最好卸載掉,這樣黑客就少了一些攻擊系統(tǒng)的機(jī)會(huì)。
查看“/etc/inetd.conf”文件,了解一下inetd提供哪些服務(wù)。用加上注釋的方法(在一行的開頭加上#號(hào)),禁止任何不需要的服務(wù),再給inetd進(jìn)程發(fā)一個(gè)SIGHUP信號(hào)。
第一步:把文件的許可權(quán)限改成600。
[root@deep]# chmod 600 /etc/inetd.conf
第二步:確信文件的所有者是root。
[root@deep]# stat /etc/inetd.conf
第三步:編輯“inetd.conf”文件(vi /etc/inetd.conf),禁止所有不需要的服務(wù),如:ftp、 telnet、
shell、 login、 exec、talk、ntalk、 imap、 pop-2、pop-3、finger、auth,等等。
如果你覺得某些服務(wù)有用,可以不禁止這些服務(wù)。但是,把這些服務(wù)禁止掉,系統(tǒng)受攻擊的可能性就會(huì)小很多。改變后的“inetd.conf”文件的內(nèi)容如下面所示:
# 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進(jìn)程發(fā)一個(gè)SIGHUP信號(hào)(killall –HUP inetd)。
[root@deep /root]# killall -HUP inetd
第四步:
為了保證“inetd.conf”文件的安全,可以用chattr命令把它設(shè)成不可改變。把文件設(shè)成不可改變的只要用下面的命令:
[root@deep]# chattr +i /etc/inetd.conf
這樣可以避免“inetd.conf”文件的任何改變(意外或是別的原因)。一個(gè)有“i”屬性的文件是不能被改動(dòng)的:不能刪除或重命名,不能創(chuàng)建這個(gè)文件的鏈接,不能往這個(gè)文件里寫數(shù)據(jù)。只有系統(tǒng)管理員才能設(shè)置和清除這個(gè)屬性。如果要改變inetd.conf文件,你必須先清除這個(gè)不允許改變的標(biāo)志:
[root@deep]# chattr -i /etc/inetd.conf
但是對(duì)于諸如sendmail,named,www等服務(wù),由于它們不象finger,telnet等服務(wù),在請(qǐng)求到來時(shí)由inet守護(hù)進(jìn)程啟動(dòng)相應(yīng)的進(jìn)程提供服務(wù),而是在系統(tǒng)啟動(dòng)時(shí),作為守護(hù)進(jìn)程運(yùn)行的。
而對(duì)于redhat
linux,提供了一個(gè)linuxconfig命令,可以通過它在圖形界面下交互式地設(shè)置是否在啟動(dòng)時(shí)運(yùn)行相關(guān)服務(wù)。也可以通過命令來設(shè)置是否啟動(dòng)時(shí)啟動(dòng)某個(gè)服務(wù),如:[root@deep]#
chkconfig –level 35 named off。
源碼之家收集整理
閱讀:317 次
錄入:小偉
【 評(píng)論 】 【 推薦 】 【 打印 】
上一篇:讓linux系統(tǒng)支持ASP
下一篇:Webmin安裝及配置
相關(guān)新聞
讓linux系統(tǒng)支持ASP (04月09日) Linux網(wǎng)關(guān)設(shè)置 (04月09日) Linux下FTP服務(wù)器配置
(04月09日) Linux web服務(wù)器分區(qū)方案 (04月09日) linux9.0+apache+php+mysql安裝與配置
(04月09日)
本文評(píng)論
發(fā)表評(píng)論
點(diǎn)評(píng): 字?jǐn)?shù)
姓名:
尊重網(wǎng)上道德,遵守中華人民共和國的各項(xiàng)有關(guān)法律法規(guī)
承擔(dān)一切因您的行為而直接或間接導(dǎo)致的民事或刑事法律責(zé)任
本站管理人員有權(quán)保留或刪除其管轄留言中的任意內(nèi)容
本站有權(quán)在網(wǎng)站內(nèi)轉(zhuǎn)載或引用您的評(píng)論
參與本評(píng)論即表明您已經(jīng)閱讀并接受上述條款
新聞查詢
標(biāo)題 內(nèi)容 作者
網(wǎng)站簡介 - 廣告服務(wù) - 網(wǎng)站地圖 - 幫助信息 - 聯(lián)系方式
Copyright © 2002 - 2006 源碼之家 (MyCodes.Net)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -