ผลต่างระหว่างรุ่นของ "Centos - การติดตั้งขั้นพื้นฐาน (2017)"

จาก Wiki_EAI
ไปยังการนำทาง ไปยังการค้นหา
แถว 1: แถว 1:
== EAI คืออะไร ==
+
'''การติดตั้ง Postfix สำหรับการเปิดใช้งาน SMTPUTF8, Cyrus SASL และ OpenSSL'''
*[[คำนิยามของ RFC]]
 
*[[อนุญาตให้ใช้งาน EAI อย่างไร - วิธีการของเรา]]
 
  
 +
== สรุปสาระสำคัญของ mail server==
 +
คู่มือนี้ใช้สำหรับการติดตั้ง mail server ที่สามารถรับ mail ที่เป็น SMTPUTF8 ได้ นอกจากนี้ยังป้องการการตีกลับของอีเมลหากผู้ส่งส่งไปยัง mail server
  
== การติดตั้งอีเมลภาษาท้องถิ่น ==
+
ที่ไม่รองรับ SMTPUTF8 รวมถึง IMAP และ POP3 ที่ใช้ Courier ด้วย ผู้ใช้จะถูกเพิ่มเป็น local user ถึงแม้ว่าจะ login ผ่าน SSH หรือไม่ก็ตาม mail ทั้งหมดจะถูกเก็บไว้ที่ /home/user
*[[การติดตั้งขั้นพื้นฐาน]] -  รองรับ SMTPUTF8, SMTP Auth (unencrypted & TLS), imap/pop3 (unencrypted &TLS)
 
*[[พัฒนาการติดตั้งครั้งที่ 1]] - ตั้งค่า Postfix ให้เพิ่ม SMTPUTF8 อัตโนมัติเมื่อทำการส่ง EAI Address โดยใช้ Pipe Filter
 
*[[พัฒนาการติดตั้งครั้งที่ 2]] - ตั้งค่า Postfix ให้แก้ไข ที่อยู่ email ของผู้ส่งเมื่อทำการส่งไปยัง mail server ที่ไม่ได้เปิดใช้งาน EAI โดยใช้ Pipe Filter
 
*[[พัฒนาการติดตั้งครั้งที่ 3]] - รองรับ Multiple virtual domain
 
  
 +
Squirrel-mail ที่ถูกแก้ไขนี้จะถูกติดตั้งในการส่งและรับ email (จะต้องมีการทดสอบ)
  
{| class="wikitable"
+
email client สามารถนำมาใช้ได้ โดยใช้ username ที่ไม่ได้เป็น EAI address
|-
 
! การติดตั้ง !! LOCAL EAI  !! SEND TO NON-EAI AS EAI!! RECEIVE EAI MAIL !! REPLY TO EAI WITH NON-EAI MAIL CLIENT !! REPLY TO EAI BY NON-EAI WEBMAIL || REPLY TO EAI BY MODIFIED WEBMAIL || RECEIVE/REPLY/SEND using Gmail as a Client
 
|-
 
| การติดตั้งขั้นพื้นฐาน      || NO  || NO      ||      YES  || NO    ||  NO || YES || YES
 
|-
 
| พัฒนาการติดตั้งครั้งที่ 1  || NO  || NO      ||      YES || YES *  || YES*  || YES || YES
 
|-
 
| พัฒนาการติดตั้งครั้งที่ 2  || YES  ||        YES||    YES||        YES* || YES*      || YES || YES
 
|-
 
| พัฒนาการติดตั้งครั้งที่ 3  || -    ||        -||    -||          -||        || YES|| YES
 
|}
 
 *วิธีนี้จะใช้ได้กับ Mail client ที่อนุญาตให้ใช้ตัวอักษรที่เป็น NON-ASCII หรือ ที่อยู่ email ที่เป็น NON-ASCII จะไม่กลายเป็นตัวอักษรที่อ่านไม่ออก
 
  
== รายการของ EAI ที่เปิดใช้งาน Mail Client ==
+
ใช้ Centos 7, 64 Bit
Outlook 2016  - (Base Installation)Send to EAI as NON EAI (address is copy pasted) - Yes - using Coremail Server as EAI (Receiving)
 
                  (Base Installation)Receive from EAI as NON EAI - Yes - using Coremail Server as EAI (Receiving)
 
                  (Base Installation)Reply From EAI as NON EAI - No (The EAI email address is garbled when received) using Coremail Server (Receiving)
 
  
== รายการของ EAI ที่เปิดใช้งาน Webmail ==
+
* ไม่ได้ทดสอบบน Centos 5 กับ Centos 6 ซึ่งอาจจะใช้งานไม่ได้
  
ณ เวลาที่เขียนนี้ ยังไม่มี webmail ตัวไหนที่สามารถใช้งานได้
+
คุณสามารถติดตั้งด้วย root ไม่เช่นนั้นให้ระบุเป็น non privileged user
  
NONE
+
== ข้อสังเกต ความต้องการและการตั้งค่าเริ่มต้น ==
  
== การตั้งค่า Gmail เพื่อให้ทำงานเป็น EAI Client ==
 
Gmail เป็นตัวเลือกที่ดีที่สุดที่จะใช้เป็น Client
 
 
 
NONE
 
  
== การตั้งค่า Outlook 2016 ==
+
* Centos 7 (64 bit) แบบ minimal installation 
 +
* Centos 7 มาพร้อมกับการติดตั้ง postfix 2.x
 +
* คู่มือนี้สมมติว่าคุณติดตั้งด้วย root เว้นแต่จะระบุไว้เป็นอย่างอื่น
 +
* DNS ของคุณต้องติดตั้งให้พร้อมก่อนการตั้งค่า
 +
* hostname คือ ชื่อโดเมนของคุณ เช่น domain.com
 +
* mail.hostname คือ ชื่อ Mail server ของคุณ เช่น mail.domain.com
  
  More Settings-> Outgoing Server -> Checked - My Outgoing server(SMTP) requires authentication
+
  '''แก้ไข hostname '''
More Settings-> Advance -> POP3 110, SMTP 25 , Use the following type of encrypted connection TLS
+
''ถ้าคุณใช้ international domain ให้คุณใช้ในรูปแบบ punycode''
  
