CentOS 6 Mail Server 設定(一) —> Postfix 設定

安裝CentOS 時可以選擇安裝postfix

版本是:postfix-2.6.6-2-e16.i686

設定檔位置 /etc/postfix/main.cf

設定 postfix 可接收外部連線

修改 /etc/postfix/main.cf

  inet_interfaces = all    這一行#號拿掉

將  inet_interfaces = localhost 這行前面加上 #號註解

設定 domain name

mydomain =  pmail.idv.tw

設定 hostname

myhostname = mail.pmail.idv.tw

設定完成重新啟動postfix 服務 –> 指令 service postfix restart

測試

利用telnet 指令測試

telnet x.x.x.x 25 (如下圖)

postfix

設定postfix SMTP 驗證

安裝 cyrus-sasl-md5  cyrus-sasl-plain  cyrus-sasl套件

利用 yum install  cyrus-sasl-md5  cyrus-sasl-plain  cyrus-sasl

修改 /etc/postfix/main.cf 加入下面設定

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client bl.spamcop.net,
reject_rbl_client sbl-xbl.spamhaus.org

設定啟動 saslauthd 服務,並設定開機自動啟動

指令

  • chkconfig saslauthd on
  • service saslauthd restart

利用telnet 測式smtp認證功能是否生效(要有出現 LOGIN PLAIN才算)

postfix1



本篇瀏覽人數: 18520
分類: Cent OS篇。這篇內容的永久連結

