Merge pull request #160 from tomav/issue-159

Fixed #159: postfix-accounts.cf now generated with script + fixed lin…
This commit is contained in:
Thomas VIAL 2016-04-25 16:14:11 +02:00
commit e8d4cc815b
6 changed files with 19 additions and 5 deletions

1
.gitignore vendored
View file

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

View file

@ -1,8 +1,8 @@
NAME = tvial/docker-mailserver:testing NAME = tvial/docker-mailserver:testing
all: build-no-cache run fixtures tests clean all: build-no-cache generate-accounts run fixtures tests clean
all-fast: build run fixtures tests clean all-fast: build generate-accounts run fixtures tests clean
no-build: run fixtures tests clean no-build: generate-accounts run fixtures tests clean
build-no-cache: build-no-cache:
docker build --no-cache -t $(NAME) . docker build --no-cache -t $(NAME) .
@ -10,6 +10,10 @@ build-no-cache:
build: build:
docker build -t $(NAME) . 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:
# Run containers # Run containers
docker run -d --name mail \ docker run -d --name mail \

View file

@ -9,6 +9,8 @@ die () {
# Users # Users
# #
if [ -f /tmp/docker-mailserver/postfix-accounts.cf ]; then 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 "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 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. user1@localhost.localdomain|{CRAM-MD5}de5924752ad74e36bc271a8dc7fad4b2d341f21f05382f20dedf1fdfbd5a1717
user2@otherdomain.tld|{MD5-CRYPT}$1$31q82qPz$vprzqppi3chSsK8SgWT8d/ user2@otherdomain.tld|{CRAM-MD5}de5924752ad74e36bc271a8dc7fad4b2d341f21f05382f20dedf1fdfbd5a1717

View file

@ -174,6 +174,11 @@
# accounts # 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" { @test "checking accounts: user accounts" {
run docker exec mail doveadm user '*' run docker exec mail doveadm user '*'
[ "$status" -eq 0 ] [ "$status" -eq 0 ]