diff --git a/scripts/mail.sh b/scripts/mail.sh index 3cde01e..00cc783 100755 --- a/scripts/mail.sh +++ b/scripts/mail.sh @@ -111,11 +111,18 @@ EOF sed -i "s/#port = 143/port = 0/" /etc/dovecot/conf.d/10-master.conf sed -i "s/#port = 110/port = 0/" /etc/dovecot/conf.d/10-master.conf -# Create a Unix domain socket specific for postgres to connect via LMTP because -# postgres is already configured to use this location, and create a TCP socket +# Create a Unix domain socket specific for postgres for auth and LMTP because +# postgres is more easily configured to use these locations, and create a TCP socket # for spampd to inject mail on (if it's configured later). dovecot's standard # lmtp unix socket is also listening. cat > /etc/dovecot/conf.d/99-local.conf << EOF; +service auth { + unix_listener /var/spool/postfix/private/auth { + mode = 0666 + user = postfix + group = postfix + } +} service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { user = postfix diff --git a/scripts/spamassassin.sh b/scripts/spamassassin.sh index 6a8ebc4..2f19ee9 100644 --- a/scripts/spamassassin.sh +++ b/scripts/spamassassin.sh @@ -1,6 +1,6 @@ # Spam filtering with spamassassin via spampd. -apt-get -q -y install spampd dovecot-antispam +apt-get -q -y install spampd dovecot-sieve dovecot-antispam # Hook into postfix. Replace dovecot with spampd as the mail delivery agent. tools/editconf.py /etc/postfix/main.cf virtual_transport=lmtp:[127.0.0.1]:10025 diff --git a/scripts/start.sh b/scripts/start.sh index 2afd372..2fed598 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -48,3 +48,5 @@ EOF . scripts/dns_update.sh . scripts/add_mail_user.sh . scripts/users_update.sh +. scripts/web.sh + diff --git a/tests/imap.py b/tests/imap.py old mode 100644 new mode 100755 index af3442a..167a1b5 --- a/tests/imap.py +++ b/tests/imap.py @@ -1,11 +1,16 @@ -import imaplib, os +#!/usr/bin/python3 +import imaplib, sys -username = "testuser@" + os.environ.get("DOMAIN", "testdomain.com") +if len(sys.argv) < 3: + print("Usage: tests/imap.py host username password") + sys.exit(1) -M = imaplib.IMAP4_SSL(os.environ["INSTANCE_IP"]) -M.login(username, "testpw") -M.select() +host, username, pw = sys.argv[1:4] + +M = imaplib.IMAP4_SSL(host) +M.login(username, pw) print("Login successful.") +M.select() typ, data = M.search(None, 'ALL') for num in data[0].split(): typ, data = M.fetch(num, '(RFC822)') diff --git a/tests/smtp_submission.py b/tests/smtp_submission.py old mode 100644 new mode 100755 index ba3f0b0..e2cf455 --- a/tests/smtp_submission.py +++ b/tests/smtp_submission.py @@ -1,16 +1,22 @@ -import smtplib, sys, os +#!/usr/bin/python3 +import smtplib, sys -fromaddr = "testuser@" + os.environ.get("DOMAIN", "testdomain.com") +if len(sys.argv) < 3: + print("Usage: tests/smtp_submission.py host email.from pw email.to") + sys.exit(1) +host, fromaddr, pw, toaddr = sys.argv[1:5] msg = """From: %s To: %s +Subject: SMTP server test -This is a test message.""" % (fromaddr, sys.argv[1]) +This is a test message.""" % (fromaddr, toaddr) -server = smtplib.SMTP(os.environ["INSTANCE_IP"], 587) +server = smtplib.SMTP(host, 587) server.set_debuglevel(1) server.starttls() -server.login(fromaddr, "testpw") -server.sendmail(fromaddr, [sys.argv[1]], msg) +server.login(fromaddr, pw) +server.sendmail(fromaddr, [toaddr], msg) server.quit() +