Skip to content

Commit

Permalink
Update to Debian Bookworm (mailserver2/debian-mail-overlay:1.0.12) (#56)
Browse files Browse the repository at this point in the history
* Install python3-watchdog package instead of pip3 install
* Update to base image 1.0.12.
Small changes to Dockerfile for debian bookworm.
Fix a few failing tests.
* Fix waiting for containers. Wait until a successful connection is established.
  • Loading branch information
SaraSmiseth authored Sep 1, 2023
1 parent 00a1964 commit e10532a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mailserver2/debian-mail-overlay:1.0.11
FROM mailserver2/debian-mail-overlay:1.0.12

LABEL description="Simple and full-featured mail server using Docker"

Expand All @@ -10,17 +10,16 @@ RUN apt-get update && apt-get install -y -q --no-install-recommends \
dovecot-core dovecot-imapd dovecot-lmtpd dovecot-pgsql dovecot-mysql dovecot-ldap dovecot-sieve dovecot-managesieved dovecot-pop3d \
fetchmail libdbi-perl libdbd-pg-perl libdbd-mysql-perl liblockfile-simple-perl \
clamav clamav-daemon \
python3-pip python3-setuptools python3-wheel python3-gpg \
rsyslog dnsutils curl unbound jq rsync \
python3-pip python3-setuptools python3-wheel python3-gpg python3-watchdog \
rsyslog dnsutils curl unbound unbound-anchor jq rsync \
inotify-tools \
# To enable compression in imap
arj bzip2 cabextract cpio file gzip nomarch pax unzip zip \
&& rm -rf /var/spool/postfix \
&& ln -s /var/mail/postfix/spool /var/spool/postfix \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /tmp/* /var/lib/apt/lists/* /var/cache/debconf/*-old \
&& pip3 install watchdog
&& rm -rf /tmp/* /var/lib/apt/lists/* /var/cache/debconf/*-old

EXPOSE 25 143 465 587 993 4190 11334
COPY rootfs /
Expand Down
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ init_redis:
docker run \
-d \
--name redis \
-t redis:6.2-alpine
-t redis:7.0-alpine
sleep 10

init_mariadb:
Expand All @@ -51,7 +51,7 @@ init_mariadb:
-e MYSQL_PASSWORD=testpasswd \
-v "`pwd`/test/config/mariadb/struct.sql":/docker-entrypoint-initdb.d/struct.sql \
-v "`pwd`/test/config/mariadb/bind.cnf":/etc/mysql/conf.d/bind.cnf \
-t mysql:5.7
-t mysql:8

init_postgres:
-docker rm -f \
Expand Down Expand Up @@ -198,7 +198,8 @@ init_ldap2: init_openldap init_redis
-h mail.domain.tld \
-t $(NAME)
fixtures_ldap2:
sleep 20
docker exec mailserver_ldap2 /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 25 ; do sleep 1 ; done"
sleep 30
docker exec mailserver_ldap2 /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-user.txt"
docker exec mailserver_ldap2 /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-valid-user-subaddress.txt"
docker exec mailserver_ldap2 /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-non-existing-user.txt"
Expand Down Expand Up @@ -282,6 +283,7 @@ init_reverse: init_redis init_postgres
-v "`pwd`/test/share/letsencrypt":/etc/letsencrypt \
-t $(NAME)
fixtures_reverse:
docker exec mailserver_reverse /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 25 ; do sleep 1 ; done"
sleep 30
docker exec mailserver_reverse /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-user.txt"
docker exec mailserver_reverse /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-valid-user-subaddress-with-default-separator.txt"
Expand Down Expand Up @@ -318,8 +320,8 @@ init_ecdsa: init_redis init_mariadb
-v "`pwd`/test/share/postfix/custom.ecdsa.conf":/var/mail/postfix/custom.conf \
-h mail.domain.tld \
-t $(NAME)
sleep 10
run_ecdsa:
docker exec mailserver_ecdsa /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 587 ; do sleep 1 ; done"
./test/bats/bin/bats test/ecdsa.bats
stop_ecdsa:
-docker rm -f \
Expand All @@ -344,7 +346,7 @@ init_traefik_acmev1: init_redis init_mariadb
-h mail.domain.tld \
-t $(NAME)
run_traefik_acmev1:
sleep 20
docker exec mailserver_traefik_acmev1 /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 587 ; do sleep 1 ; done"
./test/bats/bin/bats test/traefik_acmev1.bats
stop_traefik_acmev1:
-docker rm -f \
Expand All @@ -369,7 +371,7 @@ init_traefik_acmev2: init_redis init_mariadb
-h mail.domain.tld \
-t $(NAME)
run_traefik_acmev2:
sleep 20
docker exec mailserver_traefik_acmev2 /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 587 ; do sleep 1 ; done"
./test/bats/bin/bats test/traefik_acmev2.bats
stop_traefik_acmev2:
-docker rm -f \
Expand Down
4 changes: 2 additions & 2 deletions test/default.bats
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ load 'test_helper/bats-assert/load'
#

@test "checking clamav: TCP Bound to 3310 port" {
run docker exec mailserver_default grep -i 'TCP: Bound to \[0.0.0.0\]:3310' /var/log/mail.log
run docker exec mailserver_default grep -i 'TCP: Bound to \[\]:3310' /var/log/mail.log
assert_success
}

Expand Down Expand Up @@ -804,7 +804,7 @@ load 'test_helper/bats-assert/load'
#

@test "checking ssl: generated default cert works correctly" {
run docker exec mailserver_default /bin/sh -c "timeout 1 openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp | grep 'Verify return code: 18 (self signed certificate)'"
run docker exec mailserver_default /bin/sh -c "timeout 1 openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp | grep 'Verify return code: 18 (self-signed certificate)'"
assert_success
}

Expand Down
2 changes: 1 addition & 1 deletion test/ecdsa.bats
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ load 'test_helper/bats-assert/load'
#

@test "checking ssl: ECDSA P-384 cert works correctly" {
run docker exec mailserver_ecdsa /bin/sh -c "timeout 1 openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp | grep 'Verify return code: 18 (self signed certificate)'"
run docker exec mailserver_ecdsa /bin/sh -c "timeout 1 openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp | grep 'Verify return code: 18 (self-signed certificate)'"
assert_success
}

Expand Down

0 comments on commit e10532a

Please sign in to comment.