วันศุกร์ที่ 22 มกราคม พ.ศ. 2553

เซต Relay Host บน Zimbra

วันนี้เจอปัญหาว่าเมลเซิร์ฟเวอร์นั้นส่งเมลออกได้บางโดเมน แต่ก็มีอีกหลายโดเมนที่ไม่สามารถส่งออกได้

ทีมงานก็ช่วยกันทดสอบโดยลองไปใช้ smtp ของที่อื่น ก็ส่งออกได้ปกติ จึงจำเป็นต้องเซต server

ให้ส่ง Relay mail ไปใช้ smtp ตัวที่ใช้ได้ก่อน ซึ่งวิธีเซตบน Zimbra นั้นก็ทำตามนี้

http://wiki.zimbra.com/index.php?title=Outgoing_SMTP_Authentication

ต่อไปนี้เป็นขั้นตอนที่ทำจริง

การจะเซต Relay host ทำบน Admin UI ก็ได้โดยไปที่ server เลือกแทป MTA แล้วเซตตรง

Relay MTA for external delivery ให้เป็น smtp ที่ต้องการ Relay

แต่ถ้าไม่เข้าไปจะใช้คอมมานด์ที่เดียวก็ได้ แต่ต้องให้ user เป็น zimbra ก่อนแล้วก็ใช้คำสั่ง

zimbra@mail:~$ zmprov ms mail.example.com zimbraMtaRelayHost relayserver.com:port_num


แต่ถ้า smtp นั้นมีการ Authen ก็ต้องทำต่อตามนี้

1. สร้างไฟล์ relay_password ใน /opt/zimbra/conf ก่อน

zimbra@mail:~$ touch /opt/zimbra/conf/relay_password

2. ใส่ smtp server, user, password ในไฟล์ /opt/zimbra/conf/relay_password

zimbra@mail:~$ echo mail.example.com username:password > /opt/zimbra/conf/relay_password


ลองใช้คำสั่ง cat /opt/zimbra/conf/relay_password ต้องได้


mail.example.com username:password


3. hash ไฟล์

zimbra@mail:~$ postmap hash:/opt/zimbra/conf/relay_password


4. ทดสอบความถูกต้อง ซึ่ง คำตอบต้องได้ username:password:

zimbra@mail:~$ postmap -q relayserver.com /opt/zimbra/conf/relay_password


5. แก้ไขคอนฟิกไฟล์ postfix ให้ใช้ password ใหม่


zimbra@mail:~$ postconf -e smtp_sasl_password_maps=hast:/opt/zimbra/conf/relay_password

6. คอนฟิก postfix ให้ใช้ SSL authen

zimbra@mail:~$ postconf -e smtp_sasl_auth_enable=yes


7. zimbra@mail:~$ postconf -e smtp_cname_overrides_servername=no

8. zimbra@mail:~$ postfix reload

ถ้าใช้ TLS ให้ใช้

zimbra@mail:~$ postconf -e smtp_use_tls=yes

zimbra@mail:~$ postfix reload


แต่ทำแล้วก็ยังติดปัญหา ดูใน log file เจอแบบนี้

Jan 22 13:54:27 mail postfix/smtp[31651]: 0585014E81F9: to=, relay=relayserver.com[xxx.xxx.xxx.xxx]:25, delay=5.1, delays=0.01/0.01/5.1/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server relayserver.com[xxx.xxx.xxx.xxx]: no mechanism available)

ให้แก้โดย

zimbra@mail:~$ postconf -e smtp_sasl_security_options=noanonymous

zimbra@mail:~$ postfix reload


จบกระบวนท่า แค่นี้ก็ relay host ได้แล้ว ไปเชค log เพื่อความแน่ใจอีกรอบนะเจ้าคะ

อ่อ log ก็ดูได้ใน /var/log/zimbra.log จ้า

3 ความคิดเห็น:

Unknown กล่าวว่า...

ํYour article just help me and my team a lot.
Many thanks for sharing and please keep going.

Appreciated and have a good day.

Pakphong

rekach กล่าวว่า...

อันนี้ set เป็น mail server ใช้งานได้เลยหรือป่าวครับ สนใจมากกกกกกกกกกกก เก่งอีกแระ
กำลังหา sourcing เรื่องนี้พอดี จะเอาไปทำตาม ถ้าทำไม่ได้ มารับผิดชอบด้วย มาทำให้สนใจทำไมเนี่ย

LinuxGirl~ กล่าวว่า...

บทความนี้แค่เป็นการเซต Mail Server ให้ใช้ relay host ผ่านเซิร์ฟเวอร์อื่นเท่านั้นคะ แต่ถ้าต้องการทำ Mail Server ต้องดูวิธีติดตั้ง Zimbra ตาม link นะคะ ^^
http://www.zimbra.com/docs/os/latest/single_server_install/
http://www.howtoforge.com/installing_zimbra_collaboration_suite_on_ubuntu