1 頁 (共 1 頁)

12.04 mail server

發表於 : 2014-08-22 10:34:31
yehlu
https://help.ubuntu.com/12.04/sample/po ... figuration

main.cf

代碼: 選擇全部

# See /usr/share/postfix/main.cf.dist for a commented, more complete
# version

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

myhostname = demo.demo.com.tw
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/hostname
mydestination = demo.com.tw, localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination

smtpd_tls_auth_only = no
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtp_tls_note_starttls_offer = yes
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
#smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
/etc/dovecot/auth.d/01-mail-stack-delivery.auth

代碼: 選擇全部

mechanisms = plain login
socket listen {
        client {
#                path = /var/spool/postfix/private/dovecot-auth
                path = /var/spool/postfix/private/auth
                mode = 0660
                user = postfix
                group = postfix
        }
}


Re: 12.04 mail server

發表於 : 2014-08-22 22:17:54
yehlu
https://gist.githubusercontent.com/rich ... ll-smtp.sh

代碼: 選擇全部

#!/bin/bash

# This script helps install postfix SMTP server and plain login authentication without TLS/SSL
#
# Tested on Ubuntu 12.04 Server

sudo aptitude -y install postfix sasl2-bin

sudo dpkg-reconfigure postfix

# sudo sed -ie 's/START=no/START=yes\nPWDIR="\/var\/spool\/postfix\/var\/run\/saslauthd"\nPARAMS="-m ${PWDIR}"\nPIDFILE="${PWDIR}\/saslauthd.pid"/' /etc/default/saslauthd

sudo sed -ie 's/START=no/START=yes/' /etc/default/saslauthd

# sudo sed -ie 's/MECHANISMS=.*$/MECHANISMS="shadow"/' /etc/default/saslauthd

sudo sed -ie 's/OPTIONS=.*$/OPTIONS="-c -m \/var\/spool\/postfix\/var\/run\/saslauthd"/' /etc/default/saslauthd

# delete:
# TLS parameters
# smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
# smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
# smtpd_use_tls=yes
# smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
# smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

sudo postconf -e 'home_mailbox = Maildir/'
sudo postconf -e 'smtpd_sasl_auth_enable = yes'
# sudo postconf -e 'broken_sasl_auth_clients = yes'

sudo sh -c "echo 'pwcheck_method: saslauthd\nmech_list: plain login' >> /etc/postfix/sasl/smtpd.conf"

sudo dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthd

sudo service postfix restart
sudo service saslauthd start