|
|
| บรรทัดที่ 1: |
บรรทัดที่ 1: |
| สร้าง directories และติดตั้ง libraries ที่จำเป็น
| |
| <syntaxhighlight lang="bash">
| |
| sudo apt-get update
| |
| sudo apt-get install courier-imap courier-imap-ssl courier-pop courier-pop-ssl icu-devtools libicu-dev libsasl2-dev libssl-dev libsasl2-modules sasl2-bin
| |
| sudo mkdir -p /etc/skel/Maildir/{cur,new,tmp}
| |
| sudo apt-get build-dep postfix
| |
| </syntaxhighlight >
| |
| ตอบ:
| |
| Web Admin - No
| |
| Internet Site
| |
|
| |
|
| ดาวน์โหลดและสร้าง postfix-3.x
| |
| <syntaxhighlight lang="bash">
| |
| tar -xzvf postfix-3.0.2.tar.gz
| |
| cd postfix-3.0.2
| |
| sed -i 's/.\x08//g' README_FILES/*
| |
|
| |
| make CCARGS="-DUSE_TLS -I/usr/include/openssl/ \
| |
| -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl" \
| |
| AUXLIBS="-lssl -lcrypto -lsasl2" makefiles && make
| |
|
| |
|
| |
| sudo sh postfix-install -non-interactive daemon_directory=/usr/lib/postfix \
| |
| manpage_directory=/usr/share/man \
| |
| html_directory=/usr/share/doc/postfix-3.0.1/html \
| |
| readme_directory=/usr/share/doc/postfix-3.0.1/readme
| |
| </syntaxhighlight >
| |
|
| |
|
| |
| การตั้งค่า SASL
| |
| <syntaxhighlight lang="bash">
| |
| sudo cp /etc/default/saslauthd /etc/default/saslauthd-postfix
| |
| </syntaxhighlight >
| |
|
| |
| แก้ไขไฟล์ '''/etc/default/saslauthd-postfix''' โดยกำหนดตัวแปลต่อไปนี้ START, NAME และ OPTIONS
| |
| <syntaxhighlight lang="bash">
| |
| START=yes
| |
| DESC="SASL Auth. Daemon for Postfix"
| |
| NAME="saslauthd-postf" # max. 15 char.
| |
| # Option -m sets working dir for saslauthd (contains socket)
| |
| OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd" # postfix/smtp in chroot()
| |
| </syntaxhighlight >
| |
|
| |
|
| |
| <syntaxhighlight lang="bash">
| |
| sudo rm -rf /run/saslauthd
| |
| sudo ln -s /var/spool/postfix/var/run/saslauthd /run/saslauthd
| |
| sudo dpkg-statoverride --add root sasl 710 /var/spool/postfix/var/run/saslauthd
| |
| sudo adduser postfix sasl
| |
| cd /etc/pam.d
| |
| sudo cp other smtp
| |
| sudo mkdir /etc/sasl2
| |
| </syntaxhighlight >
| |
|
| |
| แก้ไข หรือ สร้างไฟล์ '''/etc/sasl2/smtpd.conf'''
| |
| <syntaxhighlight lang="bash">
| |
| pwcheck_method: saslauthd
| |
| mech_list: PLAIN LOGIN
| |
| </syntaxhighlight >
| |
|
| |
| Restart SASLAUTHD
| |
| <syntaxhighlight lang="bash">
| |
| sudo service saslauthd restart
| |
| </syntaxhighlight >
| |
|
| |
|
| |
| ปรับปรุงการตั้งค่าของคุณและทำการ reload
| |
| <br/> หมายเหตุ: เปลียน SUB.YOURDOMAIN, YOURDOMAIN, YOUROTHERDOMAIN เป็นโดเมนของคุณ (YOUROTHERDOMAIN ไม่จำเป็นต้องใส่ก็ได้)
| |
| <syntaxhighlight lang="bash">
| |
| sudo postconf compatibility_level=2
| |
| sudo postconf -e 'myhostname = SUB.YOURDOMAIN'
| |
| sudo postconf -e 'mydomain = YOURDOMAIN'
| |
| sudo postconf -e 'myorigin = $mydomain'
| |
| sudo postconf -e 'inet_interfaces = all'
| |
| sudo postconf -e 'mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24'
| |
| sudo postconf -e 'alias_database = hash:/etc/aliases'
| |
| sudo postconf -e 'alias_maps = hash:/etc/aliases'
| |
| sudo postconf -e 'mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, YOUROTHERDOMAIN'
| |
| sudo postconf -e 'smtputf8_enable = yes'
| |
| sudo postconf -e 'smtpd_sasl_path = smtpd'
| |
| sudo postconf -e 'smtpd_sasl_auth_enable = yes'
| |
| sudo postconf -e 'broken_sasl_auth_clients = yes'
| |
| sudo postconf -e 'smtpd_sasl_security_options = noanonymous'
| |
| sudo postconf -e 'home_mailbox = Maildir/'
| |
| sudo postconf -e 'smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination reject_sender_login_mismatch'
| |
| sudo postfix reload
| |
| </syntaxhighlight >
| |