mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Fixed #159: postfix-accounts.cf now generated with script + fixed line endings using sed in start-mailserver.sh
This commit is contained in:
parent
f8268f641a
commit
9415c099cc
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
docker-compose.yml
|
||||
.idea
|
||||
test/config/empty/
|
||||
test/config/postfix-accounts.cf
|
||||
|
|
10
Makefile
10
Makefile
|
@ -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 \
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
2
test/config/example.postfix-accounts.cf
Normal file
2
test/config/example.postfix-accounts.cf
Normal file
|
@ -0,0 +1,2 @@
|
|||
user1@localhost.localdomain|{CRAM-MD5}de5924752ad74e36bc271a8dc7fad4b2d341f21f05382f20dedf1fdfbd5a1717
|
||||
user2@otherdomain.tld|{CRAM-MD5}de5924752ad74e36bc271a8dc7fad4b2d341f21f05382f20dedf1fdfbd5a1717
|
|
@ -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
|
||||
|
|
|
@ -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 ]
|
||||
|
|
Loading…
Reference in a new issue