1. Trung Tâm Đào Tạo
Quản Trị Mạng Và An Ninh Mạng Quốc Tế Athena
Báo Cáo Thực Tập Tuần III
Sinh viên thực tập: Nguyễn Trần Minh Tiến
Khoa: Công nghệ thông tin
Trường: ĐH Quốc Tế - ĐH Quốc Gia Tp Hồ Chí Minh
Ngành thực tập: Công nghệ thông tin
Đề tài thực tập: Xây dựng hệ thống mail server
(Postfix, Dovecot) doanh nghiệp trên Linux
Giáo viên hướng dẫn: Võ Đỗ Thắng
Tuần 2: 30/06/2014 – 04/07/2014
2. Nội Dung
I. Cấu hình Postfix.............................................................................................................
II. Cấu hình Dovecot ..........................................................................................................
3. I. Cấu hình Postfix:
-Cài đặt postfix
[root@server~]#yuminstall postfix
-Cấuhình Postfix tại "/etc/postfix/main.cf"
[root@server~]#vi /etc/postfix/main.cf
#Di dendong77 themvaogia tri "myhostname"
myhostname=server.athena.lab
#Dong 85 cau hinhgia tri "domain"
mydomain=athena.lab
#Dong 101 cau hinhgiatri "myorigin"
myorigin= $mydomain
#Dong 116 cau hinhpostfix hoạtđộngở tất cả các interfaces
inet_interfaces=all
#Dòng 167 thêmvàogiá trị $mydomain
mydestination=$myhostname,localhost.$mydomain,localhost,$mydomain
#Chuyểnđếndòng270 xác địnhcác giátrị mynetworks
mynetworks=127.0.0.0/8 192.168.1.0/24
#Dòng 424 xác địnhhome foldercủamail box
home_mailbox=Maildir/
4. #Dòng 550, cấu hìnhkiểmtra các thôngsố headercủa email
header_checks=regexp:/etc/postfix/header_checks
body_checks=regexp:/etc/postfix/body_checks
#Dòng 575 cấu hình bannercho email
smtpd_banner= $myhostname ESMTP$mail_name
#Thêm vàoở dưới cùng file cácthôngsố giới hạndung lượngchotừng email vàdung lượng
của mail box. Bêndưới
mỗi email dùngđược 10MB và Mail box có dung lượnglà1GB
message_size_limit=10485760
mailbox_size_limit=1073741824
#Cấu hình các thôngsố xác thực cho SMTP
smtpd_sasl_type =dovecot
smtpd_sasl_path= private/auth
smtpd_sasl_auth_enable =yes
smtpd_sasl_security_options=noanonymous
smtpd_sasl_client_restrictions=permit_mynetworks,reject_unknown_client,permit
smtpd_sasl_recipient_restrictions=permit_mynetworks,permit_auth_destination,
permit_sasl_authenticated,reject
-Cấuhình tạo file header_checksvàbody_checks
[root@server~]#vi /etc/postfix/header_checks
#Loại bỏ email nếunhưkhôngcó địa chỉ email
/^From:.*<#.*@.*>/ REJECT
/^Return-Path:.*<#.*@.*>/REJECT
5. [root@server~]#vi /etc/postfix/body_checks
#Loại bỏ email nếutrongnội dungcó ký tự hacker.com
/^(|[^>].*)hacker.com/REJECT
-Tắt service sendmail
# service sendmail status
# service sendmail stop
-Khởi độngdịchvụ postfix
[root@server~]#/etc/init.d/postfix restart
- Chuyểnpostfix sanglàmMTA mặc định
[root@ns~]# yum install system-switch-mail
[root@ns~]# system-switch-mail
[root@ns~]# chkconfigsendmail off
[root@ns~]# chkconfigpostfix on
6. II. Cấu hình Dovecot:
-Dovecotđóngvai trò làPOP/IMAPServerđể truyểnfile đếnclient
-Cài đặt Dovecotpackage
[root@server~]#yuminstall dovecot
-Cấuhình dovecottại vị trí "/etc/dovecot/dovecot.conf"
[root@server~]#vi /etc/dovecot/dovecot.conf
#Dòng 26 thay đổi giá trị chỉ sử dụng IPv4
listen=*
[root@server~]#vi/etc/dovecot/conf.d/10-auth.conf
#Dòng 9 thayđổi giá trị cho phépxác thực plaintext
disable_plaintext_auth=no
#Dòng 97 thêmvào giátrị login
auth_mechanisms=plainlogin
[root@server~]#vi/etc/dovecot/conf.d/10-mail.conf
#Dòng 30 xác địnhvị trí mail location
mail_location=maildir:~/Maildir(xemlại trênDigitalOcean)
[root@server~]#vi/etc/dovecot/conf.d/10-master.conf
#Thay đổi giátrị dòng87
unix_listener/var/spool/postfix/private/auth{
mode = 0666
user= postfix
group= postfix
}
-Khởi độngdịchvụ Dovecot
[root@server~]#/etc/init.d/dovecotstart
[root@server~]#chkconfigdovecoton
[root@server~]#/etc/init.d/iptablesstop
-Tạo username vàpasswordđể kiểmtra.
[root@server~]#useradduser1
[root@server~]#passwduser1