Skip to content

Commit 9b43a78

Browse files
committed
Add advanced traefik example
1 parent f1ee9f8 commit 9b43a78

File tree

6 files changed

+395
-0
lines changed

6 files changed

+395
-0
lines changed

examples/traefik-advanced/.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MYSQL_DATABASE=anonaddy
2+
MYSQL_USER=anonaddy
3+
MYSQL_PASSWORD=anonaddy
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
This is a strongly opinionated AnonAddy Docker + Traefik config template that provides some production quality features.
2+
Note that you must further tweak the configuration and then run Docker in Swarm mode to ensure e.g. encrypted network traffic and scaling for serious production usage.
3+
You should also use something like Hashicorp Vault to protect any secrets as Docker secret files are still stored in plain text on the filesystem as well as disable root user access in containers.
4+
5+
## Features
6+
- Automatic creation of ACME SSL Wildcard Certificates using DNS Challenge resolver
7+
- [Tecnativa's Docker Socket Proxy](https://github.com/Tecnativa/docker-socket-proxy) (reduce risk of Docker socket exposure)
8+
- Automatic Postfix TLS management using [traefik-certs-dumper](https://github.com/kereis/traefik-certs-dumper)
9+
- Auto-dumping of Let's Encrypt certificates to Postfix cert directory
10+
- Watch & restart AnonAddy container on certificate renewal
11+
- Hardened TLS cipher configuration
12+
- Watchtower for automatic AnonAddy container updates upon new release
13+
- CrowdSec with Traefik bouncer for SPAM detection and mitigation. Please refer to the [CrowdSec documentation](https://docs.crowdsec.net/docs/getting_started/install_crowdsec) for initial setup instructions.
14+
- Enabled Rspamd and exposed Web UI (also covered by CrowdSec bouncer)
15+
16+
**Note**: Does not ensure Zero Downtime deployment!
17+
18+
## Usage
19+
20+
Use these files for full SMTP(D) TLS/ DKIM/ DMARC/ PGP signing functionalities. \
21+
22+
```bash
23+
mkdir letsencrypt
24+
touch letsencrypt/acme.json
25+
chmod 600 letsencrypt/acme.json
26+
docker-compose up -d
27+
docker-compose logs -f
28+
```
29+
30+
You will also need to create secret files containing the DNS Challenge provider credentials. For more information, please refer to the [Traefik Docs](https://doc.traefik.io/traefik/https/acme/#providers).
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
TZ=Europe/Paris
2+
PUID=1000
3+
PGID=1000
4+
5+
MEMORY_LIMIT=256M
6+
UPLOAD_MAX_SIZE=16M
7+
OPCACHE_MEM_SIZE=128
8+
REAL_IP_FROM=0.0.0.0/32
9+
REAL_IP_HEADER=X-Forwarded-For
10+
LOG_IP_VAR=http_x_forwarded_for
11+
#LISTEN_IPV6=false
12+
13+
APP_KEY=
14+
APP_DEBUG=false
15+
APP_URL=https://anonaddy.example.com
16+
17+
ANONADDY_RETURN_PATH=[email protected]
18+
ANONADDY_ADMIN_USERNAME=anonaddy
19+
ANONADDY_ENABLE_REGISTRATION=true
20+
ANONADDY_DOMAIN=example.com
21+
ANONADDY_ALL_DOMAINS=example.com
22+
ANONADDY_HOSTNAME=anonaddy.example.com
23+
ANONADDY_DNS_RESOLVER=127.0.0.1
24+
ANONADDY_SECRET=
25+
ANONADDY_LIMIT=200
26+
ANONADDY_BANDWIDTH_LIMIT=104857600
27+
ANONADDY_NEW_ALIAS_LIMIT=10
28+
ANONADDY_ADDITIONAL_USERNAME_LIMIT=3
29+
# See [Generate GPG key](https://github.com/anonaddy/docker#generate-gpg-key)
30+
#ANONADDY_SIGNING_KEY_FINGERPRINT=
31+
32+
MAIL_FROM_NAME=AnonAddy
33+
MAIL_FROM_ADDRESS=[email protected]
34+
35+
# See [Generate DKIM private/public keypair](https://github.com/anonaddy/docker#generate-dkim-privatepublic-keypair)
36+
RSPAMD_ENABLE=true
37+
RSPAMD_WEB_PASSWORD=<PASSWORD>
38+
39+
POSTFIX_DEBUG=false
40+
POSTFIX_SMTPD_TLS=true
41+
POSTFIX_SMTPD_TLS_CERT_FILE=/data/output/mydomain.com/cert.pem
42+
POSTFIX_SMTPD_TLS_KEY_FILE=/data/output/mydomain.com/key.pem
43+
POSTFIX_SMTP_TLS=true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
tls:
2+
options:
3+
default:
4+
minVersion: VersionTLS12
5+
sniStrict: true
6+
cipherSuites:
7+
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
8+
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
9+
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
10+
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
11+
- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
12+
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
13+
14+
mintls13:
15+
minVersion: VersionTLS13
16+
sniStrict: true
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
http:
2+
routers:
3+
anonaddy:
4+
service: anonaddy
5+
entrypoints:
6+
- https
7+
rule: "Host(`anonaddy.example.com`)"
8+
middlewares:
9+
- crowdsec-bouncer
10+
tls:
11+
certResolver: dnschallenge
12+
domains:
13+
- main: "example.com"
14+
sans:
15+
- "example.com"
16+
- "anonaddy.example.com"
17+
- "www.example.com"
18+
rspamd:
19+
service: rspamd
20+
entrypoints:
21+
- https
22+
rule: "Host(`spam.example.com`)"
23+
middlewares:
24+
- crowdsec-bouncer
25+
tls:
26+
certResolver: dnschallenge
27+
domains:
28+
- main: "spam.example.com"
29+
sans:
30+
- "spam.example.com"
31+
middlewares:
32+
crowdsec-bouncer:
33+
forwardAuth:
34+
address: "http://bouncer:8080/api/v1/forwardAuth"
35+
redirect-https:
36+
redirectScheme:
37+
scheme: https
38+
permanent: true
39+
default-middlewares:
40+
chain:
41+
middlewares:
42+
- default-headers-https@file
43+
- default-compress@file
44+
default-headers-https:
45+
headers:
46+
customBrowserXSSValue: "0"
47+
contentTypeNosniff: true
48+
customResponseHeaders:
49+
Server: ""
50+
forceSTSHeader: true
51+
frameDeny: true
52+
stsSeconds: 31536000
53+
stsPreload: true
54+
stsIncludeSubdomains: true
55+
default-compress:
56+
compress: {}
57+
services:
58+
anonaddy:
59+
loadbalancer:
60+
servers:
61+
- url: http://172.21.0.8:8000
62+
rspamd:
63+
loadbalancer:
64+
servers:
65+
- url: http://172.21.0.8:11334

0 commit comments

Comments
 (0)