一务漩、限制網(wǎng)絡(luò)訪問(wèn)
1.host設(shè)置
修改/etc/hosts.deny和/etc/hosts.allow來(lái)增加訪問(wèn)限制。例箭养,將/etc/hosts.deny設(shè)為”ALL: ALL”可以默認(rèn)拒絕所有訪問(wèn)。然后在/etc/hosts.allow文件中添加允許的訪問(wèn)。
例如绩衷,”sshd: 192.168.1.10/255.255.255.0
gate.openarch.com”表示允許IP地址192.168.1.10和主機(jī)名
gate.openarch.com允許通過(guò)SSH連接。
3.登錄終端設(shè)置
/etc/securetty文件指定了允許root登錄的tty設(shè)備,由/bin/login程序讀取唇聘,其格式是一個(gè)被允許的名字列表版姑,您可以編輯/etc/securetty且注釋掉如下的行。
tty1
# tty2
# tty3
# tty4
# tty5
# tty6
這時(shí)迟郎,root僅可在tty1終端登錄剥险。
4.不顯示系統(tǒng)和版本信息。
改變/etc/inetd.conf文件:
telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd -h
加-h表示telnet不顯示系統(tǒng)信息宪肖,僅顯示”login:”表制。
5.修改相應(yīng)配置文件停止ipv6。
#vi /etc/modprobe.conf
alias net-pf-10 off
alias ipv6 off
#shutdown -r now
二控乾、防止攻擊
1.阻止ping么介,在/etc/rc.d/rc.local(系統(tǒng)自動(dòng)啟動(dòng)文件)文件中增加一行:
#echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
2.防止IP欺騙
編輯host.conf文件并增加如下幾行來(lái)防止IP欺騙攻擊。
order bind蜕衡,hosts
multi off
nospoof on
3.防止DoS攻擊
對(duì)系統(tǒng)所有的用戶設(shè)置資源限制可以防止DoS類型攻擊壤短。如最大進(jìn)程數(shù)和內(nèi)存使用數(shù)量等。例慨仿,可以在/etc/security/limits.conf中添加如下幾行:
* hard core 0
* hard rss 5000 #( 本行或許沒(méi)用,man limits.conf 顯示 maximum resident set size (KB) (Ignored in Linux 2.4.30 and higher)
* hard nproc 50
然后必須編輯/etc/pam.d/login文件檢查下面一行是否存在久脯。
session required /lib/security/pam_limits.so
上面的命令禁止調(diào)試文件,限制進(jìn)程數(shù)為50并且限制內(nèi)存使用為5MB镰吆。