== รายการของ Scripts ==
+
ตัวอย่าง: mail.วีคลาส.ไทย punycode equivalent ควรจะเป็น mail.xn--42c0eeo3bp.xn--o3cw4h
* [http://guides.thnic.or.th/eai-setup-guidelines-th/files/squirrelmail.zip Modified Squirrelmail]
+
<syntaxhighlight lang="bash">
* [https://github.com/padillareyj/eaifilter EAI Filter Scripts]
+
vi /etc/hostname
 +
</syntaxhighlight>
 +
 
 +
แก้ไขเป็นชื่อ hostname ที่คุณต้องการ
 +
<syntaxhighlight lang="bash">
 +
mail.domain.com
 +
</syntaxhighlight>
 +
 
 +
 
 +
ปิดและเปิด server ใหม่ เพื่อปรับปรุง hostname
 +
 
 +
หลังจากปิดและเปิด server ใหม่แล้ว ให้ใช้คำสั่งต่อไปนี้จะแสดง hostname เพื่อดูว่า hostname เปลี่ยนแล้ว
 +
<syntaxhighlight lang="bash">
 +
hostname
 +
</syntaxhighlight>
 +
 
 +
== ติดตั้ง Postfix จาก source และ libraries ที่จำเป็น (Cyrus  SASL, OPENSSL)  ==
 +
 
 +
ใช้คำสั่ง get เพื่อดาวน์โหลด Postfix เวอร์ชั่น 3.0.1 หรือเวอร์ชั่นที่ใหม่กว่าเพื่อเปิดใช้งาน SMTPUTF8 คุณสามารถโหลดได้จาก http://www.postfix.org/download.html ในตัวอย่างด้านล่าง เราดาวน์โหลด postfix-3.0.1.tar.gz เวอร์ชั่นของคุณอาจจะแตกต่างออกไป ขณะนี้การติดตั้ง Postfix ด้วย apt-get นั้นจะทำการติดตั้ง Postfix เวอร์ชั่นเก่าที่ยังไม่รองรับ SMTPUTF8 ซึ่งอาจจะมีการเปลี่ยนแปลงในภายหลัง
 +
 
 +
ติดตั้ง libraries และ tools ที่จำเป็น
 +
<syntaxhighlight lang="bash">
 +
 
 +
yum groupinstall development tools
 +
yum install cyrus-sasl cyrus-sasl-devel openssl openssl-devel libdb-devel.x86_64 libicu-devel telnet net-tools
 +
</syntaxhighlight>
 +
 
 +
ดาวน์โหลด Postfix 3.0.1 หรือเวอร์ชั่นที่ใหม่กว่า
 +
 
 +
<syntaxhighlight lang="bash">
 +
tar -xzvf postfix-3.0.1.tar.gz
 +
cd postfix-3.0.1
 +
sed -i 's/.\x08//g' README_FILES/*
 +
</syntaxhighlight>
 +
 
 +
Compile ด้วย openssl และ sasl auth
 +
<syntaxhighlight lang="bash">
 +
make makefiles CCARGS='-DUSE_TLS -I/usr/include/openssl  -DUSE_SASL_AUTH -DUSE_CYRUS_SASL  -I/usr/include/sasl '  AUXLIBS='-L/usr/lib64  -L/usr/lib64/openssl -L/usr/lib64/sasl2 -lssl -lcrypto -lsasl2'
 +
make
 +
 
 +
</syntaxhighlight>
 +
หมายเหตุ: ถ้าคุณใช้ OS ที่เป็น 32Bit OS ให้แทนที่  /lib64 ด้วย /lib
 +
 
 +
 +
ติดตั้ง Postfix
 +
<syntaxhighlight lang="bash">
 +
make upgrade
 +
</syntaxhighlight>
 +
คุณสามารถนำไฟล์การตั้งค่าที่ไม่ได้ใช้ออกไป ซึ่งจะแสดงในส่วนสุดท้ายของการติดตั้ง
 +
 
 +
== การตั้งค่า Postfix ==
 +
 
 +
สร้าง Mails Alias สำหรับ root หรือ  postmaster เพื่อส่งไปยังผู้ใช้งานจริง (YourLogin) 
 +
<br/>หมายเหตุ: ขั้นตอนนี้เป็นทางเลือกเนื่องจาก Centos 7 ได้เติมไว้ให้แล้ว
 +
 
 +
<syntaxhighlight lang="bash">
 +
vi /etc/aliases
 +
</syntaxhighlight>
 +
 
 +
copy และ paste ตัว code ด้านล่าง โดยเปลี่ยน YourLogin เป็น user ของคุณเองแล้วทำการ save และ quit
 +
 
 +
<syntaxhighlight lang="bash">
 +
MAILER-DAEMON:    postmaster
 +
postmaster:      root
 +
root:            YourLogin
 +
</syntaxhighlight>
 +
 
 +
ต่อจากนั้น
 +
<syntaxhighlight lang="bash">
 +
newaliases
 +
</syntaxhighlight>
 +
 
 +
 
 +
แก้ไข mail.domain.tld, domain.tld,  yourotherdomain.tld (yourotherdomain.tld ไม่จำเป็นต้องใส่ก็ได้)
 +
<syntaxhighlight lang="vim">
 +
postconf compatibility_level=2
 +
postconf -e 'myhostname  = mail.domain.tld'
 +
postconf -e 'mydomain    = domain.tld'
 +
postconf -e 'myorigin    = $mydomain'
 +
postconf -e 'inet_interfaces = all'
 +
postconf -e 'mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24'
 +
postconf -e 'alias_database = hash:/etc/aliases'
 +
postconf -e 'alias_maps = hash:/etc/aliases'
 +
postconf -e 'mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, yourotherdomain.tld'
 +
postconf -e 'smtputf8_enable = yes'
 +
</syntaxhighlight>
 +
 
 +
 +
 
 +
ขั้นตอนสุดท้าย start Postfix ในครั้งแรก
 +
 
 +
<syntaxhighlight lang="bash">
 +
service postfix restart
 +
</syntaxhighlight>
 +
 
 +
 
 +
ลองใช้งานและส่ง mail โดยใช้ Telnet ส่ง mail ไปยัง server อื่นๆ เช่น gmail
 +
 
 +
== ทดสอบว่าคุณมีการเปิดการใช้งาน SMTPUTF8 หรือไม่ ==
 +
 
 +
ป้อนคำสั่งในหน้า console ซึ่งคำสั่งจะทำการเชื่อมต่อไปยัง SMTP
 +
<syntaxhighlight lang="bash">
 +
telnet localhost 25
 +
</syntaxhighlight>
 +
 
 +
ควรจะแสดงผลลัพธ์ดังนี้
 +
<syntaxhighlight lang="bash">
 +
Trying 127.0.0.1...
 +
Connected to localhost.
 +
Escape character is '^]'.
 +
220 YourHostName ESMTP Postfix
 +
</syntaxhighlight>
 +
 
 +
 
 +
พิมพ์คำสั่งด้านล่างแล้วกด enter
 +
<syntaxhighlight lang="bash">
 +
EHLO localhost
 +
</syntaxhighlight>
 +
 
 +
 
 +
เมื่อพบว่ามี '''250 SMTPUTF8''' อยู่ แสดงว่า server ของคุณ สามารถรับและส่ง mail จากที่อยู่ email สากลได้
 +
<syntaxhighlight lang="bash">
 +
250-YourHostName
 +
250-PIPELINING
 +
250-SIZE 10240000
 +
250-VRFY
 +
250-ETRN
 +
250-ENHANCEDSTATUSCODES
 +
250-8BITMIME
 +
250-DSN
 +
250 SMTPUTF8
 +
</syntaxhighlight>
 +
 
 +
 
 +
หากไม่พบ 250 SMTPUTF8 ให้ลองเอา Postfix ออกและลองใหม่อีกครั้ง เพราะอาจจะมีการติดตั้งส่วนเสริม software ของ Postfix ที่เป็นตัวเก่าเหลืออยู่
 +
 
 +
== เปิดใช้งาน SMTP Auth ==
 +
 
 +
<syntaxhighlight lang="bash">
 +
yum install  cyrus-sasl-plain
 +
</syntaxhighlight>
 +
 
 +
 
 +
'''แก้ไขไฟล์ /etc/sasl2/smtpd.conf'''
 +
<syntaxhighlight lang="bash">
 +
pwcheck_method: saslauthd
 +
mech_list: PLAIN LOGIN
 +
</syntaxhighlight>
 +
 
 +
 
 +
ปรับปรุงการตั้งค่า Postfix
 +
<syntaxhighlight lang="bash">
 +
postconf -e 'smtpd_sasl_path = smtpd'
 +
postconf -e 'smtpd_sasl_auth_enable = yes'
 +
service saslauthd start
 +
postfix reload
 +
</syntaxhighlight>
 +
 
 +
 
 +
สร้าง user ที่เราสามารถทดสอบการ authentication ได้ แทนที่ AnyUserName ด้วย user ของคุณ
 +
<syntaxhighlight lang="bash">
 +
useradd -m AnyUserName  -s /usr/sbin/nologin
 +
passwd AnyUserName
 +
</syntaxhighlight>
 +
 
 +
 
 +
สร้าง Auth key ของคุณ แทนที่ username ด้วย username  ของคุณ และแทนที่ password ด้วย password ของคุณ
 +
<syntaxhighlight lang="bash">
 +
perl -MMIME::Base64 -e 'print encode_base64("username\0username\0password");'
 +
</syntaxhighlight>
 +
 
 +
 
 +
แทนที่ dGVzdAB0ZXN0AHRlc3Q=  ด้วย key ที่คุณสร้างขึ้น
 +
<syntaxhighlight lang="bash">
 +
 +
telnet localhost 25
 +
EHLO localhost
 +
AUTH PLAIN dGVzdAB0ZXN0AHRlc3Q=
 +
 
 +
 
 +
</syntaxhighlight>
 +
 
 +
 
 +
คุณควรจะได้รับข้อความว่า  Authentication successful
 +
 
 +
 
 +
จบการตั้งค่า Postfix ด้วยการอนุญาติให้เฉพาะผู้ใช้ที่ทำการ authenticate ทำการส่งไปยัง SMTP ได้
 +
 
 +
<syntaxhighlight lang="bash">
 +
postconf -e 'broken_sasl_auth_clients = yes'
 +
postconf -e 'smtpd_sasl_security_options = noanonymous'
 +
postconf -e 'smtpd_sasl_local_domain = $mydomain'
 +
postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination'
 +
postconf -e 'smtpd_relay_restrictions =  permit_mynetworks permit_sasl_authenticated reject_unauth_destination reject_sender_login_mismatch'
 +
</syntaxhighlight>
 +
 
 +
== เปิดใช้งาน TLS ==
 +
 
 +
สร้าง certificates
 +
<syntaxhighlight lang="bash">
 +
cd /etc/postfix
 +
 
 +
openssl req -new -outform PEM -out smtpd.cert \
 +
  -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM \
 +
  -days 365 -x509
 +
</syntaxhighlight>
 +
 
 +
ตอบคำถามต่อไปนี้เมื่อได้รับแจ้ง
 +
 
 +
 
 +
ปรับปรุงการตั้งค่า Postfix
 +
 
 +
<syntaxhighlight lang="bash">
 +
postconf -e 'smtpd_enforce_tls = no'
 +
postconf -e 'smtpd_tls_security_level = may'
 +
postconf -e 'smtpd_tls_loglevel = 1'
 +
postconf -e 'smtpd_use_tls = yes'
 +
postconf -e 'smtpd_tls_key_file  = /etc/postfix/smtpd.key'
 +
postconf -e 'smtpd_tls_cert_file  = /etc/postfix/smtpd.cert'
 +
service postfix restart
 +
</syntaxhighlight>
 +
 
 +
สามารถทดสอบโดยการ telnet ไปยัง 25 และใช้คำสั่ง EHLO จะพบคำว่า STARTTLS
 +
<syntaxhighlight lang="bash">
 +
250-PIPELINING
 +
250-SIZE 10240000
 +
250-VRFY
 +
250-ETRN
 +
250-STARTTLS
 +
250-AUTH PLAIN LOGIN
 +
250-AUTH=PLAIN LOGIN
 +
250-ENHANCEDSTATUSCODES
 +
250-8BITMIME
 +
250-DSN
 +
250 SMTPUTF8
 +
</syntaxhighlight>
 +
 
 +
พิมพ์คำสั่งด้านล่าง
 +
<syntaxhighlight lang="bash">
 +
STARTTLS
 +
</syntaxhighlight>
 +
 
 +
ปรากฎผลลัพธ์ดังนี้
 +
<syntaxhighlight lang="bash">
 +
220 2.0.0 Ready to start TLS
 +
</syntaxhighlight>
 +
 
 +
== การส่งและรับ email จากอินเทอร์เน็ต  ==
 +
 
 +
*หมายเหตุ การติดตั้ง mail ผ่าน command line อาจจะไปติดตั้งทับ Postfix ของคุณด้วย Postfix ตัวเก่ากว่า
 +
 
 +
การส่ง email ด้วย telnet
 +
<syntaxhighlight lang="bash">
 +
 
 +
telnet localhost 25
 +
EHLO localhost
 +
 
 +
MAIL FROM: <youruser@domain.tld> SMTPUTF8
 +
RCPT TO: <EAI@IDN.idn>
 +
data
 +
Subject: A Test
 +
 
 +
This is the body
 +
 
 +
.
 +
</syntaxhighlight>
 +
 
 +
ใช้เครื่องหมาย "." เพื่อจบข้อความและทำการส่งข้อความ
 +
<br/>
 +
<br/>
 +
ในส่วนนี้โปรดตรวจสอบให้แน่ใจว่าสามารถรับและส่ง mail ได้
 +
 
 +
สามารถส่งข้อความด้วย EAI address และตรวจสอบได้ที่ /var/mail/mail.log ใน log ด้านล่าง 
 +
<br/> หมายเหตุ: test@domain.tld คือ ผู้รับ local
 +
 
 +
<syntaxhighlight lang="bash">
 +
Aug  3 02:48:49 ip-172-31-21-209 postfix/local[21614]: 7EAD343550: to=<test@domain.tld>, relay=local, delay=0.62, delays=0.62/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
 +
Aug  3 02:48:49 ip-172-31-21-209 postfix/qmgr[21586]: 7EAD343550: removed
 +
</syntaxhighlight>
 +
 
 +
email จะถูกจัดเก็บไว้ที่ /var/mail/
 +
 
 +
หากไม่ได้รับ email ให้ลองใช้เครื่องมือ online อื่น เช่น mxtoolbox.com เพื่อตรวจสอบปัญหาที่เกิดขึ้น
 +
 
 +
== การตั้งค่า Courier authlib, Courier IMAP==
 +
ขั้นตอนนี้จะทำการเปิดใช้งาน IMAP และ POP3
 +
 
 +
ติดตั้ง libtool ซึ่งจำเป็นสำหรับ authlib
 +
<syntaxhighlight lang="bash">
 +
yum install libtool-ltdl-devel.x86_64
 +
</syntaxhighlight>
 +
 
 +
ติดตั้ง Courier Unicode Library 1.2 ซึ่งสามารถดาวน์โหลดได้จาก http://sourceforge.net/projects/courier/files/courier-unicode 
 +
<syntaxhighlight lang="bash">
 +
tar -jxvf courier-unicode-1.2.tar.bz2
 +
cd courier-unicode-1.2
 +
./configure
 +
make
 +
make install
 +
</syntaxhighlight>
 +
 
 +
ดาวน์โหลด authlib ได้จาก http://sourceforge.net/projects/courier/files/authlib/ เวอร์ชั่นล่าสุดคือ 0.66.3
 +
 
 +
<syntaxhighlight lang="bash">
 +
tar -jxvf courier-authlib-0.66.3.tar.bz2
 +
cd courier-authlib-0.66.3
 +
./configure --with-authshadow --with-mailuser=postfix --with-mailgroup=postfix
 +
make
 +
make install
 +
make install-configure
 +
</syntaxhighlight>
 +
 
 +
แก้ไขไฟล์ ''/usr/local/etc/authlib/authdaemonrc'' และเปลี่ยนค่า authentication method
 +
<syntaxhighlight lang="bash">
 +
authmodulelist="authshadow"
 +
</syntaxhighlight>
 +
 
 +
 
 +
แก้ไขไฟล์ ''/etc/ld.so.conf.d/locallibs.conf'' และเพิ่ม
 +
<syntaxhighlight lang="bash">
 +
/usr/local/lib
 +
</syntaxhighlight>
 +
 
 +
 
 +
นำค่าที่ปรับเปลี่ยนไปใช้งาน
 +
<syntaxhighlight lang="bash">
 +
ldconfig
 +
</syntaxhighlight>
 +
 
 +
ต่อจากนั้นให้ Start
 +
<syntaxhighlight lang="bash">
 +
/usr/local/sbin/authdaemond  start
 +
</syntaxhighlight>
 +
 
 +
ตรวจสอบว่าโปรแกรมทำงานอยู่หรือไม่
 +
<syntaxhighlight lang="bash">
 +
ps -ef |grep authdaemond
 +
</syntaxhighlight>
 +
 
 +
ควรจะแสดงค่าดังต่อไปนี้
 +
<syntaxhighlight lang="bash">
 +
26393 26392  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 +
26394 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 +
26395 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 +
26396 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 +
26397 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 +
26398 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 +
</syntaxhighlight>
 +
 
 +
 
 +
หมายเหตุ: '''คุณจะต้องเปลี่ยนเป็น user ปกติที่ไม่ใช่ root''' (สร้าง user ใหม่ถ้าคุณยังไม่เคยสร้าง user ไว้)
 +
 
 +
ติดตั้ง courier imap ซึ่งจะรองรับทั้ง IMAP และ POP3
 +
 
 +
ดาวน์โหลดได้จาก http://sourceforge.net/projects/courier/files/imap
 +
 
 +
<syntaxhighlight lang="bash">
 +
tar -jxvf courier-imap-4.16.2.tar.bz2
 +
cd courier-imap-4.16.2
 +
./configure
 +
make
 +
</syntaxhighlight>
 +
 
 +
จากตรงนี้ คุณสามารถกลับไปใช้ root ถ้าคุณไม่ต้องการใช้คำสั่ง sudo
 +
<syntaxhighlight lang="bash">
 +
sudo make install
 +
sudo make install-configure
 +
cd /usr/lib/courier-imap/libexec
 +
./pop3d.rc start
 +
</syntaxhighlight>
 +
 
 +
ตรวจสอบว่า imap ทำงานอยู่หรือไม่
 +
<syntaxhighlight lang="bash">
 +
netstat -ntlp | grep 110
 +
</syntaxhighlight>
 +
 
 +
'''การเปิดใช้งาน SSL ด้วย self signed certificate'''
 +
 
 +
<syntaxhighlight lang="bash">
 +
cd /usr/lib/courier-imap/etc
 +
vi pop3d.cnf
 +
</syntaxhighlight>
 +
 
 +
 
 +
ปรับเปลี่ยนได้ตามต้องการจากนั้นให้ save และ quit
 +
<syntaxhighlight lang="vim">
 +
[ req_dn ]
 +
C=US
 +
ST=NY
 +
L=New York
 +
O=Courier Mail Server
 +
OU=Automatically-generated POP3 SSL key
 +
CN=localhost
 +
emailAddress=postmaster@example.com
 +
</syntaxhighlight>
 +
 
 +
ต่อไปให้สร้าง certificates
 +
<syntaxhighlight lang="bash">
 +
cd ../share
 +
./mkpop3dcert
 +
</syntaxhighlight>
 +
 
 +
ตอนนี้คุณสามารถ run pop ด้วย ssl และ listen ที่พอร์ต 995
 +
<syntaxhighlight lang="bash">
 +
cd /usr/lib/courier-imap/libexec
 +
./pop3d-ssl.rc start
 +
netstat -tulpn |grep 995
 +
</syntaxhighlight>
 +
 
 +
ขั้นตอนสุดท้ายเปิดการใช้งาน  pop3 และ pop3s ที่ init
 +
<syntaxhighlight lang="bash">
 +
@TODO
 +
</syntaxhighlight>
 +
 
 +
ต่อด้วย Imap
 +
 
 +
<syntaxhighlight lang="bash">
 +
/usr/lib/courier-imap/libexec/imapd.rc start
 +
netstat -ntlp | grep 143
 +
</syntaxhighlight>
 +
 
 +
 
 +
แก้ไขไฟล์ ''/usr/lib/courier-imap/etc/imapd'' เปลี่ยน '''IMAPDSTART=NO'''  เป็น
 +
<syntaxhighlight lang="vim">
 +
IMAPDSTART=yes
 +
</syntaxhighlight>
 +
 
 +
เปิดการใช้งาน imap SSL โดยใช้ self generated certificates
 +
 
 +
แก้ไขไฟล์ ''/usr/lib/courier-imap/etc/imapd.cnf''  และแก้ไขค่าให้สอดคล้องกันจากนั้นให้สร้าง certs
 +
<syntaxhighlight lang="vim">
 +
/usr/lib/courier-imap/share/mkimapdcert
 +
</syntaxhighlight>
 +
 
 +
ต่อไป start และ ตรวจสอบ imap-ssl
 +
<syntaxhighlight lang="bash">
 +
/usr/lib/courier-imap/libexec/imapd-ssl.rc start
 +
netstat -ntlp |grep 993
 +
</syntaxhighlight>
 +
 
 +
 
 +
ขั้นตอนสุดท้ายเปิดใช้งานที่ startup
 +
<syntaxhighlight lang="bash">
 +
@TODO
 +
</syntaxhighlight>
 +
 
 +
 
 +
ตั้งค่า Postfix ให้ใช้ Maildir เป็นที่เก็บ Mail
 +
<syntaxhighlight lang="bash">
 +
postconf -e 'home_mailbox = Maildir/'
 +
postfix reload
 +
</syntaxhighlight>
 +
 
 +
ปรับเปลี่ยน Skeleton และสร้างโฟลเดอร์สำหรับผู้ใช้งานที่เราสร้างขึ้นก่อนหน้านี้ จากในตัวอย่างเราใช้ชื่อผู้ใช้งาน test
 +
<syntaxhighlight lang="bash">
 +
mkdir -p /etc/skel/Maildir/{cur,new,tmp}
 +
 
 +
mkdir -p /home/test/Maildir/{cur,new,tmp}
 +
chown test.test /home/test/Maildir/{,cur,new,tmp}
 +
chmod 0700 /home/test/Maildir/{,cur,new,tmp}
 +
</syntaxhighlight>
 +
 
 +
== ทดสอบ IMAP และ POP3 ==
 +
 
 +
<syntaxhighlight lang="bash">
 +
telnet localhost imap
 +
ok login username password
 +
</syntaxhighlight>
 +
 
 +
 
 +
<syntaxhighlight lang="bash">
 +
telnet localhost pop3
 +
User username
 +
Pass password
 +
</syntaxhighlight>
 +
 
 +
== เปิด Firewall ==
 +
 
 +
<syntaxhighlight lang="bash">
 +
firewall-cmd --zone=public --add-port=995/tcp --permanent
 +
firewall-cmd --zone=public --add-port=110/tcp --permanent
 +
firewall-cmd --zone=public --add-port=143/tcp --permanent
 +
firewall-cmd --zone=public --add-port=25/tcp --permanent
 +
firewall-cmd --reload
 +
</syntaxhighlight>
 +
 
 +
== ติดตั้ง Squirrel-mail ==
 +
 
 +
Make sure you have apache and php installed.
 +
 
 +
ติดตั้งและแก้ไข Squirrel mail
 +
<syntaxhighlight lang="bash">
 +
cd to-your-public-html-folder
 +
wget http://interlab.ait.ac.th/eai-wiki/files/squirrelmail.zip
 +
unzip squirrelmail.zip
 +
</syntaxhighlight>
 +
 
 +
แก้ไขไฟล์ config และเปลี่ยนค่า '''attachchment_dir''' และ '''data_dir''' โดยอย่าลืมสร้างโฟลเดอร์
 +
เปลี่ยน ownership เป็น '''apache user''' ของคุณและอนุญาติให้สามารถทำการเขียนได้
 +
 
 +
<syntaxhighlight lang="bash">
 +
vi squirrelmail/config/config.php
 +
</syntaxhighlight>
 +
 +
การเข้าถึง squirrelmail
 +
<syntaxhighlight lang="bash">
 +
http://your-domain/squirrelmail/
 +
</syntaxhighlight >
 +
 
 +
== ลิงค์ที่เกี่ยวข้อง ==
 +
Mail server จะไม่รับและส่ง email จากภายนอก
 +
 
 +
== แหล่งที่มา ==
 +
 
 +
http://postfix.org/

รุ่นแก้ไขเมื่อ 14:39, 2 พฤศจิกายน 2560

การติดตั้ง Postfix สำหรับการเปิดใช้งาน SMTPUTF8, Cyrus SASL และ OpenSSL

สรุปสาระสำคัญของ mail server

คู่มือนี้ใช้สำหรับการติดตั้ง mail server ที่สามารถรับ mail ที่เป็น SMTPUTF8 ได้ นอกจากนี้ยังป้องการการตีกลับของอีเมลหากผู้ส่งส่งไปยัง mail server

ที่ไม่รองรับ SMTPUTF8 รวมถึง IMAP และ POP3 ที่ใช้ Courier ด้วย ผู้ใช้จะถูกเพิ่มเป็น local user ถึงแม้ว่าจะ login ผ่าน SSH หรือไม่ก็ตาม mail ทั้งหมดจะถูกเก็บไว้ที่ /home/user

Squirrel-mail ที่ถูกแก้ไขนี้จะถูกติดตั้งในการส่งและรับ email (จะต้องมีการทดสอบ)

email client สามารถนำมาใช้ได้ โดยใช้ username ที่ไม่ได้เป็น EAI address

ใช้ Centos 7, 64 Bit

  • ไม่ได้ทดสอบบน Centos 5 กับ Centos 6 ซึ่งอาจจะใช้งานไม่ได้

คุณสามารถติดตั้งด้วย root ไม่เช่นนั้นให้ระบุเป็น non privileged user

ข้อสังเกต ความต้องการและการตั้งค่าเริ่มต้น

  • Centos 7 (64 bit) แบบ minimal installation
  • Centos 7 มาพร้อมกับการติดตั้ง postfix 2.x
  • คู่มือนี้สมมติว่าคุณติดตั้งด้วย root เว้นแต่จะระบุไว้เป็นอย่างอื่น
  • DNS ของคุณต้องติดตั้งให้พร้อมก่อนการตั้งค่า
  • hostname คือ ชื่อโดเมนของคุณ เช่น domain.com
  • mail.hostname คือ ชื่อ Mail server ของคุณ เช่น mail.domain.com
แก้ไข hostname 

ถ้าคุณใช้ international domain ให้คุณใช้ในรูปแบบ punycode

ตัวอย่าง: mail.วีคลาส.ไทย punycode equivalent ควรจะเป็น mail.xn--42c0eeo3bp.xn--o3cw4h

vi /etc/hostname

แก้ไขเป็นชื่อ hostname ที่คุณต้องการ

mail.domain.com


ปิดและเปิด server ใหม่ เพื่อปรับปรุง hostname

หลังจากปิดและเปิด server ใหม่แล้ว ให้ใช้คำสั่งต่อไปนี้จะแสดง hostname เพื่อดูว่า hostname เปลี่ยนแล้ว

hostname

ติดตั้ง Postfix จาก source และ libraries ที่จำเป็น (Cyrus SASL, OPENSSL)

ใช้คำสั่ง get เพื่อดาวน์โหลด Postfix เวอร์ชั่น 3.0.1 หรือเวอร์ชั่นที่ใหม่กว่าเพื่อเปิดใช้งาน SMTPUTF8 คุณสามารถโหลดได้จาก http://www.postfix.org/download.html ในตัวอย่างด้านล่าง เราดาวน์โหลด postfix-3.0.1.tar.gz เวอร์ชั่นของคุณอาจจะแตกต่างออกไป ขณะนี้การติดตั้ง Postfix ด้วย apt-get นั้นจะทำการติดตั้ง Postfix เวอร์ชั่นเก่าที่ยังไม่รองรับ SMTPUTF8 ซึ่งอาจจะมีการเปลี่ยนแปลงในภายหลัง

ติดตั้ง libraries และ tools ที่จำเป็น

yum groupinstall development tools
yum install cyrus-sasl cyrus-sasl-devel openssl openssl-devel libdb-devel.x86_64 libicu-devel telnet net-tools

ดาวน์โหลด Postfix 3.0.1 หรือเวอร์ชั่นที่ใหม่กว่า

tar -xzvf postfix-3.0.1.tar.gz
cd postfix-3.0.1
sed -i 's/.\x08//g' README_FILES/*

Compile ด้วย openssl และ sasl auth

make makefiles CCARGS='-DUSE_TLS -I/usr/include/openssl  -DUSE_SASL_AUTH -DUSE_CYRUS_SASL  -I/usr/include/sasl '   AUXLIBS='-L/usr/lib64  -L/usr/lib64/openssl -L/usr/lib64/sasl2 -lssl -lcrypto -lsasl2'
make

หมายเหตุ: ถ้าคุณใช้ OS ที่เป็น 32Bit OS ให้แทนที่ /lib64 ด้วย /lib


ติดตั้ง Postfix

make upgrade

คุณสามารถนำไฟล์การตั้งค่าที่ไม่ได้ใช้ออกไป ซึ่งจะแสดงในส่วนสุดท้ายของการติดตั้ง

การตั้งค่า Postfix

สร้าง Mails Alias สำหรับ root หรือ postmaster เพื่อส่งไปยังผู้ใช้งานจริง (YourLogin)
หมายเหตุ: ขั้นตอนนี้เป็นทางเลือกเนื่องจาก Centos 7 ได้เติมไว้ให้แล้ว

vi /etc/aliases

copy และ paste ตัว code ด้านล่าง โดยเปลี่ยน YourLogin เป็น user ของคุณเองแล้วทำการ save และ quit

MAILER-DAEMON:    postmaster
postmaster:       root
root:             YourLogin

ต่อจากนั้น

newaliases


แก้ไข mail.domain.tld, domain.tld, yourotherdomain.tld (yourotherdomain.tld ไม่จำเป็นต้องใส่ก็ได้)

postconf compatibility_level=2
postconf -e 'myhostname  = mail.domain.tld'
postconf -e 'mydomain    = domain.tld'
postconf -e 'myorigin    = $mydomain'
postconf -e 'inet_interfaces = all'
postconf -e 'mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24'
postconf -e 'alias_database = hash:/etc/aliases'
postconf -e 'alias_maps = hash:/etc/aliases'
postconf -e 'mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, yourotherdomain.tld'
postconf -e 'smtputf8_enable = yes'


ขั้นตอนสุดท้าย start Postfix ในครั้งแรก

service postfix restart


ลองใช้งานและส่ง mail โดยใช้ Telnet ส่ง mail ไปยัง server อื่นๆ เช่น gmail

ทดสอบว่าคุณมีการเปิดการใช้งาน SMTPUTF8 หรือไม่

ป้อนคำสั่งในหน้า console ซึ่งคำสั่งจะทำการเชื่อมต่อไปยัง SMTP

 telnet localhost 25

ควรจะแสดงผลลัพธ์ดังนี้

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 YourHostName ESMTP Postfix


พิมพ์คำสั่งด้านล่างแล้วกด enter

EHLO localhost


เมื่อพบว่ามี 250 SMTPUTF8 อยู่ แสดงว่า server ของคุณ สามารถรับและส่ง mail จากที่อยู่ email สากลได้

250-YourHostName
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 SMTPUTF8


หากไม่พบ 250 SMTPUTF8 ให้ลองเอา Postfix ออกและลองใหม่อีกครั้ง เพราะอาจจะมีการติดตั้งส่วนเสริม software ของ Postfix ที่เป็นตัวเก่าเหลืออยู่

เปิดใช้งาน SMTP Auth

yum install  cyrus-sasl-plain


แก้ไขไฟล์ /etc/sasl2/smtpd.conf

pwcheck_method: saslauthd
mech_list: PLAIN LOGIN


ปรับปรุงการตั้งค่า Postfix

postconf -e 'smtpd_sasl_path = smtpd'
postconf -e 'smtpd_sasl_auth_enable = yes'
service saslauthd start
postfix reload


สร้าง user ที่เราสามารถทดสอบการ authentication ได้ แทนที่ AnyUserName ด้วย user ของคุณ

useradd -m AnyUserName  -s /usr/sbin/nologin
passwd AnyUserName


สร้าง Auth key ของคุณ แทนที่ username ด้วย username ของคุณ และแทนที่ password ด้วย password ของคุณ

perl -MMIME::Base64 -e 'print encode_base64("username\0username\0password");'


แทนที่ dGVzdAB0ZXN0AHRlc3Q= ด้วย key ที่คุณสร้างขึ้น

	
telnet 	localhost 25
EHLO localhost
AUTH PLAIN dGVzdAB0ZXN0AHRlc3Q=


คุณควรจะได้รับข้อความว่า Authentication successful


จบการตั้งค่า Postfix ด้วยการอนุญาติให้เฉพาะผู้ใช้ที่ทำการ authenticate ทำการส่งไปยัง SMTP ได้

postconf -e 'broken_sasl_auth_clients = yes'
postconf -e 'smtpd_sasl_security_options = noanonymous'
postconf -e 'smtpd_sasl_local_domain = $mydomain'
postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination'
postconf -e 'smtpd_relay_restrictions =  permit_mynetworks permit_sasl_authenticated reject_unauth_destination reject_sender_login_mismatch'

เปิดใช้งาน TLS

สร้าง certificates

cd /etc/postfix

openssl req -new -outform PEM -out smtpd.cert \
   -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM \
   -days 365 -x509

ตอบคำถามต่อไปนี้เมื่อได้รับแจ้ง


ปรับปรุงการตั้งค่า Postfix

postconf -e 'smtpd_enforce_tls = no'
postconf -e 'smtpd_tls_security_level = may'
postconf -e 'smtpd_tls_loglevel = 1'
postconf -e 'smtpd_use_tls = yes'
postconf -e 'smtpd_tls_key_file  = /etc/postfix/smtpd.key'
postconf -e 'smtpd_tls_cert_file  = /etc/postfix/smtpd.cert'
service postfix restart

สามารถทดสอบโดยการ telnet ไปยัง 25 และใช้คำสั่ง EHLO จะพบคำว่า STARTTLS

250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 SMTPUTF8

พิมพ์คำสั่งด้านล่าง

STARTTLS

ปรากฎผลลัพธ์ดังนี้

220 2.0.0 Ready to start TLS

การส่งและรับ email จากอินเทอร์เน็ต

  • หมายเหตุ การติดตั้ง mail ผ่าน command line อาจจะไปติดตั้งทับ Postfix ของคุณด้วย Postfix ตัวเก่ากว่า

การส่ง email ด้วย telnet

telnet localhost 25
EHLO localhost

MAIL FROM: <youruser@domain.tld> SMTPUTF8
RCPT TO: <EAI@IDN.idn>
data
Subject: A Test

This is the body

.

ใช้เครื่องหมาย "." เพื่อจบข้อความและทำการส่งข้อความ

ในส่วนนี้โปรดตรวจสอบให้แน่ใจว่าสามารถรับและส่ง mail ได้

สามารถส่งข้อความด้วย EAI address และตรวจสอบได้ที่ /var/mail/mail.log ใน log ด้านล่าง
หมายเหตุ: test@domain.tld คือ ผู้รับ local

Aug  3 02:48:49 ip-172-31-21-209 postfix/local[21614]: 7EAD343550: to=<test@domain.tld>, relay=local, delay=0.62, delays=0.62/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Aug  3 02:48:49 ip-172-31-21-209 postfix/qmgr[21586]: 7EAD343550: removed

email จะถูกจัดเก็บไว้ที่ /var/mail/

หากไม่ได้รับ email ให้ลองใช้เครื่องมือ online อื่น เช่น mxtoolbox.com เพื่อตรวจสอบปัญหาที่เกิดขึ้น

การตั้งค่า Courier authlib, Courier IMAP

ขั้นตอนนี้จะทำการเปิดใช้งาน IMAP และ POP3

ติดตั้ง libtool ซึ่งจำเป็นสำหรับ authlib

yum install libtool-ltdl-devel.x86_64

ติดตั้ง Courier Unicode Library 1.2 ซึ่งสามารถดาวน์โหลดได้จาก http://sourceforge.net/projects/courier/files/courier-unicode

tar -jxvf courier-unicode-1.2.tar.bz2
cd courier-unicode-1.2
./configure
make 
make install

ดาวน์โหลด authlib ได้จาก http://sourceforge.net/projects/courier/files/authlib/ เวอร์ชั่นล่าสุดคือ 0.66.3

tar -jxvf courier-authlib-0.66.3.tar.bz2
cd courier-authlib-0.66.3
./configure --with-authshadow --with-mailuser=postfix --with-mailgroup=postfix
make 
make install
make install-configure

แก้ไขไฟล์ /usr/local/etc/authlib/authdaemonrc และเปลี่ยนค่า authentication method

authmodulelist="authshadow"


แก้ไขไฟล์ /etc/ld.so.conf.d/locallibs.conf และเพิ่ม

/usr/local/lib


นำค่าที่ปรับเปลี่ยนไปใช้งาน

ldconfig

ต่อจากนั้นให้ Start

/usr/local/sbin/authdaemond  start

ตรวจสอบว่าโปรแกรมทำงานอยู่หรือไม่

ps -ef |grep authdaemond

ควรจะแสดงค่าดังต่อไปนี้

 26393 26392  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 26394 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 26395 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 26396 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 26397 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond
 26398 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond


หมายเหตุ: คุณจะต้องเปลี่ยนเป็น user ปกติที่ไม่ใช่ root (สร้าง user ใหม่ถ้าคุณยังไม่เคยสร้าง user ไว้)

ติดตั้ง courier imap ซึ่งจะรองรับทั้ง IMAP และ POP3

ดาวน์โหลดได้จาก http://sourceforge.net/projects/courier/files/imap

tar -jxvf courier-imap-4.16.2.tar.bz2
cd courier-imap-4.16.2
./configure
make

จากตรงนี้ คุณสามารถกลับไปใช้ root ถ้าคุณไม่ต้องการใช้คำสั่ง sudo

sudo make install
sudo make install-configure
cd /usr/lib/courier-imap/libexec
./pop3d.rc start

ตรวจสอบว่า imap ทำงานอยู่หรือไม่

netstat -ntlp | grep 110

การเปิดใช้งาน SSL ด้วย self signed certificate

cd /usr/lib/courier-imap/etc
vi pop3d.cnf


ปรับเปลี่ยนได้ตามต้องการจากนั้นให้ save และ quit

[ req_dn ]
C=US
ST=NY
L=New York
O=Courier Mail Server
OU=Automatically-generated POP3 SSL key
CN=localhost
emailAddress=postmaster@example.com

ต่อไปให้สร้าง certificates

 cd ../share
 ./mkpop3dcert

ตอนนี้คุณสามารถ run pop ด้วย ssl และ listen ที่พอร์ต 995

cd /usr/lib/courier-imap/libexec
./pop3d-ssl.rc start
netstat -tulpn |grep 995

ขั้นตอนสุดท้ายเปิดการใช้งาน pop3 และ pop3s ที่ init

@TODO

ต่อด้วย Imap

/usr/lib/courier-imap/libexec/imapd.rc start
netstat -ntlp | grep 143


แก้ไขไฟล์ /usr/lib/courier-imap/etc/imapd เปลี่ยน IMAPDSTART=NO เป็น

IMAPDSTART=yes

เปิดการใช้งาน imap SSL โดยใช้ self generated certificates

แก้ไขไฟล์ /usr/lib/courier-imap/etc/imapd.cnf และแก้ไขค่าให้สอดคล้องกันจากนั้นให้สร้าง certs

 /usr/lib/courier-imap/share/mkimapdcert

ต่อไป start และ ตรวจสอบ imap-ssl

/usr/lib/courier-imap/libexec/imapd-ssl.rc start
netstat -ntlp |grep 993


ขั้นตอนสุดท้ายเปิดใช้งานที่ startup

@TODO


ตั้งค่า Postfix ให้ใช้ Maildir เป็นที่เก็บ Mail

postconf -e 'home_mailbox = Maildir/'
postfix reload

ปรับเปลี่ยน Skeleton และสร้างโฟลเดอร์สำหรับผู้ใช้งานที่เราสร้างขึ้นก่อนหน้านี้ จากในตัวอย่างเราใช้ชื่อผู้ใช้งาน test

mkdir -p /etc/skel/Maildir/{cur,new,tmp}

mkdir -p /home/test/Maildir/{cur,new,tmp}
chown test.test /home/test/Maildir/{,cur,new,tmp}
chmod 0700 /home/test/Maildir/{,cur,new,tmp}

ทดสอบ IMAP และ POP3

telnet localhost imap
ok login username password


telnet localhost pop3
User username
Pass password

เปิด Firewall

firewall-cmd --zone=public --add-port=995/tcp --permanent
firewall-cmd --zone=public --add-port=110/tcp --permanent
firewall-cmd --zone=public --add-port=143/tcp --permanent
firewall-cmd --zone=public --add-port=25/tcp --permanent
firewall-cmd --reload

ติดตั้ง Squirrel-mail

Make sure you have apache and php installed.

ติดตั้งและแก้ไข Squirrel mail

cd to-your-public-html-folder
wget http://interlab.ait.ac.th/eai-wiki/files/squirrelmail.zip
unzip squirrelmail.zip

แก้ไขไฟล์ config และเปลี่ยนค่า attachchment_dir และ data_dir โดยอย่าลืมสร้างโฟลเดอร์ เปลี่ยน ownership เป็น apache user ของคุณและอนุญาติให้สามารถทำการเขียนได้

vi squirrelmail/config/config.php

การเข้าถึง squirrelmail

http://your-domain/squirrelmail/

ลิงค์ที่เกี่ยวข้อง

Mail server จะไม่รับและส่ง email จากภายนอก

แหล่งที่มา

http://postfix.org/