網(wǎng)絡(luò)安全是一個(gè)非常重要的課題,基本上你運(yùn)行的服務(wù)后臺(tái)越多,你就可能打開更多的安全漏洞.如果配置的恰當(dāng)?shù)脑?Linux本身是非常安全可靠的,假使在Linux系統(tǒng)中有某個(gè)安全缺陷,由于Linux的源碼是開放的,有成千上萬(wàn)的志愿者會(huì)立刻發(fā)現(xiàn)并修補(bǔ)它。本文旨在介紹用來(lái)增強(qiáng)你的網(wǎng)絡(luò)安全性的常用技巧,以Redhat Linux作為操作環(huán)境。
1.操作系統(tǒng)內(nèi)部的log file是檢測(cè)是否有網(wǎng)絡(luò)入侵的重要線索,當(dāng)然這個(gè)假定你的logfile不被侵入者所破壞,如果你有臺(tái)服務(wù)器用專線直接連到Internet上,這意味著你的IP地址是永久固定的地址,你會(huì)發(fā)現(xiàn)有很多人對(duì)你的系統(tǒng)做telnet/ftp登錄嘗試,試著運(yùn)行#more /var/log/secure | grep refused 去檢查。
2. 限制具有SUID權(quán)限標(biāo)志的程序數(shù)量,具有該權(quán)限標(biāo)志的程序以root身份運(yùn)行,是一個(gè)潛在的安全漏洞,當(dāng)然,有些程序是必須要具有該標(biāo)志的,象passwd程序。
3.BIOS安全。設(shè)置BIOS密碼且修改引導(dǎo)次序禁止從軟盤啟動(dòng)系統(tǒng)。
4. 用戶口令。用戶口令是Linux安全的一個(gè)最基本的起點(diǎn),很多人使用的用戶口令就是簡(jiǎn)單的‘password,這等于給侵入者敞開了大門,雖然從理論上說(shuō)沒(méi)有不能確解的用戶口令,只要有足夠的時(shí)間和資源可以利用。比較好的用戶口令是那些只有他自己能夠容易記得并理解的一串字符,并且絕對(duì)不要在任何地方寫出來(lái)。
5./etc/exports 文件。如果你使用NFS網(wǎng)絡(luò)文件系統(tǒng)服務(wù),那么確保你的/etc/exports具有最嚴(yán)格的存取權(quán)限設(shè)置,這意味著不要使用任何通配符,不允許root寫權(quán)限,mount成只讀文件系統(tǒng)。編輯文件/etc/exports并且加:例如:
/dir/to/export host1.mydomain.com(ro,root_squash) /dir/to/export host2.mydomain.com(ro,root_squash) |
/dir/to/export 是你想輸出的目錄,host.mydomain.com是登錄這個(gè)目錄的機(jī)器名,ro意味著mount成只讀系統(tǒng),root_squash禁止root寫入該目錄。
為了讓上面的改變生效,運(yùn)行/usr/sbin/exportfs -a
6.確信/etc/inetd.conf的所有者是root,且文件權(quán)限設(shè)置為600 。
[root@deep]# chmod 600 /etc/inetd.conf ENSURE that the owner is root. [root@deep]# stat /etc/inetd.conf File: "/etc/inetd.conf" Size: 2869 Filetype: Regular File Mode: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 0/ root) Device: 8,6 Inode: 18219 Links: 1 Access: Wed Sep 22 16:24:16 1999(00000.00:10:44) Modify: Mon Sep 20 10:22:44 1999(00002.06:12:16) Change:Mon Sep 20 10:22:44 1999(00002.06:12:16) |
編輯/etc/inetd.conf禁止以下服務(wù):
ftp, telnet, shell, login, exec, talk, ntalk, imap, pop-2, pop-3, finger, auth, etc. 除非你真的想用它。特別是禁止那些r命令.如果你用ssh/scp,那么你也可以禁止掉telnet/ftp。
為了使改變生效,運(yùn)行#killall -HUP inetd 你也可以運(yùn)行#chattr +i /etc/inetd.conf使該文件具有不可更改屬性。只有root 才能解開,用命令 #chattr -i /etc/inetd.conf
7. TCP_WRAPPERS
默認(rèn)地,Redhat Linux允許所有的請(qǐng)求,用TCP_WRAPPERS增強(qiáng)你的站點(diǎn)的安全性是舉手之勞,你可以放入
“ALL: ALL”到/etc/hosts.deny中禁止所有的請(qǐng)求,然后放那些明確允許的請(qǐng)求到/etc/hosts.allow中,如:
sshd: 192.168.1.10/255.255.255.0 gate.openarch.com |
對(duì)IP地址192.168.1.10和主機(jī)名gate.openarch.com,允許通過(guò)ssh連接。配置完了之后,用tcpdchk檢查
[root@deep]# tcpdchk |
8. 別名文件aliases
編輯別名文件/etc/aliases(也可能是/etc/mail/aliases),移走/注釋掉下面的行。
# Basic system aliases -- these MUST be present. MAILER-DAEMON: postmaster postmaster: root # General redirections for pseudo accounts. bin: root daemon: root #games: root ?remove or comment out. #ingres: root ?remove or comment out. nobody: root #system: root ?remove or comment out. #toor: root ?remove or comment out. #uucp: root ?remove or comment out. # Well-known aliases. #manager: root ?remove or comment out. #dumper: root ?remove or comment out. #operator: root ?remove or comment out. # trap decode to catch security attacks #decode: root # Person who should get roots mail #root: marc |
| 共3頁(yè): 1 [2] [3] 下一頁(yè) | ||
|