在〈CentOS 6 Mail Server 設定(一) —> Postfix 設定〉中有 29 則留言

  1. Yuan表示:

    Hi, 榮哥:
    請問, 用了 Postfix 當 Mail Server, 然後想要在 user 端的軟體(比如: outloook)上使用全域通訊錄(全公司的 email 跟群組), 是不是要用 OpenLDAP 呢??

  2. Yuan表示:

    要再請問一下, 你沒用 LDAP 的話, 你是如何建立整個公司要用的通訊錄呢?
    如果公司有好幾百人, 總不能叫 user 自己新增吧?
    不知道你是怎麼處理這個問題的?

    謝謝了 🙂

    • 榮哥表示:

      您好
      1.之前服務的公司規模小,所以都是自己建立
      2.換至另一間公司時,資訊部會把所有的e-mail 及群組mail 建立好(資訊部會更新),並製作教學文件讓員工看,之後有新增的員工,資訊部會將他的e-mail 發給全公司自行加入
      3.目前服務的公司,已經是使用exchange 所以就沒有這個問題了

      PS:
      如果公司都是使用openwmail收發郵件,可以在openwebmail設定全域通訊務,之前有用過,但是已經忘記了

  3. 新手表示:

    請教您一下,我的環境已有一台Mail server,我要用Postfix建立第二台Mail server。
    當第二台郵件收到信時,我該用如何設定將郵件轉送回第一台。是在relayhost上設定嗎?
    謝謝您的回覆

  4. xil0u表示:

    榮哥,唉,saslauthd認證一直 不成功,telnet 只有一行信息。

  5. nelson表示:

    你好,我想請教一下 mail server的問題

    我目前狀態是 postfix + dovecot + Outlook

    port 25、110、143 都有開
    outlook 可以寄信給 別的電腦 、 但是 他卻沒辦法收信!!
    mail server 可收可寄

    outlook一直顯示 pop3 好像沒辦法登入 使用者… ( user password正確)

    我使用 telnet IP 110 去驗證
    user 使用者
    pass 密碼

    直接顯示 connection closed by foreign host.

    這問題苦惱了…一個禮拜 網路上都找不到…

  6. nelson表示:

    剛用了 telnet IP 110 指令 驗證 user passwd 下的maillog

    ———————————————————-
    Jul 13 01:28:21 test dovecot: auth: Debug: auth client connected (pid=4517)
    Jul 13 01:28:26 test dovecot: auth: Debug: client in: AUTH#0111#011PLAIN#011service=pop 3#011lip=192.168.0.200#011rip=192.168.0.210#011lport=110#011rport=50537#011resp=AHN0dWR lbnQAMTIzNDU=
    Jul 13 01:28:26 test dovecot: auth: Debug: pam(student,192.168.0.210): lookup service=d ovecot
    Jul 13 01:28:26 test dovecot: auth: Debug: pam(student,192.168.0.210): #1/1 style=1 msg =Password:
    Jul 13 01:28:26 test dovecot: auth: Debug: client out: OK#0111#011user=student
    Jul 13 01:28:26 test dovecot: auth: Debug: master in: REQUEST#0113240493057#0114517#011 1#0115182ea0ec21194620077a8ad9e4da86d
    Jul 13 01:28:26 test dovecot: auth: Debug: passwd(student,192.168.0.210): lookup
    Jul 13 01:28:26 test dovecot: auth: Debug: master out: USER#0113240493057#011student#01 1system_groups_user=student#011uid=503#011gid=505#011home=/home/student
    Jul 13 01:28:26 test dovecot: pop3-login: Login: user=, method=PLAIN, rip=192. 168.0.210, lip=192.168.0.200, mpid=4521
    Jul 13 01:28:27 test dovecot: pop3(student): Error: user student: Initialization failed : Initializing mail storage from mail_location setting failed: mkdir(/var/mail//s/stude nt) failed: Permission denied (euid=503(student) egid=505(student) missing +w perm: /va r/mail/, euid is not dir owner)
    Jul 13 01:28:27 test dovecot: pop3(student): Error: Invalid user settings. Refer to ser ver log for more information.

    • 榮哥表示:

      您好
      Jul 13 01:28:27 test dovecot: pop3(student): Error: user student: Initialization failed : Initializing mail storage from mail_location setting failed: mkdir(/var/mail//s/stude nt) failed: Permission denied (euid=503(student) egid=505(student) missing +w perm: /va r/mail/, euid is not dir owner)
      這裡已經說明問題所在
      修改 看看吧
      /etc/dovecot/conf.d/10-mail.conf
      mail_location = mbox:~/mail:INBOX=/var/mail/%u

  7. carlos表示:

    您好
    我使用 SL6.4 依上面步驟設定收信及發信都正常(測試時主機固定 IP ,另一電腦用 hinet 浮動 IP ),但是在 “利用telnet 測式smtp認證功能是否生效(要有出現 LOGIN PLAIN才算)”, 我看到的是 PLAIN LOGIN ;
    其次,我到 outlook express 設定 test 帳號(postfix 內無 test 帳號) “我的伺服器需要驗證”<=不勾選,結果信還是透過我的主機寄出去了.so…我猜是系統未做 smtp認證.我看過 maillog 沒有任何錯誤 ; 請問有辦法解嗎?謝謝

    • 榮哥表示:

      您好
      請檢察一下 main.cf
      smtpd_sasl_auth_enable = yes
      smtpd_sasl_security_options = noanonymous
      broken_sasl_auth_clients = yes
      smtpd_recipient_restrictions =
      permit_mynetworks,
      permit_sasl_authenticated,
      reject_unauth_destination

  8. Magic2008表示:

    榮哥,
    依設定,PostFix修改main.cf,服務可以起來,
    但 telnet IP 25 出
    現正連線到 XXX.XXX.XXX.XX…無法開啟到主機的連線, 在連接埠 25: 連線失敗

    • 榮哥表示:

      您好
      inet_interfaces = all 有改嗎?

      • Magic2008表示:

        有,預設值已開,防火牆的iptables全開。
        inet_interfaces = all。
        [root@svtp-10-006 postfix]# /etc/init.d/iptables status
        表格:filter
        Chain INPUT (policy ACCEPT)
        num target prot opt source destination
        1 ACCEPT all — 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
        2 ACCEPT icmp — 0.0.0.0/0 0.0.0.0/0
        3 ACCEPT all — 0.0.0.0/0 0.0.0.0/0
        4 ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
        5 REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

  9. 自動引用通知: 開啟 CentOS 的 Mail SMTP 認證 | hoyo 學習紀錄

發佈回覆給「Yuan」的留言 取消回覆

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *