1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-22 07:17:05 +00:00

various fixes; rewrote test scripts

This commit is contained in:
Joshua Tauberer 2013-08-31 10:46:25 -04:00
parent 3839054b96
commit a1260b75fb
5 changed files with 34 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -48,3 +48,5 @@ EOF
. scripts/dns_update.sh
. scripts/add_mail_user.sh
. scripts/users_update.sh
. scripts/web.sh

15
tests/imap.py Normal file → Executable file
View File

@ -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)')

18
tests/smtp_submission.py Normal file → Executable file
View File

@ -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()