_ Chuẩn bị: _Mail server: + Hệ điều hành : CentOS + Địa IP : 192.168.0.160/24 + Hostname : mail.yakult.local _ DNS server: + Địa IP: 192.168.30.179/24 + Hostname : SRV-DC + DNS : 192.168.30.179 _ Client : + Địa IP: 10.10.10.60/24 + DNS : 192.168.30.179 _Trên mail server: #yum remove sendmail _ Edit file /etc/hosts: #vi /etc/hosts _ Edit file /etc/selinux/config: #vi /etc/selinux/config #reboot _ Cài đặt postfix: #yum install postfix _ Edit file /etc/postfix/main.cf: #vi /etc/postfix/main.cf 75 myhostname = mail.duycv.local 83 mydomain = duycv.local 99 myorigin = $mydomain 113 inet_interfaces = all 116 #inet_interfaces = localhost 164 #mydestination = $myhostname, localhost.$mydomain, localhost 165 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain 264 mynetworks = 0.0.0.0/0 419 home_mailbox = Maildir/ 680 message_size_limit = 10485760 (10Mb) (thêm dòng) _ Cài đặt Dovecot #yum install dovecot _ Edit file /etc/dovecot/dovecot.conf : # vi /etc/dovecot/dovecot.conf + Dòng 24: protocols = imap pop3 lmt _ Edit file /etc/dovecot/conf.d/10-mail.conf : #vi /etc/dovecot/conf.d/10-mail.conf + Dòng 24: mail_location = maildir:~/Maildir _ Edit file /etc/dovecot/conf.d/10-auth.conf : #vi /etc/dovecot/conf.d/10-auth.conf + Dòng 10: disable_plaintext_auth = no + Dòng 100: auth_mechanisms = plain login _ Edit file /etc/dovecot/conf.d/10-master.conf: #vi /etc/dovecot/conf.d/10-master.conf 95 # Postfix smtp-auth 96 unix_listener /var/spool/postfix/private/auth { 97 mode = 0666 98 user = postfix 99 group = postfix 100 } _ Cấu hình SSL: _ Di chuyển vào thư mục /etc/pki/tls/certs: #cd /etc/pki/tls/certs #make server.key -> setup pass key #openssl rsa -in server.key -out server.key -> nhập pass key #make server.csr #openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365 _Edit file /etc/postfix/main.cf: #vi /etc/postfix/main.cf _ Thêm vào cuối file dòng sau: smtpd_use_tls = yes smtpd_tls_cert_file = /etc/pki/tls/certs/server.crt smtpd_tls_key_file = /etc/pki/tls/certs/server.key smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scache _ Edit file /etc/postfix/master.cf : #vi /etc/postfix/master.cf 26 smtps inet n - n - - 27 -o syslog_name=postfix/smtps 28 -o smtpd_tls_wrappermode=yes _ Edit file /etc/dovecot/conf.d/10-ssl.conf #vi /etc/dovecot/conf.d/10-ssl.conf: ssl = yes 14 ssl_cert = nhập pass key #make server. csr