Fixed #159: postfix-accounts.cf now generated with script + fixed line endings using sed in start-mailserver.sh

This commit is contained in:
Thomas VIAL 2016-04-25 16:00:39 +02:00
parent f8268f641a
commit 9415c099cc
No known key found for this signature in database
GPG Key ID: 0394CEE552FAFEFC
6 changed files with 19 additions and 5 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
docker-compose.yml
.idea
test/config/empty/
test/config/postfix-accounts.cf

View File

@ -1,8 +1,8 @@
NAME = tvial/docker-mailserver:testing
all: build-no-cache run fixtures tests clean
all-fast: build run fixtures tests clean
no-build: run fixtures tests clean
all: build-no-cache generate-accounts run fixtures tests clean
all-fast: build generate-accounts run fixtures tests clean
no-build: generate-accounts run fixtures tests clean
build-no-cache:
docker build --no-cache -t $(NAME) .
@ -10,6 +10,10 @@ build-no-cache:
build:
docker build -t $(NAME) .
generate-accounts:
docker run --rm -e MAIL_USER=user1@localhost.localdomain -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s CRAM-MD5 -u $$MAIL_USER -p $$MAIL_PASS)"' > test/config/postfix-accounts.cf
docker run --rm -e MAIL_USER=user2@otherdomain.tld -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s CRAM-MD5 -u $$MAIL_USER -p $$MAIL_PASS)"' >> test/config/postfix-accounts.cf
run:
# Run containers
docker run -d --name mail \

View File

@ -9,6 +9,8 @@ die () {
# Users
#
if [ -f /tmp/docker-mailserver/postfix-accounts.cf ]; then
echo "Checking file line endings"
sed -i 's/\r//g' /tmp/docker-mailserver/postfix-accounts.cf
echo "Regenerating postfix 'vmailbox' and 'virtual' for given users"
echo "# WARNING: this file is auto-generated. Modify config/postfix-accounts.cf to edit user list." > /etc/postfix/vmailbox

View File

@ -0,0 +1,2 @@
user1@localhost.localdomain|{CRAM-MD5}de5924752ad74e36bc271a8dc7fad4b2d341f21f05382f20dedf1fdfbd5a1717
user2@otherdomain.tld|{CRAM-MD5}de5924752ad74e36bc271a8dc7fad4b2d341f21f05382f20dedf1fdfbd5a1717

View File

@ -1,2 +1,2 @@
user1@localhost.localdomain|{MD5-CRYPT}$1$agWCql3M$ATBimsiJ4EETYnG/yLWwr.
user2@otherdomain.tld|{MD5-CRYPT}$1$31q82qPz$vprzqppi3chSsK8SgWT8d/
user1@localhost.localdomain|{CRAM-MD5}de5924752ad74e36bc271a8dc7fad4b2d341f21f05382f20dedf1fdfbd5a1717
user2@otherdomain.tld|{CRAM-MD5}de5924752ad74e36bc271a8dc7fad4b2d341f21f05382f20dedf1fdfbd5a1717

View File

@ -174,6 +174,11 @@
# accounts
#
@test "checking accounts: generated 'postfix-accounts.cf' matches template" {
run diff test/config/example.postfix-accounts.cf test/config/postfix-accounts.cf
[ "$status" -eq 0 ]
}
@test "checking accounts: user accounts" {
run docker exec mail doveadm user '*'
[ "$status" -eq 0 ]