commit eb67813ae9ecf86eaf33f4fade9f24728459186e
parent 9a015557894380ce310491349ea371f93e0e4da9
Author: Damian Myrda <damian@prime8.dev>
Date: Fri, 5 Jul 2024 16:53:40 -0500
feat: dockerized mail server with certificates for all subdomains
Diffstat:
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/compose.yml b/compose.yml
@@ -2,14 +2,14 @@ services:
bbs:
container_name: bbs
image: moncheeta/bbs
- hostname: prime8.dev
ports:
- "443:443"
volumes:
- - /etc/letsencrypt/live/prime8.dev/fullchain.pem:/ssl/fullchain.pem
- - /etc/letsencrypt/live/prime8.dev/privkey.pem:/ssl/privkey.pem
+ - /etc/letsencrypt/live/prime8.dev/fullchain.pem:/ssl/fullchain.pem:ro
+ - /etc/letsencrypt/live/prime8.dev/privkey.pem:/ssl/privkey.pem:ro
restart: always
stop_grace_period: 1m
+
mail:
container_name: mail
image: ghcr.io/docker-mailserver/docker-mailserver:latest
@@ -23,11 +23,11 @@ services:
- "993:993" # IMAP4 (implicit TLS)
volumes:
- /etc/localtime:/etc/localtime/:ro
- - /var/mail/data/:/var/mail/
- - /var/mail/state/:/var/mail-state/
- - /var/mail/logs/:/var/log/mail/
- - /var/mail/config/:/tmp/docker-mailserver/
- - /etc/letsencrypt/:/etc/letsencrypt/
+ - mail:/data/:/var/mail/
+ - mail:/state/:/var/mail-state/
+ - mail:/logs/:/var/log/mail/
+ - mail:/config/:/tmp/docker-mailserver/
+ - /etc/letsencrypt/:/etc/letsencrypt/:ro
cap_add:
- NET_ADMIN
healthcheck:
@@ -36,3 +36,6 @@ services:
retries: 0
restart: always
stop_grace_period: 1m
+
+volumes:
+ mail:
diff --git a/mail.env b/mail.env
@@ -118,7 +118,7 @@ ENABLE_POLICYD_SPF=1
# Enables POP3 service
# - **0** => Disabled
# - 1 => Enabled
-ENABLE_POP3=
+ENABLE_POP3=0
# Enables IMAP service
# - 0 => Disabled
@@ -130,8 +130,9 @@ ENABLE_IMAP=1
# **0** => Disabled
ENABLE_CLAMAV=0
-# Add the value as a prefix to the mail subject when spam is detected.
-# NOTE: By default spam is delivered to a junk folder, reducing the value of a subject prefix for spam.
+# Add the value of this ENV as a prefix to the mail subject when spam is detected.
+# NOTE: This subject prefix may be redundant (by default spam is delivered to a junk folder).
+# It provides value when your junk mail is stored alongside legitimate mail instead of a separate location (like with `SPAMASSASSIN_SPAM_TO_INBOX=1` or `MOVE_SPAM_TO_JUNK=0` or a POP3 only setup, without IMAP).
# NOTE: When not using Docker Compose, other CRI may not support quote-wrapping the value here to preserve any trailing white-space.
SPAM_SUBJECT=
@@ -210,7 +211,7 @@ ENABLE_DNSBL=0
# cap_add:
# - NET_ADMIN
# Otherwise, `nftables` won't be able to ban IPs.
-ENABLE_FAIL2BAN=1
+ENABLE_FAIL2BAN=0
# Fail2Ban blocktype
# drop => drop packet (send NO reply)
diff --git a/setup.sh b/setup.sh
@@ -7,5 +7,8 @@ apt update -y && apt upgrade -y
apt install -y certbot
./ssl.sh
+# docker
+docker compose build
+
# apply all updates
reboot
diff --git a/ssl.sh b/ssl.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-certbot certonly --standalone -d prime8.dev,mail.prime8.dev --agree-tos --force-renewal
+certbot certonly --standalone -d "prime8.dev,mail.prime8.dev" --agree-tos --force-renewal