mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-04 01:55:29 +02:00
Check for account changes and reload (Closes: #552)
Restart the daemons when changes are made to 'postfix-account.cf' and/or 'postfix-virtual.cf'
This commit is contained in:
parent
e79ee435fb
commit
420e7741a1
17 changed files with 228 additions and 7 deletions
4
test/auth/added-imap-auth.txt
Normal file
4
test/auth/added-imap-auth.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
a1 LOGIN added@localhost.localdomain mypassword
|
||||
a3 EXAMINE INBOX
|
||||
a4 FETCH 1 BODY[]
|
||||
a5 LOGOUT
|
4
test/auth/added-pop3-auth.txt
Normal file
4
test/auth/added-pop3-auth.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
USER added@localhost.localdomain
|
||||
PASS mypassword
|
||||
LIST
|
||||
quit
|
4
test/auth/added-smtp-auth-login-wrong.txt
Normal file
4
test/auth/added-smtp-auth-login-wrong.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
EHLO mail
|
||||
AUTH LOGIN YWRkZWRAbG9jYWxob3N0LmxvY2FsZG9tYWlu
|
||||
Bn3JKisq4HQ2RO==
|
||||
QUIT
|
4
test/auth/added-smtp-auth-login.txt
Normal file
4
test/auth/added-smtp-auth-login.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
EHLO mail
|
||||
AUTH LOGIN YWRkZWRAbG9jYWxob3N0LmxvY2FsZG9tYWlu
|
||||
bXlwYXNzd29yZA==
|
||||
QUIT
|
3
test/auth/added-smtp-auth-plain-wrong.txt
Normal file
3
test/auth/added-smtp-auth-plain-wrong.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
EHLO mail
|
||||
AUTH PLAIN YWRkZWRAbG9jYWxob3N0LmxvY2FsZG9tYWluAGFkZGVkQGxvY2FsaG9zdC5sb2NhbGRvbWFpbgBCQURQQVNTV09SRA==
|
||||
QUIT
|
3
test/auth/added-smtp-auth-plain.txt
Normal file
3
test/auth/added-smtp-auth-plain.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
EHLO mail
|
||||
AUTH PLAIN YWRkZWRAbG9jYWxob3N0LmxvY2FsZG9tYWluAGFkZGVkQGxvY2FsaG9zdC5sb2NhbGRvbWFpbgBteXBhc3N3b3Jk
|
||||
QUIT
|
12
test/email-templates/existing-added.txt
Normal file
12
test/email-templates/existing-added.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
HELO mail.external.tld
|
||||
MAIL FROM: user@external.tld
|
||||
RCPT TO: added@localhost.localdomain
|
||||
DATA
|
||||
From: Docker Mail Server <dockermailserver@external.tld>
|
||||
To: Existing Local User <added@localhost.localdomain>
|
||||
Date: Sat, 22 May 2010 07:43:25 -0400
|
||||
Subject: Test Message
|
||||
This is a test mail.
|
||||
|
||||
.
|
||||
QUIT
|
|
@ -197,6 +197,11 @@ load 'test_helper/bats-assert/load'
|
|||
assert_success
|
||||
}
|
||||
|
||||
@test "checking imap: added user authentication works" {
|
||||
run docker exec mail /bin/sh -c "nc -w 1 0.0.0.0 143 < /tmp/docker-mailserver-test/auth/added-imap-auth.txt"
|
||||
assert_success
|
||||
}
|
||||
|
||||
#
|
||||
# pop
|
||||
#
|
||||
|
@ -211,6 +216,11 @@ load 'test_helper/bats-assert/load'
|
|||
assert_success
|
||||
}
|
||||
|
||||
@test "checking pop: added user authentication works" {
|
||||
run docker exec mail_pop3 /bin/sh -c "nc -w 1 0.0.0.0 110 < /tmp/docker-mailserver-test/auth/added-pop3-auth.txt"
|
||||
assert_success
|
||||
}
|
||||
|
||||
#
|
||||
# sasl
|
||||
#
|
||||
|
@ -264,10 +274,30 @@ load 'test_helper/bats-assert/load'
|
|||
assert_success
|
||||
}
|
||||
|
||||
@test "checking smtp: added user authentication works with good password (plain)" {
|
||||
run docker exec mail /bin/sh -c "nc -w 5 0.0.0.0 25 < /tmp/docker-mailserver-test/auth/added-smtp-auth-plain.txt | grep 'Authentication successful'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking smtp: added user authentication fails with wrong password (plain)" {
|
||||
run docker exec mail /bin/sh -c "nc -w 20 0.0.0.0 25 < /tmp/docker-mailserver-test/auth/added-smtp-auth-plain-wrong.txt | grep 'authentication failed'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking smtp: added user authentication works with good password (login)" {
|
||||
run docker exec mail /bin/sh -c "nc -w 5 0.0.0.0 25 < /tmp/docker-mailserver-test/auth/added-smtp-auth-login.txt | grep 'Authentication successful'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking smtp: added user authentication fails with wrong password (login)" {
|
||||
run docker exec mail /bin/sh -c "nc -w 20 0.0.0.0 25 < /tmp/docker-mailserver-test/auth/added-smtp-auth-login-wrong.txt | grep 'authentication failed'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking smtp: delivers mail to existing account" {
|
||||
run docker exec mail /bin/sh -c "grep 'postfix/lmtp' /var/log/mail/mail.log | grep 'status=sent' | grep ' Saved)' | wc -l"
|
||||
assert_success
|
||||
assert_output 9
|
||||
assert_output 10
|
||||
}
|
||||
|
||||
@test "checking smtp: delivers mail to existing alias" {
|
||||
|
@ -349,6 +379,7 @@ load 'test_helper/bats-assert/load'
|
|||
assert_success
|
||||
[ "${lines[0]}" = "user1@localhost.localdomain" ]
|
||||
[ "${lines[1]}" = "user2@otherdomain.tld" ]
|
||||
[ "${lines[2]}" = "added@localhost.localdomain" ]
|
||||
}
|
||||
|
||||
@test "checking accounts: user mail folders for user1" {
|
||||
|
@ -363,6 +394,12 @@ load 'test_helper/bats-assert/load'
|
|||
assert_output 7
|
||||
}
|
||||
|
||||
@test "checking accounts: user mail folders for added user" {
|
||||
run docker exec mail /bin/bash -c "ls -A /var/mail/localhost.localdomain/added | grep -E '.Drafts|.Sent|.Trash|cur|new|subscriptions|tmp' | wc -l"
|
||||
assert_success
|
||||
assert_output 7
|
||||
}
|
||||
|
||||
@test "checking accounts: comments are not parsed" {
|
||||
run docker exec mail /bin/bash -c "ls /var/mail | grep 'comment'"
|
||||
assert_failure
|
||||
|
@ -1315,7 +1352,7 @@ load 'test_helper/bats-assert/load'
|
|||
}
|
||||
|
||||
@test "checking restart of process: amavisd-new" {
|
||||
run docker exec mail /bin/bash -c "pkill amavi && sleep 10 && ps aux --forest | grep -v grep | grep '/usr/sbin/amavisd-new (master)'"
|
||||
run docker exec mail /bin/bash -c "pkill amavi && sleep 12 && ps aux --forest | grep -v grep | grep '/usr/sbin/amavisd-new (master)'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue