Skip to content

Commit

Permalink
feat: Provide autoconfigure file to configure Mozilla Thunderbird and…
Browse files Browse the repository at this point in the history
… others (jeboehm#181)
  • Loading branch information
jeboehm committed Jun 2, 2022
1 parent 33e970e commit 53bd07c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ services:
# For development
# web:
# volumes:
# - ./web/rootfs/etc/nginx/sites-enabled/10-docker.conf:/etc/nginx/sites-enabled/10-docker.conf:ro
# - ./web/rootfs/etc/nginx/nginx.conf.templ:/etc/nginx/nginx.conf.templ:ro
# ports:
# - "0.0.0.0:81:80"
5 changes: 5 additions & 0 deletions test/rootfs/usr/share/tests/004_web.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@
curl http://web/rspamd/ | grep "Rspamd Web Interface"
[ "$?" -eq 0 ]
}

@test "http connection to autoconfigure file" {
curl http://web/.well-known/autoconfig/mail/config-v1.1.xml | grep "clientConfig"
[ "$?" -eq 0 ]
}
3 changes: 3 additions & 0 deletions web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ ENV MYSQL_HOST=db \
FILTER_HOST=filter \
WEB_HOST=web \
SUPPORT_URL=https://github.com/jeboehm/docker-mailserver \
MAILNAME=mail.example.com \
LABEL=docker-mailserver \
LABEL_SHORT=docker-mailserver \
APP_ENV=prod \
TRUSTED_PROXIES=172.16.0.0/12 \
WAITSTART_TIMEOUT=1m \
Expand Down
6 changes: 2 additions & 4 deletions web/rootfs/etc/nginx/nginx.conf.templ
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ http {
return 301 /;
}

location ~ /\. {
deny all;
access_log off;
log_not_found off;
location /.well-known/autoconfig/mail/config-v1.1.xml {
alias /var/www/html/autoconfig/config-v1.1.xml;
}

location ~ \.(tpl|yml|ini|log)$ {
Expand Down
3 changes: 2 additions & 1 deletion web/rootfs/usr/local/bin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ dockerize \
-wait tcp://${FILTER_HOST}:11334 \
-wait file:///media/dkim/ \
-timeout ${WAITSTART_TIMEOUT} \
-template /etc/nginx/nginx.conf.templ:/etc/nginx/nginx.conf
-template /etc/nginx/nginx.conf.templ:/etc/nginx/nginx.conf \
-template /var/www/html/autoconfig/config-v1.1.xml.templ:/var/www/html/autoconfig/config-v1.1.xml

manager_init
roundcube_init
Expand Down
23 changes: 23 additions & 0 deletions web/rootfs/var/www/html/autoconfig/config-v1.1.xml.templ
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<clientConfig version="1.1">
<emailProvider id="{{ .Env.MAILNAME }}">
<domain>{{ .Env.MAILNAME }}</domain>
<displayName>{{ .Env.LABEL }}</displayName>
<displayShortName>{{ .Env.LABEL_SHORT }}</displayShortName>
<incomingServer type="imap">
<hostname>{{ .Env.MAILNAME }}</hostname>
<port>143</port>
<socketType>STARTTLS</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</incomingServer>
<outgoingServer type="smtp">
<hostname>{{ .Env.MAILNAME }}</hostname>
<port>587</port>
<socketType>STARTTLS</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</outgoingServer>
</emailProvider>
</clientConfig>

0 comments on commit 53bd07c

Please sign in to comment.