Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
bash script for installing postfix smtp on ubuntu 12.04 server
# 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}\/"/' /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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.