Tải bản đầy đủ (.docx) (4 trang)

Cách thức bảo mật mailserver

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (127.59 KB, 4 trang )

Bảo Mật MailServer
1, Chức năngserver.
2, Đĩa cứu hộ.
3, Bản vá và nâng cấp hệ thống.
Cài đặt tự động cập nhật
APT:
+unattended-upgrades
#sudo apt-get install unattended-upgrades
#sudo dpkg-reconfigure -plow unattended-upgrades
#nano /etc/apt/apt.conf.d/50unattended-upgrades
Thêm vào blacklisted để không tự động update những gói liên quan
Unattended-Upgrade::Package-Blacklist {
"linux-headers-server"
"linux-image-server"
"linux-server"
"linux-firmware"
"linux-libc-dev"
};
Log của update lưu tại /var/log/unattended-upgrades
Báo cáo cấu hình tại Unattended-Upgrade::Mail
+cron and aptitude
#nano /etc/cron.weekly/apt-security-updates
Lưu đoạn văn bản sau:
echo "**************" >> /var/log/apt-security-updates
date >> /var/log/apt-security-updates
aptitude update >> /var/log/apt-security-updates
aptitude safe-upgrade -o Aptitude::Delete-Unused=false assume-yes target-release `lsb_release
-cs`-
security >> /var/log/apt-security-updates
echo "Security updates (if any) installed"
#sudo chmod +x /etc/cron.weekly/apt-security-update


log: #nano /etc/logrotate.d/apt-security-update
/var/log/apt-security-updates {
rotate 2
weekly
size 250k
compress
notifempty
}
YUM:
+yum-updatesd
#yum install yum-updatesd
#nano /etc/yum/yum-updatesd.conf
Thay đổi dòng:
do_update = no
thành
do_update=yes
save.
#/etc/init.d/yum-updatesd restart
+cron and yum:
/etc/cron.daily/yumupdate.sh or /etc/cron.weekly/yumupdate.sh
#!/bin/bash
YUM=/usr/bin/yum
$YUM -y -R 120 -d 0 -e 0 update yum
$YUM -y -R 10 -e 0 -d 0 update
#chmod +x /etc/cron.daily/yumupdate.sh
Cài đặt bản vá và nâng cấp hệ thống
APT:
apt-get dist-upgrade
YUM:
plugin

#yum install yum-security
Hiển thị các gói update
#yum list-security
Kiểm tra
#yum security check-update
Các gói fixed
#yum list-security bugzillas
Upgrade security
#yum update security
4, Tắt dịch vụ không cần thiết.
Stop service:
#service stop <service name>
#/etc/init.d/<service name> stop
Stop service at startup:
#chkconfig -levels 2345 <service name> off
#mv /etc/rc.d/rc5.d/<service name> /tmp/<service name>
Các dịch vụ mặc định;
5, Kiểm tra tập tin quan trọng
•/etc/fstab - root.root - 0644
•/etc/passwd - root - 644
•/etc/group - root - 644
/etc/shadow -root- 400
6, Chính sách mật khẩu
/etc/login.defs
PASS_MAX_DAYS 90 PASS_MIN_DAYS 6 PASS_MIN_LEN 14
PASS_WARN_AGE 7
7, Giới hạn truy cập root sử dụng sudo
#cat /etc/sudoers
8, Chỉ cho phép root truy cập CRON
cd /etc/

/bin/rm -f cron.deny at.deny
echo root >cron.allow
echo root >at.allow/bin/chown
root:root cron.allow at.allow
/bin/chmod 400 cron.allow at.allow
9, Banners cảnh báo
cat /etc/motd ; cat /etc/issue ; cat /etc/issue.net
10, SHH
Protocol 2
PermitRootLogin no
PermitEmptyPasswords no
Banner /etc/issue
IgnoreRhosts yes
RhostsAuthentication no
RhostsRSAAuthentication no
HostbasedAuthentication no
LoginGraceTime 1m (or less – default is 2 minutes) SyslogFacility AUTH (provides
logging under syslog AUTH)
AllowUser [list of users allowed access]
DenyUser [list of system accounts and others not allowed]
MaxStartups 10 (or less – use 1/3 the total number of remote users)
Change defaulr port SSH.
11, Host-base firewall - Iptables
Thiết lập Iptables allow:
IN: icmp; tcp - 25 - 110 - 143 - 443 - 465 - 587 - 993 -885.
OUT: tcp-25 - 465 -587;udp-53.
12, Xinetd và inetd.conf
Tắt các dịch vụ không cần thiết:
#telnet stream tcp nowait root /usr/sbin/telnetd telnetd -a
12, Tcpwrappers

Trong inetd.conf gọi file tcpd
#telnet stream tcp nowait root /usr/sbin/tcpd telnetd -a
service telnet
{
flags = REUSE NAMEINARGS
protocol = tcp
socket_type = stream
wait = no
user = telnetd
server = /usr/sbin/tcpd
server_args = /usr/sbin/in.telnetd
}
12, System Logging

×