差異處
這裏顯示兩個版本的差異處。
| 兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
| tech:install_mail [2012/06/13 19:55] – [2.1 cyrus-sasl] jonathan | tech:install_mail [2021/01/16 14:51] (目前版本) – 更換 Plugin jonathan | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| + | ====== 安裝 Mail Server 程序 ===== | ||
| + | < | ||
| + | * 目前我已經改用 iRedMail 來當郵件主機 | ||
| + | * 請參考 - [[tech/ | ||
| + | </ | ||
| + | <style box float-left> | ||
| + | **相關頁面: | ||
| + | ---- | ||
| + | * [[tech/ | ||
| + | * [[tech/ | ||
| + | </ | ||
| + | |||
| + | ===== - 先設定 hosts ===== | ||
| + | <code sh> | ||
| + | vi /etc/hosts | ||
| + | </ | ||
| + | : | ||
| + | 127.0.0.1 | ||
| + | : | ||
| + | </ | ||
| + | |||
| + | ===== - 安裝基本郵件系統元件 ===== | ||
| + | CentOS 內之預設版本: | ||
| + | < | ||
| + | * sendmail-8.13.1-3.2.el4 | ||
| + | * dovecot-0.99.11-8.EL4 | ||
| + | * cyrus-sasl-2.1.19-14 | ||
| + | * cyrus-sasl-devel-2.1.19-14 | ||
| + | * cyrus-sasl-plain-2.1.19-14 | ||
| + | * cyrus-sasl-md5-2.1.19-14 | ||
| + | * perl-5.8.5-36.RHEL4 | ||
| + | * spamassassin-3.1.9-1.el4 | ||
| + | </ | ||
| + | ++++詳細安裝程序| | ||
| + | < | ||
| + | su - root | ||
| + | yum install sendmail sendmail-cf dovecot cyrus-sasl cyrus-sasl-devel cyrus-sasl-plain cyrus-sasl-md5 perl spamassassin | ||
| + | </ | ||
| + | ++++ | ||
| + | |||
| + | |||
| + | ==== - cyrus-sasl ==== | ||
| + | ++++cyrus-sasl 設定程序| | ||
| + | < | ||
| + | * CentOS 6 | ||
| + | * 更改 / | ||
| + | * CentOS 5 | ||
| + | * 64 bits 環境就更改 / | ||
| + | * 32 bits 環境就更改 / | ||
| + | </ | ||
| + | <code|h vi / | ||
| + | log_level: 3 | ||
| + | pwcheck_method: | ||
| + | mech_list: PLAIN LOGIN | ||
| + | </ | ||
| + | < | ||
| + | chkconfig saslauthd on | ||
| + | service saslauthd restart | ||
| + | </ | ||
| + | ++++ | ||
| + | |||
| + | ==== - sendmail ==== | ||
| + | ++++sendmail 設定程序| | ||
| + | <code|h vi / | ||
| + | : | ||
| + | TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN' | ||
| + | define(`confAUTH_MECHANISMS', | ||
| + | : | ||
| + | DAEMON_OPTIONS(`Port=smtp, | ||
| + | : | ||
| + | </ | ||
| + | < | ||
| + | 在 TRUST_AUTH_MECH 處要去掉前面 **dnl** 否則還是不會有 smtp 認證的設定功能 | ||
| + | </ | ||
| + | < | ||
| + | cd /etc/mail | ||
| + | mv sendmail.cf sendmail.cf.back1 | ||
| + | m4 sendmail.mc > sendmail.cf | ||
| + | </ | ||
| + | ++++ | ||
| + | ++++加入接受的 Domain Name| | ||
| + | <code|h vi / | ||
| + | # local-host-names - include all aliases for your machine here. | ||
| + | ichiayi.com | ||
| + | mail.ichiayi.com | ||
| + | corp.ichiayi.com | ||
| + | server.ichiayi.com | ||
| + | trysoft.tw | ||
| + | mail.trysoft.tw | ||
| + | xdsl.uimt.com | ||
| + | </ | ||
| + | ++++ | ||
| + | ++++編輯信任 IP 定義| | ||
| + | <code|h vi / | ||
| + | : | ||
| + | localhost.localdomain | ||
| + | localhost | ||
| + | 127.0.0.1 | ||
| + | 61.67.71.91 | ||
| + | : | ||
| + | </ | ||
| + | ++++ | ||
| + | ++++編輯 Aliases 定義| | ||
| + | <code|h vi / | ||
| + | : | ||
| + | # Person who should get root's mail | ||
| + | root: | ||
| + | |||
| + | # Other persons aliases | ||
| + | jonathan: | ||
| + | photo: | ||
| + | backup: | ||
| + | |||
| + | # Mail List | ||
| + | # G2B2C Mail List | ||
| + | boxteam: | ||
| + | moeateam: | ||
| + | </ | ||
| + | < | ||
| + | newaliases | ||
| + | </ | ||
| + | ++++ | ||
| + | * 與 sendmail 相關設定全部定義好後重新啟動 sendmail | ||
| + | < | ||
| + | service sendmail restart | ||
| + | </ | ||
| + | ++++確認是否設定正確 smtp 寄信具有身份認證功能簡單檢測方式: | ||
| + | |||
| + | - 輸入 **telnet localhost 25**< | ||
| + | [root@centos5 mail]# telnet localhost 25 | ||
| + | Trying 127.0.0.1... | ||
| + | Connected to vm-mail.ichiayi.com (127.0.0.1). | ||
| + | Escape character is ' | ||
| + | 220 vm-mail.ichiayi.com ESMTP Sendmail 8.13.8/ | ||
| + | </ | ||
| + | - 輸入 smtp 命令 **ehlo localhost**< | ||
| + | 250-vm-mail.ichiayi.com Hello centos5 [127.0.0.1], | ||
| + | 250-ENHANCEDSTATUSCODES | ||
| + | 250-PIPELINING | ||
| + | 250-8BITMIME | ||
| + | 250-SIZE | ||
| + | 250-DSN | ||
| + | 250-AUTH LOGIN PLAIN | ||
| + | 250-DELIVERBY | ||
| + | 250 HELP | ||
| + | </ | ||
| + | - 這時如果沒有出現 **AUTH LOGIN PLAIN** 那就是設定有問題,可能是 sendmail.mc 內的 TRUST_AUTH_MECH 定義前面 dnl 沒拿掉的問題 | ||
| + | - 最後透過 **quit** 離開 smtp 互動模式< | ||
| + | quit | ||
| + | 221 2.0.0 vm-mail.ichiayi.com closing connection | ||
| + | Connection closed by foreign host. | ||
| + | [root@centos5 mail]# | ||
| + | </ | ||
| + | ++++ | ||
| + | |||
| + | ==== dovecot 設定程序 ==== | ||
| + | * CentOS 5 <code|h vi / | ||
| + | : | ||
| + | protocols = imap pop3 | ||
| + | : | ||
| + | </ | ||
| + | chkconfig dovecot on | ||
| + | service dovecot restart | ||
| + | </ | ||
| + | * CentOS 6 <code|h vi / | ||
| + | : | ||
| + | protocols = imap pop3 | ||
| + | : | ||
| + | !include_try / | ||
| + | </ | ||
| + | mail_privileged_group = mail | ||
| + | </ | ||
| + | : | ||
| + | disable_plaintext_auth = no | ||
| + | : | ||
| + | </ | ||
| + | : | ||
| + | mail_location = mbox: | ||
| + | : | ||
| + | </ | ||
| + | * 設定 imaps/pop3s | ||
| + | * 建立 SSL 加密所需要憑證< | ||
| + | |||
| + | </ | ||
| + | ===== - 安裝防毒過濾系統 | ||
| + | |||
| + | * http:// | ||
| + | <code sh> | ||
| + | yum install clamav clamd | ||
| + | service clamd start | ||
| + | chkconfig clamd on | ||
| + | </ | ||
| + | ++++詳細 Source 下載安裝程序| | ||
| + | < | ||
| + | su - root | ||
| + | yum install zlib zlib-devel | ||
| + | cd MailSource | ||
| + | wget http:// | ||
| + | tar -zxvf clamav-0.94.tar.gz | ||
| + | cd clamav-0.94 | ||
| + | useradd clamav | ||
| + | ./configure | ||
| + | make | ||
| + | make install | ||
| + | </ | ||
| + | 安裝前要先建立 clamav 的帳號與群組, | ||
| + | ++++ | ||
| + | ===== - 安裝 MailScanner ===== | ||
| + | * https:// | ||
| + | ++++詳細安裝程序| | ||
| + | < | ||
| + | su - root | ||
| + | yum install rpm-build binutils glibc-devel gcc make | ||
| + | mkdir -p / | ||
| + | cd / | ||
| + | wget https:// | ||
| + | tar -zxvf MailScanner-5.0.3-7.rhel.tar.gz | ||
| + | cd MailScanner-5.0.3-7 | ||
| + | ./ | ||
| + | </ | ||
| + | |||
| + | ++++ | ||
| + | ==== - 設定 MailScanner 定義檔 ==== | ||
| + | * 新安裝編輯 / | ||
| + | ++++vi / | ||
| + | < | ||
| + | : | ||
| + | %org-name% = Trysoft | ||
| + | : | ||
| + | %org-long-name% = Trysoft Corp. | ||
| + | : | ||
| + | %web-site% = www.ichiayi.com | ||
| + | : | ||
| + | Virus Scanners = auto | ||
| + | : | ||
| + | Sign Clean Messages = no | ||
| + | : | ||
| + | Spam Subject Text = [*Trysoft-SPAM*] | ||
| + | : | ||
| + | High Scoring Spam Subject Text = [*Trysoft-SPAM*] | ||
| + | : | ||
| + | Send Notices = no | ||
| + | : | ||
| + | Spam List = SBL+XBL spamhaus-PBL CBL DSBL spamhaus-ZEN | ||
| + | : | ||
| + | Is Definitely Spam = %rules-dir%/ | ||
| + | : | ||
| + | Spam Actions = store | ||
| + | : | ||
| + | High Scoring Spam Actions = store | ||
| + | : | ||
| + | SpamAssassin User State Dir = / | ||
| + | : | ||
| + | SpamAssassin Install Prefix = /usr | ||
| + | : | ||
| + | </ | ||
| + | ++++ | ||
| + | * 升級的自動調整設定方式 | ||
| + | ++++upgrade_MailScanner_conf| | ||
| + | < | ||
| + | cd / | ||
| + | upgrade_MailScanner_conf MailScanner.conf MailScanner.conf.rpmnew > MailScanner.new | ||
| + | mv -f MailScanner.conf MailScanner.old | ||
| + | mv -f MailScanner.new | ||
| + | </ | ||
| + | ++++ | ||
| + | ==== - 設定 sendmail 與 MailScanner 啟動方式 ==== | ||
| + | * 設定 sendmail + MailScanner 啟動方式< | ||
| + | service sendmail stop | ||
| + | chkconfig sendmail off | ||
| + | chkconfig MailScanner on | ||
| + | service MailScanner start | ||
| + | </ | ||
| + | |||
| + | * 當出現 MailScanner: | ||
| + | vi / | ||
| + | </ | ||
| + | : | ||
| + | deny self-extract | ||
| + | #deny | ||
| + | #EXAMPLE: deny - | ||
| + | #deny | ||
| + | deny Registry | ||
| + | |||
| + | #deny | ||
| + | : | ||
| + | </ | ||
| + | service MailScanner restart | ||
| + | </ | ||
| + | |||
| + | === 參考網址資料 === | ||
| + | * http:// | ||
| + | * http:// | ||
| + | |||
| + | {{tag> | ||