วันจันทร์ที่ 9 สิงหาคม พ.ศ. 2553

SMTP relay with authenticate


เวลาเราใช้ SPF ในการตรวจสอบที่มาของการส่ง email เราก็จะพบว่าต้องคอยไปเพิ่ม ip ของเครื่อง server ที่เราใช้ส่งอยู่บ่อยไป ดังนั้น มาวันนี้ก็ขอใช้ความรู้เรื่องการทำ authenticate relay smtp มาใช้งานดู ซึ่งสามารถใช้ได้กับ smtp ของ gmail ได้ด้วย (นี่ยิ่งทีเข้าไปใหญ่)

ก่อนอื่นเราต้องแน่ใจก่อนว่าเรามีการใช้งาน sasl ก่อน

# sudo apttitude install postfix libsasl2-2 ca-catificate libsasl2-modules








แล้วก็ต้องมาแก้ main.cf ตามมา โดยให้มีการกำหนดค่าสำคัญ ๆดังต่อไปนี้

[สร้างไฟล์ /etc/postfix/sasl_passwd.db]
Server # vi /etc/postfix/sasl_passwd
 # [smtp.mydomain.com]:25 user.name@mydomain.com:password
Server # chmod 400 /etc/postfix/sasl_passwd
Server # postmap /etc/postfix/sasl_passwd #เราก็จะได้ไฟล์ sasl_passwd.db ออกมาใช้งาน

[สร้างไฟล์เพื่อใช้สำหรับการตรวจสอบ certificate]
Server # cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | tee -a /etc/postfix/cacert.pem

[main.cf]
relayhost=[mail.mydomain.com]:25
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_tls_loglevel=1
smtp_sasl_security_options = noanonymous
smtp_sasl_local_domain =
broken_sasl_auth_clients = yes # ไว้สำหรับ MS Outlook ดีนักแล
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_authenticated_header = yes # สำหรับบอกว่า email นี้ได้ผ่านการตรวจสอบผู้ใช้แล้วนะ
smtp_tls_CAfile = /etc/postfix/cacert.pem # ไฟล์ Certificate

ที่มา : http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/

ไม่มีความคิดเห็น:

แสดงความคิดเห็น