วันศุกร์ที่ 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 จ้า

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

show progress ระหว่างใช้คำสั่ง dd

เวลาใช้คำสั่ง dd ก็จะไม่รู้ว่ามันทำงานไปถึงไหนแล้ว

เช่น dd if=/dev/sda of=/dev/sdb

พอ enter ปุ๊บมันก็จะเงียบไม่บอกกล่าวอะไร

ให้เปิดอีก terminal แล้วสั่ง kill -USR1 `pgrep ^dd`

จะเห็นแบบนี้ ^-^

5588081+0 records in
5588080+0 records out
2861096960 bytes (2.9 GB) copied, 131.32 s, 21.8 MB/s




อ้างอิง http://blog.christophersmart.com/2009/11/28/checking-the-progress-of-dd/

วันอังคารที่ 12 มกราคม พ.ศ. 2553

เปลี่ยน default domain Zimbra

ปกติเวลาลง Zimbra เสร็จ default จะนำชื่อเครื่องมาเป็นโดเมน

เช่น @mail.example.com แต่ถ้าต้องการให้เป็น @example.com

สามารถแก้ไขได้ที่ส่วนของ Zimbra Admin โดยไปที่

Global Setting ที่แท็บ General Information เปลี่ยน

default domain จาก mail.example.com เป็น example.com

แค่นี้ก็เป็นอันเสร็จ เวลา login ก็ไม่ต้องใส่ user@example.com ใส่แค่ชื่อ user ก็เข้าได้ ชิล ชิล ^-^