Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add certificates dir bind mount to docker-compose for SMTP TLS (#112)

Leendert de Borste4f42b57d4d1
diff --git a/.env.example b/.env.example
index 96d0f4f45..9ee8d465b 100644
--- a/.env.example
+++ b/.env.example
@@ -50,11 +50,28 @@ PRIVATE_EMAIL_DOMAINS=
# Note: Domains listed here should ALSO be included in PRIVATE_EMAIL_DOMAINS above.
HIDDEN_PRIVATE_EMAIL_DOMAINS=
-# Enable TLS for SMTP.
-# ⚠️ Requires valid TLS certificates on your mail server (not provided by the AliasVault installer).
-# If set to true without proper certificates, the SMTP service will fail to start.
-# For self-hosted setups, we recommend keeping this **false** unless you're sure how to configure it.
-# Note: Disabling TLS does **not** impact email deliverability.
+# Enable TLS for SMTP (STARTTLS).
+# When enabled, the SMTP server will offer STARTTLS to connecting mail servers.
+#
+# IMPORTANT: You must obtain SMTP TLS certificates yourself (e.g., from Let's Encrypt).
+# The AliasVault installer does not currently support requesting SMTP certificates.
+# The certificate should be issued for your mail hostname (e.g., mail.example.com).
+#
+# To enable SMTP TLS:
+# 1. Obtain a certificate for your mail hostname (e.g., via certbot/Let's Encrypt)
+# 2. Combine the certificate and private key into a single .pem file
+# 3. Place the .pem file in the ./certificates/smtp/ directory
+# 4. Set SMTP_TLS_ENABLED=true
+# 5. Restart the SMTP service
+#
+# If you have multiple mail domains (e.g., mail.example.com and mail.example2.com),
+# use a single certificate with Subject Alternative Names (SANs) covering all domains.
+#
+# Note: If TLS is enabled but no valid certificate is found, the service will log a
+# warning (visible in admin) and continue in non-TLS mode.
+#
+# Disabling TLS does NOT impact email deliverability (that much). Although some websites
+# are known to send emails exclusively via TLS connections, this is probably shy of <1% of websites.
SMTP_TLS_ENABLED=false
# ===========================================
diff --git a/docker-compose.yml b/docker-compose.yml
index bf25152c7..b4211804a 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -85,6 +85,7 @@ services:
- ./database:/database:rw
- ./logs:/logs:rw
- ./secrets:/secrets:ro
+ - ./certificates/smtp:/certificates/smtp:ro
restart: always
env_file:
- .env
diff --git a/dockerfiles/all-in-one/s6-scripts/init/script b/dockerfiles/all-in-one/s6-scripts/init/script
index dfe3e8a4e..bcde2ab21 100644
--- a/dockerfiles/all-in-one/s6-scripts/init/script
+++ b/dockerfiles/all-in-one/s6-scripts/init/script
@@ -31,8 +31,8 @@ echo "[init] Starting AliasVault..."
echo ""
# Create required directories
-if [ ! -d /database/postgres ] || [ ! -d /logs/postgres ] || [ ! -d /certificates ] || [ ! -d /secrets ] || [ ! -d /var/run/postgresql ]; then
- mkdir -p /database/postgres /logs/postgres /certificates /secrets /var/run/postgresql
+if [ ! -d /database/postgres ] || [ ! -d /logs/postgres ] || [ ! -d /certificates/ssl ] || [ ! -d /certificates/smtp ] || [ ! -d /secrets ] || [ ! -d /var/run/postgresql ]; then
+ mkdir -p /database/postgres /logs/postgres /certificates/ssl /certificates/smtp /secrets /var/run/postgresql
log 0 "[init] Required directories created"
else
log 0 "[init] ✅ Required directories already exist"
diff --git a/dockerfiles/docker-compose.all-in-one.dev.yml b/dockerfiles/docker-compose.all-in-one.dev.yml
index 6f97b7199..92143f6bf 100644
--- a/dockerfiles/docker-compose.all-in-one.dev.yml
+++ b/dockerfiles/docker-compose.all-in-one.dev.yml
@@ -39,6 +39,7 @@ services:
- ../database:/database
- ../logs:/logs
- ../secrets:/secrets
+ - ../certificates:/certificates
env_file:
- ../.env
diff --git a/dockerfiles/docker-compose.all-in-one.nas.yml b/dockerfiles/docker-compose.all-in-one.nas.yml
index 3f9508c95..756b01dad 100644
--- a/dockerfiles/docker-compose.all-in-one.nas.yml
+++ b/dockerfiles/docker-compose.all-in-one.nas.yml
@@ -21,6 +21,7 @@ services:
- avdata:/database
- avlogs:/logs
- avsecrets:/secrets
+ - avcerts:/certificates
environment:
HOSTNAME: "localhost"
@@ -35,3 +36,4 @@ volumes:
avdata:
avlogs:
avsecrets:
+ avcerts:
diff --git a/dockerfiles/docker-compose.all-in-one.yml b/dockerfiles/docker-compose.all-in-one.yml
index 81e45ad96..dfc589d8f 100644
--- a/dockerfiles/docker-compose.all-in-one.yml
+++ b/dockerfiles/docker-compose.all-in-one.yml
@@ -19,6 +19,7 @@ services:
- ./database:/database
- ./logs:/logs
- ./secrets:/secrets
+ - ./certificates:/certificates
environment:
HOSTNAME: "localhost"
diff --git a/install.sh b/install.sh
index 29e4ae2f6..af381711d 100755
--- a/install.sh
+++ b/install.sh
@@ -10,6 +10,7 @@ GITHUB_CONTAINER_REGISTRY="ghcr.io/$(echo "$REPO_OWNER" | tr '[:upper:]' '[:lowe
# Required files and directories
REQUIRED_DIRS=(
"certificates/ssl"
+ "certificates/smtp"
"certificates/letsencrypt"
"certificates/letsencrypt/www"
"database"