Skip to content

Instantly share code, notes, and snippets.

@richarddong
Created May 8, 2012 11:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save richarddong/2634350 to your computer and use it in GitHub Desktop.
Save richarddong/2634350 to your computer and use it in GitHub Desktop.
bash script for installing postfix smtp on ubuntu 12.04 server
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment