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
最後更新後不要忘記運行/usr/bin/newaliases,使改變生效。
11.The /etc/host.conf file
編輯host.conf文件(vi /etc/host.conf)且加下面的行﹕
# Lookup names via DNS first then fall back to /etc/hosts.
order bind,hosts
# We don have machines with multiple IP addresses on the same card
(like virtual server,IP Aliasing).
multi off
# Check for IP address spoofing.
nospoof on
IP Spoofing: IP-Spoofing is a security exploit that works by tricking
computers in a trust relationship that you are someone that you really aren .
16. 資源限製
對你的系統上所有的用戶設置資源限製可以防止DoS類型攻擊(denial of service attacks)如最大進程數,
內存數量等。例如,對所有用戶的限製象下面這樣﹕
編輯/etc/security/limits.con加﹕
* hard core 0
* hard rss 5000
* hard nproc 20
你也必須編輯/etc/pam.d/login文件加/檢查這一行的存在。
session required /lib/security/pam_limits.so
上面的命令禁止core files“core 0”,限製進程數為“nproc 50“,且限製內存使用
為5M“rss 5000”。
17. The /etc/lilo.conf file
a) Add: restricted
加這一行到每一個引導映像下面,就這表明如果你引導時用(linux single),則需要一個password.
b) Add: password=some_password
當與restricted聯合用,且正常引導時,需要用戶輸入密碼,你也要確保lilo.conf
文件不能被不屬於root的用戶可讀,也免看到密碼明文。下面是例子﹕
編輯/etc/lilo.conf加﹕
====
boot=/dev/sda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
Default=linux
restricted ?add this line.
password=some_password ?add this line.
image=/boot/vmlinuz-2.2.12-20
label=linux
initrd=/boot/initrd-2.2.12-10.img
root=/dev/sda6
read-only
[root@deep]# chmod 600 /etc/lilo.conf (不再能被其他用戶可讀).
[root@deep]# /sbin/lilo -v (更新lilo配置).
[root@deep]# chattr +i /etc/lilo.conf(阻止該文件被修改)
18. 禁止 Control-Alt-Delete 重啟動機器命令
[root@deep]# vi /etc/inittab
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
To
#ca::ctrlaltdel:/sbin/shutdown -t3 -r now
[root@deep]# /sbin/init q
20. The /etc/rc.d/rc.local file
默認地,當你login到linux server時,它告訴你linux版本名,內核版本名和服務器主機名。
它給了你太多的信息,如果你就希望得到提示login: ,編輯/etc/rc.d/rc.local放#在下面的行前面﹕
--
# This will overwrite /etc/issue at every boot. So, make any changes you
# want to make to /etc/issue here or you will lose them when you reboot.
#echo "" > /etc/issue
#echo "$R" >> /etc/issue
#echo "Kernel $(uname -r) on $a $(uname -m)" >> /etc/issue
#
#cp -f /etc/issue /etc/issue.net
#echo >> /etc/issue
--
然後,做下面的事情:
[root@deep]# rm -f /etc/issue
[root@deep]# rm -f /etc/issue.net
[root@deep]# touch /etc/issue
[root@deep]# touch /etc/issue.net