Skip to content

Commit 491c224

Browse files
authored
Merge branch 'anonaddy:master' into feature-tls-traefik
2 parents de5bfa9 + f1ee9f8 commit 491c224

32 files changed

+1162
-779
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
* @crazy-max
1+
* @crazy-max
2+
examples/nginx/ @eleith

.github/workflows/test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ jobs:
5454
-e "MYSQL_USER=anonaddy" \
5555
-e "MYSQL_PASSWORD=anonaddy" \
5656
mariadb:10.5
57+
-
58+
name: Generate DKIM private key
59+
run: |
60+
docker run --rm -t --entrypoint "" \
61+
-e "ANONADDY_DOMAIN=example.com" \
62+
-v "/tmp/data:/data" \
63+
${{ steps.prep.outputs.build_tag }} gen-dkim
5764
-
5865
name: Start container
5966
run: |
@@ -67,6 +74,8 @@ jobs:
6774
-e "APP_KEY=base64:Gh8/RWtNfXTmB09pj6iEflt/L6oqDf9ZxXIh4I9MS7A=" \
6875
-e "ANONADDY_DOMAIN=example.com" \
6976
-e "ANONADDY_SECRET=0123456789abcdefghijklmnopqrstuvwxyz" \
77+
-e "RSPAMD_ENABLE=true" \
78+
-v "/tmp/data:/data" \
7079
${{ steps.prep.outputs.build_tag }}
7180
-
7281
name: Test run

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Changelog
22

3+
## 0.10.1-r0 (2022/02/27)
4+
5+
* AnonAddy 0.10.1 (#115)
6+
* Drop support for OpenDKIM/OpenDMARC (#116)
7+
8+
## 0.10.0-r1 (2022/02/24)
9+
10+
* Fix Rspamd config (#113)
11+
12+
## 0.10.0-r0 (2022/02/20)
13+
14+
* AnonAddy 0.10.0 (#112)
15+
16+
## 0.9.1-r0 (2022/02/10)
17+
18+
* AnonAddy 0.9.1 (#109)
19+
20+
## 0.9.0-r0 (2022/02/05)
21+
22+
* AnonAddy 0.9.0 (#106)
23+
24+
## 0.8.10-r0 (2022/01/20)
25+
26+
* AnonAddy 0.8.10 (#101)
27+
* Nginx example for SSL proxying (#99)
28+
* Split configuration (#98)
29+
* Support Rspamd (#96 #100)
30+
331
## 0.8.9-r1 (2022/01/11)
432

533
* Alpine Linux 3.15 (#95)

Dockerfile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG ANONADDY_VERSION=0.8.9
1+
ARG ANONADDY_VERSION=0.10.1
22

33
FROM crazymax/yasu:latest AS yasu
44
FROM crazymax/alpine-s6:3.15-2.2.0.3
@@ -14,11 +14,6 @@ RUN apk --update --no-cache add \
1414
libgd \
1515
mysql-client \
1616
nginx \
17-
opendkim \
18-
opendkim-libs \
19-
opendkim-utils \
20-
opendmarc \
21-
opendmarc-libs \
2217
openssl \
2318
php8 \
2419
php8-cli \
@@ -51,6 +46,9 @@ RUN apk --update --no-cache add \
5146
php8-zlib \
5247
postfix \
5348
postfix-mysql \
49+
rspamd \
50+
rspamd-controller \
51+
rspamd-proxy \
5452
shadow \
5553
tar \
5654
tzdata \
@@ -67,9 +65,6 @@ RUN apk --update --no-cache add \
6765
php8-pear \
6866
&& ln -s /usr/bin/php8 /usr/bin/php \
6967
&& pecl8 install gnupg \
70-
&& addgroup opendkim postfix \
71-
&& addgroup postfix opendkim \
72-
&& addgroup opendmarc postfix \
7368
&& apk del build-dependencies \
7469
&& rm -rf /tmp/* /var/www/*
7570

@@ -89,7 +84,6 @@ RUN apk --update --no-cache add -t build-dependencies \
8984
&& npm --version \
9085
&& addgroup -g ${PGID} anonaddy \
9186
&& adduser -D -h /var/www/anonaddy -u ${PUID} -G anonaddy -s /bin/sh -D anonaddy \
92-
&& addgroup anonaddy opendkim \
9387
&& addgroup anonaddy mail \
9488
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
9589
&& git clone --branch v${ANONADDY_VERSION} https://github.com/anonaddy/anonaddy . \
@@ -111,7 +105,7 @@ RUN apk --update --no-cache add -t build-dependencies \
111105

112106
COPY rootfs /
113107

114-
EXPOSE 25 8000
108+
EXPOSE 25 8000 11334
115109
VOLUME [ "/data" ]
116110

117111
ENTRYPOINT [ "/init" ]

README.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ ___
2929
* [Redis](#redis)
3030
* [Mail](#mail)
3131
* [Postfix](#postfix)
32-
* [DKIM](#dkim)
33-
* [DMARC](#dmarc)
32+
* [RSPAMD](#rspamd)
3433
* [Volumes](#volumes)
3534
* [Ports](#ports)
3635
* [Usage](#usage)
@@ -160,21 +159,15 @@ Image: anonaddy/anonaddy:latest
160159
* `POSTFIX_RELAYHOST_USERNAME`: Postfix SMTP Client username for relayhost authentication
161160
* `POSTFIX_RELAYHOST_PASSWORD`: Postfix SMTP Client password for relayhost authentication
162161

163-
### DKIM
162+
### RSPAMD
164163

165-
* `DKIM_ENABLE`: Enable OpenDKIM service. (default `false`)
166-
* `DKIM_REPORT_ADDRESS`: Specifies the string to use in the `From:` header field for outgoing reports (default `postmaster@${ANONADDY_DOMAIN}`)
164+
* `RSPAMD_ENABLE`: Enable Rspamd service. (default `false`)
165+
* `RSPAMD_WEB_PASSWORD`: Rspamd web password (default `null`)
167166

168167
> :warning: DKIM private key must be located in `/data/dkim/${ANONADDY_DOMAIN}.private`. You can generate a DKIM
169168
> private/public keypair by following [this note](#generate-dkim-privatepublic-keypair).
170169
171-
> :warning: OpenDKIM service is disabled if DKIM private key is not found
172-
173-
### DMARC
174-
175-
* `DMARC_ENABLE`: Enable OpenDMARC service. (default `false`)
176-
* `DMARC_FAILURE_REPORTS`: Enables generation of failure reports when the DMARC test fails (default `false`)
177-
* `DMARC_MILTER_DEBUG`: Sets the debug level to be requested from the milter library (default `0`)
170+
> :warning: Rspamd service is disabled if DKIM private key is not found
178171
179172
## Volumes
180173

@@ -185,7 +178,8 @@ Image: anonaddy/anonaddy:latest
185178
186179
## Ports
187180

188-
* `8000`: HTTP port
181+
* `8000`: HTTP port (anonaddy web)
182+
* `11334`: HTTP port (rspamd web dashboard)
189183
* `25`: SMTP port (postfix)
190184

191185
## Usage
@@ -237,11 +231,15 @@ docker-compose exec anonaddy anonaddy anonaddy:create-user "username" "webmaster
237231
```shell
238232
docker-compose run --entrypoint '' anonaddy gen-dkim
239233
```
234+
240235
```text
241-
opendkim-genkey: generating private key
242-
opendkim-genkey: private key written to example.com.private
243-
opendkim-genkey: extracting public key
244-
opendkim-genkey: DNS TXT record written to example.com.txt
236+
generating private and storing in data/dkim/example.com.private
237+
generating DNS TXT record with public key and storing it in data/dkim/example.com.txt
238+
239+
default._domainkey IN TXT ( "v=DKIM1; k=rsa; "
240+
"p=***"
241+
"***"
242+
) ;
245243
```
246244

247245
The keypair will be available in `/data/dkim`.

examples/nginx/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Prerequisites
2+
3+
Read [self-hosting docs](https://anonaddy.com/self-hosting/)
4+
5+
## Let's Encrypt
6+
7+
Generate your certificates and make note of where they are stored. if you use
8+
certbot, they are generally in `/etc/letsencrypt/live`.
9+
10+
## Generate strong dhparam
11+
12+
```sh
13+
sudo openssl dhparam -out dhparam.pem 4096
14+
```
15+
16+
## Configure mounts for nginx
17+
18+
The `docker-compose.yml` may need some adjusting to properly mount your
19+
specific let's encrypt and dhparam certs.
20+
21+
## Rspamd web ui
22+
23+
This nginx configuration supports rspamd web ui out of the box. if you choose
24+
to not run rspamd, make sure to remove the `RSPAMD_ENABLE` variable in
25+
`anonaddy.env` and remove the proxy block in `nginx/templates/default.conf.template`.

examples/nginx/anonaddy.env

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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=remote_addr
11+
12+
APP_KEY=base64:KJ1LX0w15ItOoMWdC+DNW2Bt0Z4sT98zu0XQ8Zfaf9o=
13+
APP_DEBUG=false
14+
APP_URL=http://127.0.0.1:8000
15+
16+
ANONADDY_RETURN_PATH=bounces@example.com
17+
ANONADDY_ADMIN_USERNAME=anonaddy
18+
ANONADDY_ENABLE_REGISTRATION=true
19+
ANONADDY_DOMAIN=example.com
20+
ANONADDY_ALL_DOMAINS=example.com
21+
ANONADDY_HOSTNAME=mail.example.com
22+
ANONADDY_DNS_RESOLVER=127.0.0.1
23+
ANONADDY_SECRET=lksjflk2u3j4oij2elkru23oi4uj2lkjflsakfjoi23u4
24+
ANONADDY_LIMIT=200
25+
ANONADDY_BANDWIDTH_LIMIT=104857600
26+
ANONADDY_NEW_ALIAS_LIMIT=10
27+
ANONADDY_ADDITIONAL_USERNAME_LIMIT=3
28+
29+
MAIL_FROM_NAME=AnonAddy
30+
MAIL_FROM_ADDRESS=anonaddy@example.com
31+
32+
POSTFIX_DEBUG=false
33+
POSTFIX_SMTPD_TLS=false
34+
POSTFIX_SMTP_TLS=false
35+
36+
RSPAMD_ENABLE=true
37+
RSPAMD_WEB_PASSWORD=abc

examples/nginx/docker-compose.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: "3.5"
2+
3+
services:
4+
db:
5+
image: mariadb:10.5
6+
container_name: anonaddy_db
7+
command:
8+
- "mysqld"
9+
- "--character-set-server=utf8mb4"
10+
- "--collation-server=utf8mb4_unicode_ci"
11+
volumes:
12+
- "./db:/var/lib/mysql"
13+
environment:
14+
- "MYSQL_ALLOW_EMPTY_PASSWORD=yes"
15+
- "MYSQL_DATABASE"
16+
- "MYSQL_USER"
17+
- "MYSQL_PASSWORD"
18+
restart: always
19+
20+
redis:
21+
image: redis:4.0-alpine
22+
container_name: anonaddy_redis
23+
restart: always
24+
25+
anonaddy:
26+
image: anonaddy/anonaddy:latest
27+
container_name: anonaddy
28+
depends_on:
29+
- db
30+
- redis
31+
ports:
32+
- target: 25
33+
published: 25
34+
protocol: tcp
35+
volumes:
36+
- "./data:/data"
37+
env_file:
38+
- "./anonaddy.env"
39+
environment:
40+
- "DB_HOST=db"
41+
- "DB_DATABASE=${MYSQL_DATABASE}"
42+
- "DB_USERNAME=${MYSQL_USER}"
43+
- "DB_PASSWORD=${MYSQL_PASSWORD}"
44+
- "REDIS_HOST=redis"
45+
restart: always
46+
47+
nginx:
48+
image: nginx:1.20.1-alpine
49+
container_name: anonaddy_nginx
50+
restart: unless-stopped
51+
ports:
52+
- '443:443'
53+
volumes:
54+
- /etc/ssl/dhparam.pem:/etc/ssl/dhparam.pem
55+
- ./nginx/templates:/etc/nginx/templates
56+
- /etc/letsencrypt:/etc/letsencrypt
57+
depends_on:
58+
- anonaddy
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
server {
2+
listen 80;
3+
listen [::]:80;
4+
5+
server_name example.com;
6+
return 301 https://$server_name$request_uri;
7+
}
8+
9+
server {
10+
listen 443 ssl http2;
11+
listen [::]:443 ssl http2;
12+
server_name example.com;
13+
server_tokens off;
14+
15+
add_header X-Frame-Options "SAMEORIGIN";
16+
add_header X-XSS-Protection "1; mode=block";
17+
add_header X-Content-Type-Options "nosniff";
18+
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
19+
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self'; object-src 'none'";
20+
add_header Referrer-Policy "origin-when-cross-origin";
21+
add_header Expect-CT "enforce, max-age=604800";
22+
23+
charset utf-8;
24+
25+
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
26+
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
27+
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
28+
29+
ssl_prefer_server_ciphers on;
30+
ssl_session_timeout 5m;
31+
ssl_protocols TLSv1.2 TLSv1.3;
32+
ssl_stapling on;
33+
ssl_stapling_verify on;
34+
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
35+
ssl_ecdh_curve secp384r1;
36+
ssl_session_cache shared:SSL:20m;
37+
ssl_session_tickets off;
38+
ssl_dhparam /etc/ssl/dhparam.pem;
39+
40+
location = /robots.txt {
41+
add_header Content-Type text/plain;
42+
return 200 "User-agent: *\nDisallow: /\n";
43+
}
44+
45+
location /rspamd {
46+
proxy_pass http://anonaddy:11334;
47+
48+
proxy_set_header Host $host;
49+
proxy_set_header X-Real-IP $remote_addr;
50+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
51+
proxy_set_header X-Forwarded-Proto $scheme;
52+
}
53+
54+
location / {
55+
proxy_pass http://anonaddy:8000;
56+
57+
proxy_redirect off;
58+
proxy_set_header Host $host;
59+
proxy_set_header X-Real-IP $remote_addr;
60+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
61+
proxy_set_header X-Forwarded-Proto $scheme;
62+
proxy_read_timeout 90s;
63+
}
64+
}

0 commit comments

Comments
 (0)