Compare commits
474 Commits
Author | SHA1 | Date |
---|---|---|
|
23bb1c8e50 | |
|
229ebba1b8 | |
|
df7a98ec50 | |
|
5027f4f5b6 | |
|
c2c48b2b83 | |
|
70d645d863 | |
|
a3571a88c1 | |
|
8ca2bd212c | |
|
0362fa682e | |
|
7c680a0fbc | |
|
a156c2c031 | |
|
6b1a566497 | |
|
02f068b2b2 | |
|
d0629f4cb6 | |
|
1756ba04fb | |
|
807f4f7118 | |
|
0fbbc44dd3 | |
|
3c833d8ee8 | |
|
dd595e0a05 | |
|
5686a4097a | |
|
309b5a9086 | |
|
ef66dd5d12 | |
|
41dd0727e4 | |
|
d2d74a29a7 | |
|
0294294755 | |
|
bcee78e2c1 | |
|
0ebf820b00 | |
|
07e558e4be | |
|
aba92b7bb8 | |
|
f2fedff251 | |
|
425d1162ae | |
|
ca877999ec | |
|
83bfe72d48 | |
|
c66d8ce40b | |
|
59a379aed7 | |
|
85793988d6 | |
|
e116920f4d | |
|
0e61f170fd | |
|
3faa40bfb5 | |
|
4d8a56072a | |
|
7cb2fc788f | |
|
2d56210c52 | |
|
f0daa1c8ab | |
|
3ebca5daba | |
|
8df1fba96e | |
|
a302bd79e3 | |
|
e6d519b6f8 | |
|
24fb65ce7b | |
|
259f2031fc | |
|
02415b03dc | |
|
a03ff8ff7c | |
|
96bffd7979 | |
|
cd225f1250 | |
|
9f0918c335 | |
|
10882f97f2 | |
|
d07e6d67d6 | |
|
edfecbceb1 | |
|
ab087d28b3 | |
|
c15354058f | |
|
02f1894f74 | |
|
6b4627ceab | |
|
b960efad74 | |
|
a599936c4b | |
|
0ff9c0132a | |
|
dc0a6403b2 | |
|
e6bd0b0a09 | |
|
662afec1d1 | |
|
ff8fc8013b | |
|
34eb54ac39 | |
|
26a44995a9 | |
|
c29fe3ff0b | |
|
2bcc5cf9de | |
|
3937e1e719 | |
|
1a938dfb15 | |
|
3bf32a6552 | |
|
025a38d736 | |
|
94751e00c9 | |
|
84180f879e | |
|
cace9c56d9 | |
|
4e85f799fc | |
|
3349bba1ff | |
|
a87d49e8f8 | |
|
cb963a9a8b | |
|
9589d2192b | |
|
ab2127ba67 | |
|
310786453b | |
|
b2978fd760 | |
|
fb57905aa3 | |
|
d61909bdea | |
|
526fd64d11 | |
|
2f8ad142ec | |
|
a338c06639 | |
|
37e5203a69 | |
|
01194b7552 | |
|
c544d770e7 | |
|
32c0a346fc | |
|
093e43480c | |
|
720a4a2534 | |
|
2edd6936c4 | |
|
009237cc26 | |
|
0698ad9370 | |
|
c5f125c973 | |
|
34423c2f66 | |
|
bf4ebc2a41 | |
|
755540cacf | |
|
4778f15fda | |
|
3a40c457fc | |
|
2cca907615 | |
|
19d52d9dcc | |
|
2d12bbb7fd | |
|
9175424d0f | |
|
b3a5e9e4e8 | |
|
22383c28e7 | |
|
5a4a136ec5 | |
|
ccaa02b8b5 | |
|
e370c0c96a | |
|
8a082be714 | |
|
d7dab2d20d | |
|
98cbcfc171 | |
|
40aab6bd18 | |
|
e4aff5531e | |
|
8e32635993 | |
|
e6713a0aec | |
|
5c798e6829 | |
|
18d9d1adcc | |
|
f1df81a7e4 | |
|
eb165ded65 | |
|
e78d5c61ee | |
|
f8b3f40276 | |
|
95d965fb76 | |
|
a96a4e2768 | |
|
94bde85ac6 | |
|
b222035112 | |
|
4119849284 | |
|
993c7b044f | |
|
92b06c4020 | |
|
03c905e6f1 | |
|
ed669bd314 | |
|
a780fb3311 | |
|
006f442cd0 | |
|
5bd8df68eb | |
|
dab3d9fe71 | |
|
016d6b5255 | |
|
10f72224ca | |
|
d52b813cd9 | |
|
e2c2a22dcf | |
|
7822a97430 | |
|
d00edd7209 | |
|
7dcbbd7173 | |
|
83da191f3a | |
|
be8615f129 | |
|
162e66276a | |
|
1051a5d921 | |
|
df360516ff | |
|
d739fe3785 | |
|
ac22caf74e | |
|
942920615c | |
|
d87e4d3bfd | |
|
dc51850030 | |
|
f231425982 | |
|
ad5d1011f8 | |
|
8c5cf03203 | |
|
d502dae068 | |
|
6733a172d7 | |
|
4f10089c90 | |
|
082e076377 | |
|
0dad7c49a4 | |
|
3125cad45a | |
|
849293f88c | |
|
7017f4c081 | |
|
066773e79f | |
|
910667d586 | |
|
cdcd86420e | |
|
ede95e6f7f | |
|
2133b51e78 | |
|
a04b53f4f8 | |
|
9bc8869715 | |
|
8bdda5f433 | |
|
267fc552d2 | |
|
3649699197 | |
|
e21e5e0490 | |
|
b5b193ca4c | |
|
d227d6dc73 | |
|
899b644a04 | |
|
0c8d8f26d9 | |
|
83a48e8958 | |
|
12f5101d84 | |
|
736f2e44bc | |
|
aa9465773c | |
|
512f39c7eb | |
|
2c1faa7244 | |
|
d3ccaddb70 | |
|
95dfc71b54 | |
|
e232e43d32 | |
|
67faa95b0b | |
|
d86c3cb159 | |
|
a815bf5ab4 | |
|
79a9656f48 | |
|
22555347ed | |
|
34654c7e20 | |
|
4f222fe256 | |
|
51a3915257 | |
|
d5efaf95c3 | |
|
9fc7f97950 | |
|
32dcabe826 | |
|
2c02671587 | |
|
db661bf3ac | |
|
45935f5fb8 | |
|
05fbcf6889 | |
|
d426f724cd | |
|
d65b2f35a7 | |
|
5b54d1d32e | |
|
dfd5edc000 | |
|
23705e6712 | |
|
244c455ca1 | |
|
4162d608e4 | |
|
2018be7fdc | |
|
afb0093939 | |
|
3b11a8305e | |
|
11c508cd11 | |
|
204825fa5a | |
|
4a05d7bb7c | |
|
f27629be4e | |
|
a8ccd54da5 | |
|
9ac11021e1 | |
|
ba27edc801 | |
|
7d9eb1e4a7 | |
|
487867285b | |
|
47f8d50beb | |
|
22c6daee32 | |
|
303ca82fb9 | |
|
ed1e1ebbd3 | |
|
00018e7e2b | |
|
0c7e49e654 | |
|
2cf5856961 | |
|
9a53fb0463 | |
|
611a66bf98 | |
|
d40a17f7e0 | |
|
315f33c9fe | |
|
37f4c853b2 | |
|
3cbcdb2d65 | |
|
41b471fb14 | |
|
b78978caed | |
|
f3a7f08f96 | |
|
a5d536201b | |
|
deb0d2d09a | |
|
9cdbef2b36 | |
|
437114c5dd | |
|
2d59aac5a1 | |
|
068ceb1d1a | |
|
2bf5234250 | |
|
265440b2bb | |
|
ce6ebcc021 | |
|
1449629479 | |
|
3a142f9726 | |
|
f794f65caa | |
|
e3331b0f44 | |
|
71e1102749 | |
|
52c4582f7b | |
|
06fab3f129 | |
|
aba218e6d7 | |
|
8d8936dfac | |
|
ac25fb495b | |
|
5e28c17cf4 | |
|
8e20173200 | |
|
6d666512c1 | |
|
0eb4ac7714 | |
|
6082d5f8d0 | |
|
04f4ae4569 | |
|
8f391e4d5a | |
|
bf69ef248e | |
|
25c7024cc4 | |
|
9e81517fe3 | |
|
0889b0ff06 | |
|
8392e3c1a8 | |
|
72517d3f82 | |
|
3adb53eb12 | |
|
226ec847a4 | |
|
6a56c7e749 | |
|
03052a65b8 | |
|
ca2c53dde7 | |
|
5908d9f060 | |
|
ee87291225 | |
|
5015dc80b1 | |
|
b9f7ff86de | |
|
083e464084 | |
|
98a4c13ca9 | |
|
bbed3f6608 | |
|
2f5dfed726 | |
|
bc9172fa74 | |
|
d3b4e94d06 | |
|
77917f5cc6 | |
|
908d38047c | |
|
c75975d59e | |
|
1ff8d57ea1 | |
|
7ce745a82d | |
|
01689ab788 | |
|
472174b744 | |
|
68f9671a22 | |
|
19e96b5131 | |
|
a11951e398 | |
|
b037288e5a | |
|
68a43eb497 | |
|
2c60229913 | |
|
b663e10841 | |
|
ba814f4213 | |
|
cedd360ebd | |
|
7d1fcb75d7 | |
|
2a716cf4a4 | |
|
020542a66c | |
|
042bd872bf | |
|
d8ebf591f9 | |
|
218b56b123 | |
|
f5a7e9d119 | |
|
d2efedf91c | |
|
5f2fb72c9c | |
|
26214491ef | |
|
0703e01492 | |
|
290355cf5a | |
|
460f2d5be5 | |
|
8c0777b669 | |
|
f674232f71 | |
|
5efd249786 | |
|
097dc6c9a4 | |
|
cb62ce20e6 | |
|
d988d8a8d1 | |
|
eb7b1882e1 | |
|
eacc379cf1 | |
|
811a769845 | |
|
f6e556e33f | |
|
4a58e2eb83 | |
|
128e6b4d1f | |
|
894978ddd7 | |
|
82c38f2426 | |
|
aae42fae9b | |
|
bd96c1161e | |
|
89cb6d85b9 | |
|
a9d6e329cd | |
|
8c0cfa0836 | |
|
539a7bc3bb | |
|
285266a6aa | |
|
af65189a82 | |
|
c425cdddc5 | |
|
62f4544dd2 | |
|
86edaf9a8a | |
|
8329fa19cc | |
|
fc3229f8d2 | |
|
ad8b618b46 | |
|
20241691b8 | |
|
c5420530b7 | |
|
ed84dca147 | |
|
9578aa874f | |
|
3d5f6aeec4 | |
|
e025e4c696 | |
|
19b72aead3 | |
|
9446fa9b9a | |
|
351ef2afa1 | |
|
e9f04cf8a7 | |
|
855d9acb53 | |
|
43a122fe18 | |
|
f89cbac21c | |
|
c8a0bfd361 | |
|
af09db6648 | |
|
39ae101266 | |
|
cf9eb8278a | |
|
758fd9c913 | |
|
0dc862156f | |
|
bb2038e8c6 | |
|
5bada0a83b | |
|
8f97171336 | |
|
f28fce9cc4 | |
|
b001f5a140 | |
|
85603193a2 | |
|
da984e5696 | |
|
f53a40d2ae | |
|
59f483f157 | |
|
a0fde8b83f | |
|
5ef048bfae | |
|
7d5c2736ce | |
|
18f8d2573b | |
|
ee7c4b1ede | |
|
9f5d662da7 | |
|
a2247bf655 | |
|
32c3ecd00e | |
|
a276589e40 | |
|
68c6f247a6 | |
|
2b400a9269 | |
|
4dae83b256 | |
|
e380cc3065 | |
|
59bcab6127 | |
|
7a5dfb71c2 | |
|
8fbc58cf5d | |
|
7b1a712c91 | |
|
8e87a4d845 | |
|
7bf772e2d6 | |
|
e0c7cd475b | |
|
efed9d8012 | |
|
e68062282a | |
|
86e18d04dd | |
|
6a4fac61f8 | |
|
68265b744d | |
|
d1fb8f5958 | |
|
5c504a5741 | |
|
3d6260adf8 | |
|
69ae4ff319 | |
|
8bfe8424fc | |
|
8512dba8ad | |
|
c2d0b748b2 | |
|
37ca0f9ba9 | |
|
cf74127f78 | |
|
0e592aa911 | |
|
7af7546d88 | |
|
abd72b6f10 | |
|
1d2df8d499 | |
|
da8d3654b8 | |
|
e82f0f2527 | |
|
7453bc096b | |
|
a72adc2731 | |
|
ec330a35a1 | |
|
a99ae786db | |
|
f794d10bb5 | |
|
7cc05581d1 | |
|
063b1bf51d | |
|
9fd00bd6ad | |
|
78b7f0cbea | |
|
3340b80972 | |
|
05cd538fa9 | |
|
823ef33a92 | |
|
e4274ef113 | |
|
03c0b116c7 | |
|
45361094e9 | |
|
793e4026fc | |
|
272c19c218 | |
|
595ff03804 | |
|
c461dabe9e | |
|
652bbd831f | |
|
9577ab5033 | |
|
bba72daedf | |
|
423188176f | |
|
869caf35ec | |
|
2bdbe5d918 | |
|
b6261c7387 | |
|
cd7d9b1977 | |
|
bbc54c7139 | |
|
f9d55a9384 | |
|
223c766320 | |
|
7e7497ae5a | |
|
449d53fc3f | |
|
cd1721334c | |
|
638975922e | |
|
88cd244e47 | |
|
1c9ed6ce32 | |
|
2b330fdc49 | |
|
7371ba225f | |
|
aa3a175364 | |
|
e10ca569f1 | |
|
ea07bcdb4c | |
|
a735dddc52 | |
|
2f33f44f4a | |
|
3f22cbce01 | |
|
4b937fda5b | |
|
95c812346d | |
|
c8dfb9ac76 | |
|
03772f612a | |
|
1076aac37d | |
|
de19c6bd36 | |
|
9a284150b2 | |
|
806d3efef9 | |
|
9ee33a81b7 | |
|
bbe1d2da31 | |
|
ddcc1dcc5c | |
|
34a1fd613f | |
|
ff087837bd | |
|
1e20e7c332 |
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"files": [
|
||||
"CONTRIBUTORS.md"
|
||||
],
|
||||
"imageSize": 100,
|
||||
"commit": false,
|
||||
"contributors": [
|
||||
{
|
||||
"login": "matrixes",
|
||||
"name": "matrixes",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/46491408?v=4",
|
||||
"profile": "https://github.com/matrixes",
|
||||
"contributions": [
|
||||
"blog"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
"badgeTemplate": "",
|
||||
"projectName": "docker-mailserver",
|
||||
"projectOwner": "docker-mailserver",
|
||||
"repoType": "github",
|
||||
"repoHost": "https://github.com",
|
||||
"skipCi": false,
|
||||
"commitConvention": "none"
|
||||
}
|
|
@ -1,3 +1,2 @@
|
|||
*
|
||||
!target
|
||||
!VERSION
|
||||
|
|
|
@ -8,6 +8,7 @@ root = true
|
|||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
@ -16,21 +17,9 @@ trim_trailing_whitespace = true
|
|||
# --- Specific ----------------------------------
|
||||
# -----------------------------------------------
|
||||
|
||||
[*.{yaml,yml,sh,bats}]
|
||||
indent_size = 2
|
||||
|
||||
[Makefile]
|
||||
[{Makefile,.gitmodules}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- Git Submodules ----------------------------
|
||||
# -----------------------------------------------
|
||||
|
||||
[{test/bats/**,test/test_helper/**}]
|
||||
indent_style = none
|
||||
indent_size = none
|
||||
end_of_line = none
|
||||
|
|
|
@ -0,0 +1,158 @@
|
|||
# Normalize line endings of all non-binary files to LF upon check-in (`git add` / `git commit`):
|
||||
* text=auto
|
||||
|
||||
#################################################
|
||||
### General ###################################
|
||||
#################################################
|
||||
|
||||
## GENERIC
|
||||
### CI + docs/mkdocs.yml
|
||||
*.yml text
|
||||
### Documentation (Project, Tests, Docs site)
|
||||
*.md text
|
||||
### TLS certs (test/files/) + DHE params (target/shared/)
|
||||
*.pem text
|
||||
*.pem.sha512sum text
|
||||
|
||||
#################################################
|
||||
### Project ###################################
|
||||
#################################################
|
||||
|
||||
## BUILD:
|
||||
.dockerignore text
|
||||
Dockerfile text eol=lf
|
||||
Makefile
|
||||
|
||||
## EXAMPLE (RUNTIME):
|
||||
*.env text
|
||||
*.yaml text
|
||||
|
||||
## PROJECT
|
||||
.editorconfig text export-ignore
|
||||
.gitattributes text export-ignore
|
||||
.gitignore text export-ignore
|
||||
.gitkeep text export-ignore
|
||||
.gitmodules text export-ignore
|
||||
LICENSE text
|
||||
|
||||
## SOURCE CODE
|
||||
*.sh text eol=lf
|
||||
### acme.json extractor (target/bin/)
|
||||
*.py text eol=lf
|
||||
### Only contain scripts (glob for extensionless)
|
||||
target/bin/** text eol=lf
|
||||
|
||||
#################################################
|
||||
### Config ####################################
|
||||
#################################################
|
||||
|
||||
## CONFIG
|
||||
### Contains all text files (glob for extensionless)
|
||||
target/amavis/** text
|
||||
target/fetchmail/** text
|
||||
target/getmail/** text
|
||||
target/opendkim/** text
|
||||
target/opendmarc/** text
|
||||
target/postgrey/** text
|
||||
target/postsrsd/** text
|
||||
### Generic target/ + test/config/
|
||||
*.cf text
|
||||
*.conf text
|
||||
### Dovecot
|
||||
*.ext text
|
||||
*.sieve text
|
||||
### Dovecot + Rspamd
|
||||
*.inc text
|
||||
### Fail2Ban + Postgrey (test/config/)
|
||||
*.local text
|
||||
### Postfix
|
||||
*.pcre text
|
||||
|
||||
#################################################
|
||||
### Tests #####################################
|
||||
#################################################
|
||||
|
||||
## BATS
|
||||
*.bash text eol=lf
|
||||
*.bats text eol=lf
|
||||
|
||||
## CONFIG (test/config/)
|
||||
### OpenLDAP image
|
||||
*.ldif text
|
||||
### OpenDKIM
|
||||
*.private text
|
||||
KeyTable text
|
||||
SigningTable text
|
||||
TrustedHosts text
|
||||
### Postgrey
|
||||
whitelist_recipients text
|
||||
|
||||
## MISC
|
||||
### test/config/ + test/files/
|
||||
*.txt text
|
||||
### test/linting/ (.ecrc.json) + test/files/ (*.acme.json):
|
||||
*.json text
|
||||
|
||||
#################################################
|
||||
### Documentation Website #####################
|
||||
#################################################
|
||||
|
||||
## DOCUMENTATION
|
||||
### docs/content/assets/
|
||||
*.css text
|
||||
*.png binary
|
||||
*.svg text -diff
|
||||
*.woff binary
|
||||
### docs/overrides/
|
||||
*.html text
|
||||
*.ico binary
|
||||
*.webp binary
|
||||
|
||||
#################################################
|
||||
### Info # #####################################
|
||||
#################################################
|
||||
|
||||
### WHAT IS THIS FILE?
|
||||
# `.gitattributes` - Pattern-based overrides (Project specific)
|
||||
# Documentation: https://git-scm.com/docs/gitattributes
|
||||
#
|
||||
# Travels with the project and can override the defaults from `.gitconfig`.
|
||||
# This helps to enforce consistent line endings (CRLF / LF) where needed via
|
||||
# patterns (_when the git client supports `.gitattributes`_).
|
||||
|
||||
# `.gitconfig` - Global Git defaults (Dev environment)
|
||||
# Documentation: https://git-scm.com/docs/git-config
|
||||
#
|
||||
# Git settings `core.autocrlf` and `core.eol` can vary across dev environments.
|
||||
# Those defaults can introduce subtle bugs due to incompatible line endings.
|
||||
|
||||
|
||||
### WHY SHOULD I CARE?
|
||||
# The desired result is to ensure the repo contains normalized LF line endings,
|
||||
# notably avoiding unhelpful noise in diffs or issues incurred from mixed line
|
||||
# endings. Storing as LF ensures no surprises for line endings during checkout.
|
||||
# Additionally for checkout to the local working directory, line endings can be
|
||||
# forced to CRLF or LF per file where appropriate, which ensures the files have
|
||||
# compatible line endings where software expects a specific kind.
|
||||
#
|
||||
# Examples:
|
||||
# Diffs with nothing visual changed. Line endings appear invisible.
|
||||
# Tests that compare text from two sources where only line endings differ fail.
|
||||
# /bin/sh with a shebang fails to run a binary at the given path due to a CRLF.
|
||||
|
||||
|
||||
### ATTRIBUTES
|
||||
# `text` normalizes the line endings of a file to LF upon commit (CRLF -> LF).
|
||||
# `text=auto` sets `text` if Git doesn't consider the file as binary data.
|
||||
|
||||
# `eol` sets an explicit line ending to write files to the working directory.
|
||||
# `core.eol` is used for any files not explicitly set with an `eol` attr value.
|
||||
# `core.eol` uses the native line endings for your platform by default.
|
||||
# `core.autocrlf` (if set to `true` or `input`) overrides the `core.eol` value.
|
||||
|
||||
# `binary` is an alias for `-text -diff`. The file won't be normalized (-text).
|
||||
# `-diff` indicates to avoid creating a diff. Useful when diffs are unlikely
|
||||
# to be meaningful, such as generated content (SVG, Source Maps, Lockfiles).
|
||||
|
||||
# `export-ignore` excludes matched files and directories during `git archive`,
|
||||
# which services like Github use to create releases with archived source files.
|
|
@ -1,172 +1,69 @@
|
|||
name: Bug Report
|
||||
description: File a bug report
|
||||
description: Submit a bug report to help us improve
|
||||
title: 'bug report: '
|
||||
labels:
|
||||
- kind/bug/report
|
||||
- meta/bug/needs triage
|
||||
- meta/needs triage
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# Filing a report
|
||||
|
||||
Thank you for participating in this project and reporting a bug. Docker Mail Server (DMS) is a community-driven project, and each contribution counts. Maintainers and moderators are volunteers that need you to fill this template with accurate information in order to help you in the best and quickest way. We will have to label your request with `meta/no template - no support` if your request is sloppy and provides no way to help you correctly.
|
||||
|
||||
Markdown formatting can be used in almost all text fields. The description will tell you if this is not the case for a specific field.
|
||||
|
||||
Be as precise as possible, and if in doubt, it's best to add more information that too few.
|
||||
|
||||
We provide official support for all options not marked with "not officially supported" or "unsupported". When something is "not officially supported", support for these cases is dependent on specific maintainers.
|
||||
|
||||
---
|
||||
- type: checkboxes
|
||||
id: preliminary-checks
|
||||
attributes:
|
||||
label: Preliminary Checks
|
||||
description: Please read these carefully.
|
||||
label: 📝 Preliminary Checks
|
||||
description: |
|
||||
By submitting this issue, you agree to our [Code of Conduct](https://github.com/docker-mailserver/docker-mailserver/blob/master/CODE_OF_CONDUCT.md).
|
||||
options:
|
||||
- label: I checked that all ports are open and not blocked by my ISP / hosting provider.
|
||||
- label: I tried searching for an existing issue and followed the [debugging docs](https://docker-mailserver.github.io/docker-mailserver/latest/config/debugging/) advice, but still need assistance.
|
||||
required: true
|
||||
- label: I know that SSL errors are likely the result of a wrong setup on the user side and not caused by DMS itself. I'm confident my setup is correct.
|
||||
required: true
|
||||
- label: I searched the issue tracker but was unable to find my issue.
|
||||
required: true
|
||||
- label: I read the [extended documentation in general](https://docker-mailserver.github.io/docker-mailserver/latest/) but found nothing to resolve the issue.
|
||||
required: true
|
||||
- label: I read the [documentation on debugging](https://docker-mailserver.github.io/docker-mailserver/latest/config/debugging/), tried the proposed steps to debug the problem, but was still unable to resolve the issue.
|
||||
required: true
|
||||
- type: input
|
||||
id: affected-components
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: Affected Component(s)
|
||||
description: What is affected by this bug? Please describe it with only a few words here. Detailed description can be given later.
|
||||
placeholder: No debug output is shown.
|
||||
label: 👀 What Happened?
|
||||
description: How did this differ from your expectations?
|
||||
placeholder: Although `LOG_LEVEL=debug` is set, the logs are missing debug output.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: when-does-it-occur
|
||||
id: steps-to-reproduce
|
||||
attributes:
|
||||
label: What happened and when does this occur?
|
||||
description: Tell us what happened. Use [fenced code blocks](https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#fenced-code-blocks) when pasting lots of text!
|
||||
placeholder: Although `LOG_LEVEL=debug` is set, I see no debug output.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: what-did-you-expect-to-happen
|
||||
attributes:
|
||||
label: What did you expect to happen?
|
||||
description: Tell us what you expected.
|
||||
placeholder: I expected to see debug messages.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: how-do-we-replicate-this-issue
|
||||
attributes:
|
||||
label: How do we replicate the issue?
|
||||
description: What did you do and how can we replicate this issue?
|
||||
value: |
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
...
|
||||
validations:
|
||||
required: true
|
||||
label: 👟 Reproduction Steps
|
||||
description: |
|
||||
How did you trigger this bug? Please walk us through it step by step.
|
||||
Please use [fenced code blocks](https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#fenced-code-blocks) when pasting lots of text!
|
||||
placeholder: The easier it is for us to reproduce your issue, the sooner we can help resolve it 😉
|
||||
- type: input
|
||||
id: mailserver-version
|
||||
attributes:
|
||||
label: DMS version
|
||||
label: 🐋 DMS Version
|
||||
description: On which version (image tag) did you encounter this bug?
|
||||
placeholder: v10.1.2
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: operating-system
|
||||
attributes:
|
||||
label: What operating system is DMS running on?
|
||||
options:
|
||||
- Linux
|
||||
- macOS (not officially supported)
|
||||
- Windows (unsupported)
|
||||
- Other (unsupported)
|
||||
placeholder: v12.1.0 (do not put "latest")
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: operating-system-version
|
||||
id: operating-system
|
||||
attributes:
|
||||
label: Which operating system version?
|
||||
placeholder: e.g. Debian 11
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: isa
|
||||
attributes:
|
||||
label: What instruction set architecture is DMS running on?
|
||||
options:
|
||||
- AMD64 / x86_64
|
||||
- ARM64 / AArch64 (ARM v8 and newer)
|
||||
- Other (unsupported)
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: container-orchestrator
|
||||
attributes:
|
||||
label: What container orchestration tool are you using?
|
||||
options:
|
||||
- Docker
|
||||
- Docker Compose
|
||||
- Podman (not officially supported)
|
||||
- Kubernetes (not officially supported)
|
||||
- Other (unsupported)
|
||||
label: 💻 Operating System and Architecture
|
||||
description: |
|
||||
Which OS is your docker host running on?
|
||||
**NOTE:** Windows and macOS have limited support.
|
||||
placeholder: Debian 11 (Bullseye) x86_64, Fedora 38 ARM64
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: important-environment-variables
|
||||
id: container-configuration-files
|
||||
attributes:
|
||||
label: docker-compose.yml
|
||||
description: Show us your `docker-compose.yml` file or your equivalent `docker run` command, if applicable. This filed is formatted as YAML.
|
||||
label: ⚙️ Container configuration files
|
||||
description: |
|
||||
Show us the `compose.yaml` file or command that you used to run DMS (and possibly other related services).
|
||||
- This field is formatted as YAML.
|
||||
- If you are using Kubernetes, you can alternatively share your manifest files here.
|
||||
render: yml
|
||||
- type: textarea
|
||||
id: relevant-log-output
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Show us relevant log output here. You can enable debug output by setting the environment variable `LOG_LEVEL` to `debug` or `trace`. This field's contents are interpreted as pure text.
|
||||
label: 📜 Relevant log output
|
||||
description: |
|
||||
Show us relevant log output here.
|
||||
- This field expects only plain text (_rendered as a fenced code block_).
|
||||
- You can enable debug output by setting the environment variable `LOG_LEVEL` to `debug` or `trace`.
|
||||
render: Text
|
||||
- type: textarea
|
||||
id: other-relevant-information
|
||||
attributes:
|
||||
label: Other relevant information
|
||||
description: If there is more, you can tell us here.
|
||||
- type: checkboxes
|
||||
id: experience
|
||||
attributes:
|
||||
label: What level of experience do you have with Docker and mail servers?
|
||||
description: >
|
||||
**You are not obliged to answer this question**.
|
||||
We do encourage answering though as it provides context to better assist you.
|
||||
Less experienced users tend to make common mistakes, which is ok; by letting us know we can spot those more easily. If you are experienced, we can skip basic questions and save time.
|
||||
|
||||
options:
|
||||
- label: I am inexperienced with docker
|
||||
- label: I am rather experienced with docker
|
||||
- label: I am inexperienced with mail servers
|
||||
- label: I am rather experienced with mail servers
|
||||
- label: I am uncomfortable with the CLI
|
||||
- label: I am rather comfortable with the CLI
|
||||
- type: checkboxes
|
||||
id: terms-code-of-conduct
|
||||
attributes:
|
||||
label: Code of conduct
|
||||
description: By submitting this issue, you agree to follow [our code of conduct](https://github.com/docker-mailserver/docker-mailserver/blob/master/CODE_OF_CONDUCT.md).
|
||||
options:
|
||||
- label: I have read this project's [Code of Conduct](https://github.com/docker-mailserver/docker-mailserver/blob/master/CODE_OF_CONDUCT.md) and I agree
|
||||
required: true
|
||||
- label: I have read the [README](https://github.com/docker-mailserver/docker-mailserver/blob/master/README.md) and the [documentation](https://docker-mailserver.github.io/docker-mailserver/edge/) and I searched the [issue tracker](https://github.com/docker-mailserver/docker-mailserver/issues?q=is%3Aissue) but could not find a solution
|
||||
required: true
|
||||
- type: input
|
||||
id: form-improvements
|
||||
attributes:
|
||||
label: Improvements to this form?
|
||||
description: If you have criticism or general feedback about this issue form, feel free to tell us so we can enhance the experience for everyone.
|
||||
validations:
|
||||
required: false
|
||||
|
|
|
@ -4,6 +4,8 @@ title: 'feature request: '
|
|||
labels:
|
||||
- kind/new feature
|
||||
- meta/needs triage
|
||||
projects:
|
||||
- DMS Core Backlog
|
||||
|
||||
body:
|
||||
- type: markdown
|
|
@ -1,18 +1,10 @@
|
|||
name: Other
|
||||
description: Miscellaneous questions and reports
|
||||
description: Miscellaneous questions and reports for the project (not support)
|
||||
title: 'other: '
|
||||
labels:
|
||||
- meta/help wanted
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Markdown formatting can be used in almost all text fields. The description will tell you if this is not the case for a specific field.
|
||||
|
||||
Be as precise as possible, and if in doubt, it's best to add more information that too few.
|
||||
|
||||
---
|
||||
- type: dropdown
|
||||
id: subject
|
||||
attributes:
|
||||
|
@ -21,13 +13,18 @@ body:
|
|||
- I would like to contribute to the project
|
||||
- I would like to configure a not documented mail server use case
|
||||
- I would like some feedback concerning a use case
|
||||
- I have questions about TLS/SSL/STARTTLS/OpenSSL
|
||||
- Other
|
||||
- Something else that requires developers attention
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: Description
|
||||
value: |
|
||||
<!---
|
||||
Please do not use this form to bypass doing a proper bug report.
|
||||
The issue tracker is for anything relevant to the project itself, not individual support queries.
|
||||
If you don't want to fill out a bug report, please ask support questions at our community discussions page: https://github.com/orgs/docker-mailserver/discussions
|
||||
-->
|
||||
|
|
|
@ -4,8 +4,6 @@ updates:
|
|||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
reviewers:
|
||||
- "docker-mailserver/maintainers"
|
||||
labels:
|
||||
- "area/ci"
|
||||
- "kind/update"
|
||||
|
@ -15,8 +13,6 @@ updates:
|
|||
directory: /
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
reviewers:
|
||||
- "docker-mailserver/maintainers"
|
||||
labels:
|
||||
- "area/ci"
|
||||
- "kind/update"
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# Description
|
||||
|
||||
<!-- Include a summary of the change.
|
||||
Please also include relevant motivation and context. -->
|
||||
<!--
|
||||
Include a summary of the change.
|
||||
Please also include relevant motivation and context.
|
||||
-->
|
||||
|
||||
<!-- Link the issue which will be fixed (if any) here: -->
|
||||
Fixes #
|
||||
|
@ -16,11 +18,12 @@ Fixes #
|
|||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] This change requires a documentation update
|
||||
|
||||
## Checklist:
|
||||
## Checklist
|
||||
|
||||
- [ ] My code follows the style guidelines of this project
|
||||
- [ ] I have performed a self-review of my own code
|
||||
- [ ] I have performed a self-review of my code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation (README.md or the documentation under `docs/`)
|
||||
- [ ] If necessary I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] If necessary, I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
- [ ] **I have added information about changes made in this PR to `CHANGELOG.md`**
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
name: Update contributors
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 1 * *'
|
||||
|
||||
jobs:
|
||||
delete-old-branch:
|
||||
runs-on: ubuntu-22.04
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Delete old contributors-update branch
|
||||
uses: dawidd6/action-delete-branch@v3
|
||||
with:
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
branches: contributors-update
|
||||
|
||||
add-contributors:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: delete-old-branch
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Create contributors-update branch
|
||||
uses: peterjgrainger/action-create-branch@v2.4.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
branch: 'contributors-update'
|
||||
|
||||
- name: Auto-add contributors
|
||||
uses: BobAnkh/add-contributors@v0.2.2
|
||||
with:
|
||||
BRANCH: 'contributors-update'
|
||||
PULL_REQUEST: 'master'
|
||||
CONTRIBUTOR: '## Contributors'
|
||||
COLUMN_PER_ROW: '6'
|
||||
ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
IMG_WIDTH: '100'
|
||||
FONT_SIZE: '14'
|
||||
PATH: '/CONTRIBUTORS.md'
|
||||
COMMIT_MESSAGE: 'docs(CONTRIBUTORS): update contributors'
|
||||
AVATAR_SHAPE: 'round'
|
||||
|
||||
# This workflow will not trigger a `pull_request` event without a PAT.
|
||||
# The lint workflow is not important for this type of PR, skip it and pretend it was successful:
|
||||
- name: 'Get the latest commit hash from the contributors-update branch'
|
||||
id: commit-data
|
||||
run: |
|
||||
git pull
|
||||
git checkout contributors-update
|
||||
echo "head_sha=$(git rev-parse contributors-update)" >>"${GITHUB_OUTPUT}"
|
||||
|
||||
- name: 'Commit Status: Set Lint status to success (skipped)'
|
||||
uses: myrotvorets/set-commit-status-action@1.1.6
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Skipped workflows are still assigned a "success" status:
|
||||
status: success
|
||||
# This should be the correct commit SHA on the contributors-update branch:
|
||||
sha: ${{ steps.commit-data.outputs.head_sha }}
|
||||
# Name of status check to add/update:
|
||||
context: 'lint'
|
||||
# Optional message/note we can inline to the right of the context name in the UI:
|
||||
description: "Lint skipped. Not relevant."
|
|
@ -1,120 +1,166 @@
|
|||
name: 'Documentation (run)'
|
||||
name: 'Documentation (Deploy)'
|
||||
|
||||
on:
|
||||
# This workflow runs off the primary branch which provides access to the `secrets` context:
|
||||
workflow_run:
|
||||
workflows: ['Documentation (PR)']
|
||||
types:
|
||||
- completed
|
||||
|
||||
# Note: If limiting concurrency is required for this workflow:
|
||||
# 1. Add an additional job prior to `preview` to get the PR number make it an output.
|
||||
# 2. Assign that new job as a `needs` dependency for the `preview` job.
|
||||
# It is still required for `preview` job to download the artifact so that it can access the preview build files.
|
||||
permissions:
|
||||
# Required by `actions/download-artifact`:
|
||||
actions: read
|
||||
# Required by `set-pr-context`:
|
||||
contents: read
|
||||
# Required by `marocchino/sticky-pull-request-comment` (write) + `set-pr-context` (read):
|
||||
pull-requests: write
|
||||
# Required by `myrotvorets/set-commit-status-action`:
|
||||
statuses: write
|
||||
|
||||
# This workflow runs off the primary branch and has access to secrets as expected.
|
||||
jobs:
|
||||
preview:
|
||||
name: 'Deploy Preview'
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
|
||||
# NOTE: This is handled as pre-requisite job to minimize the noise from acquiring these two outputs needed for `deploy-preview` ENV:
|
||||
pr-context:
|
||||
name: 'Acquire PR Context'
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
PR_HEADSHA: ${{ steps.set-pr-context.outputs.head-sha }}
|
||||
PR_NUMBER: ${{ steps.set-pr-context.outputs.number }}
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
|
||||
steps:
|
||||
- name: 'Get PR context'
|
||||
id: set-pr-context
|
||||
env:
|
||||
# Token is required for the GH CLI:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
# Best practice for scripts is to reference via ENV at runtime. Avoid using GHA context expressions in the script content directly:
|
||||
# https://github.com/docker-mailserver/docker-mailserver/pull/4247#discussion_r1827067475
|
||||
PR_TARGET_REPO: ${{ github.repository }}
|
||||
# If the PR is from a fork, prefix it with `<owner-login>:`, otherwise only the PR branch name is relevant:
|
||||
PR_BRANCH: |-
|
||||
${{
|
||||
(github.event.workflow_run.head_repository.owner.login != github.event.workflow_run.repository.owner.login)
|
||||
&& format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch)
|
||||
|| github.event.workflow_run.head_branch
|
||||
}}
|
||||
# Use the GH CLI to query the PR branch, which provides the PR number and head SHA to assign as outputs:
|
||||
# (`--jq` formats JSON to `key=value` pairs and renames `headRefOid` to `head-sha`)
|
||||
run: |
|
||||
gh pr view --repo "${PR_TARGET_REPO}" "${PR_BRANCH}" \
|
||||
--json 'number,headRefOid' \
|
||||
--jq '"number=\(.number)\nhead-sha=\(.headRefOid)"' \
|
||||
>> "${GITHUB_OUTPUT}"
|
||||
|
||||
# ======================== #
|
||||
# Restore workflow context #
|
||||
# ======================== #
|
||||
|
||||
# The official Github Action for downloading artifacts does not support multi-workflow
|
||||
- name: 'Download build artifact'
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
deploy-preview:
|
||||
name: 'Deploy Preview'
|
||||
runs-on: ubuntu-24.04
|
||||
needs: [pr-context]
|
||||
env:
|
||||
# NOTE: Keep this in sync with the equivalent ENV in `docs-preview-prepare.yml`:
|
||||
BUILD_DIR: docs/site/
|
||||
# PR head SHA (latest commit):
|
||||
PR_HEADSHA: ${{ needs.pr-context.outputs.PR_HEADSHA }}
|
||||
PR_NUMBER: ${{ needs.pr-context.outputs.PR_NUMBER }}
|
||||
# Deploy URL preview prefix (the site name for this prefix is managed at Netlify):
|
||||
PREVIEW_SITE_PREFIX: pullrequest-${{ needs.pr-context.outputs.PR_NUMBER }}
|
||||
steps:
|
||||
- name: 'Retrieve and extract the built docs preview'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
workflow: docs-preview-prepare.yml
|
||||
name: preview-build
|
||||
|
||||
- name: 'Extract build artifact'
|
||||
run: tar -xf artifact.tar.zst
|
||||
|
||||
- name: 'Restore preserved ENV'
|
||||
run: cat pr.env >> "${GITHUB_ENV}"
|
||||
path: ${{ env.BUILD_DIR }}
|
||||
# These are needed due this approach relying on `workflow_run`, so that it can access the build artifact:
|
||||
# (uploaded from the associated `docs-preview-prepare.yml` workflow run)
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
|
||||
# ==================== #
|
||||
# Deploy preview build #
|
||||
# ==================== #
|
||||
|
||||
# Manage workflow deployment status. `enable-commit-status` from `nwtgck/actions-netlify` would handle this,
|
||||
# but presently does not work correctly via split workflow. It is useful in a split workflow as the 1st stage
|
||||
# no longer indicates if the entire workflow/deployment was successful.
|
||||
- name: 'Commit Status: Set Workflow Status as Pending'
|
||||
uses: myrotvorets/set-commit-status-action@1.1.6
|
||||
# Manage workflow deployment status (Part 1/2):
|
||||
# NOTE:
|
||||
# - `workflow_run` trigger does not appear on the PR/commit checks status, only the initial prepare workflow triggered.
|
||||
# This adds our own status check for this 2nd half of the workflow starting as `pending`, followed by `success` / `failure` at the end.
|
||||
# - `enable-commit-status` from `nwtgck/actions-netlify` would have handled this,
|
||||
# but the context `github.sha` that action tries to use references the primary branch commit that this workflow runs from, not the relevant PR commit.
|
||||
- name: 'Commit Status (1/2) - Set Workflow Status as Pending'
|
||||
uses: myrotvorets/set-commit-status-action@v2.0.1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
status: pending
|
||||
# Should match `env.PR_HEADSHA` when triggered by `pull_request` event workflow,
|
||||
# Avoids failure of ENV being unavailable if job fails early:
|
||||
sha: ${{ github.event.workflow_run.head_sha }}
|
||||
sha: ${{ env.PR_HEADSHA }}
|
||||
context: 'Deploy Preview (pull_request => workflow_run)'
|
||||
|
||||
- name: 'Send preview build to Netlify'
|
||||
uses: nwtgck/actions-netlify@v2.0
|
||||
id: preview
|
||||
uses: nwtgck/actions-netlify@v3.0
|
||||
id: preview-netlify
|
||||
timeout-minutes: 1
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Fail the job early if credentials are missing / invalid:
|
||||
# Fail the job when the required Netlify credentials are missing from ENV:
|
||||
fails-without-credentials: true
|
||||
# Sets/creates the Netlify deploy URL prefix.
|
||||
# Uses the PR number for uniqueness:
|
||||
alias: ${{ env.NETLIFY_SITE_PREFIX }}
|
||||
# Set/create the Netlify deploy URL prefix:
|
||||
alias: ${{ env.PREVIEW_SITE_PREFIX }}
|
||||
# Only publish the contents of the build output:
|
||||
publish-dir: ${{ env.BUILD_DIR }}
|
||||
# Custom message for the deploy log on Netlify:
|
||||
deploy-message: '${{ env.PR_TITLE }} (PR #${{ env.PR_NUMBER }} @ commit: ${{ env.PR_HEADSHA }})'
|
||||
deploy-message: 'Preview Build (PR #${{ env.PR_NUMBER }} @ commit: ${{ env.PR_HEADSHA }}'
|
||||
|
||||
# Note: Split workflow incorrectly references latest primary branch commit for deployment.
|
||||
# Assign to non-default Deployment Environment for better management:
|
||||
github-deployment-environment: documentation-previews
|
||||
github-deployment-description: 'Preview deploy for documentation PRs'
|
||||
|
||||
# Note - PR context used by this action is incorrect. These features are broken with split workflow:
|
||||
# https://github.com/nwtgck/actions-netlify/issues/545
|
||||
# Disable unwanted action defaults:
|
||||
# Disable adding deploy comment on pre-merge commit (Github creates this for PR diff):
|
||||
# This input does not fallback to the GITHUB_TOKEN taken from context, nor log that it will skip extra features of the action when this input is not set:
|
||||
# https://github.com/nwtgck/actions-netlify/issues/1219
|
||||
# github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# NOTE: These features won't work correctly when the triggered workflow is not run from the PR branch due to assumed `pull_request` context:
|
||||
# https://github.com/nwtgck/actions-netlify/issues/545
|
||||
# Disable adding a comment to the commit belonging to context `github.sha` about the successful deployment (redundant and often wrong commit):
|
||||
enable-commit-comment: false
|
||||
# Disable adding a "Netlify - Netlify deployment" check status:
|
||||
# Disable adding a "Netlify - Netlify deployment" PR check status (workflow job status is sufficient):
|
||||
enable-commit-status: false
|
||||
# Disable. We provide a custom PR comment in the next action:
|
||||
# Disable adding a comment about successful deployment status to the PR.
|
||||
# Prefer `marocchino/sticky-pull-request-comment` instead (more flexible and allows custom message):
|
||||
enable-pull-request-comment: false
|
||||
# Opt-out of deployment feature:
|
||||
# NOTE:
|
||||
# - When affected by `nwtgck/actions-netlify/issues/545`, the deployments published reference the wrong commit and thus information.
|
||||
# - While the feature creates or assigns a deployment to associate the build with, it is unrelated to the related environments feature (secrets/vars):
|
||||
# https://github.com/nwtgck/actions-netlify/issues/538#issuecomment-833983970
|
||||
# https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-deployments/viewing-deployment-history
|
||||
# https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-deployments/managing-environments-for-deployment
|
||||
enable-github-deployment: false
|
||||
# Assign to non-default Deployment Environment for better management:
|
||||
# github-deployment-environment: documentation-previews
|
||||
# github-deployment-description: 'Preview deploy for documentation PRs'
|
||||
|
||||
# If a `netlify.toml` config is ever needed, enable this:
|
||||
# netlify-config-path: ./docs/netlify.toml
|
||||
# If ever switching from Github Pages, enable this conditionally (false by default):
|
||||
# If ever switching from Github Pages, enable this only when not deploying a preview build (false by default):
|
||||
# production-deploy: false
|
||||
|
||||
- name: 'Comment on PR: Add/Update deployment status'
|
||||
- name: 'Comment on PR with preview link'
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
number: ${{ env.PR_NUMBER }}
|
||||
header: preview-comment
|
||||
recreate: true
|
||||
message: |
|
||||
[Documentation preview for this PR](${{ steps.preview.outputs.deploy-url }}) is ready! :tada:
|
||||
[Documentation preview for this PR](${{ steps.preview-netlify.outputs.deploy-url }}) is ready! :tada:
|
||||
|
||||
Built with commit: ${{ env.PR_HEADSHA }}
|
||||
|
||||
- name: 'Commit Status: Update deployment status'
|
||||
uses: myrotvorets/set-commit-status-action@1.1.6
|
||||
# Always run this step regardless of job failing early:
|
||||
# Manage workflow deployment status (Part 2/2):
|
||||
- name: 'Commit Status (2/2) - Update deployment status'
|
||||
uses: myrotvorets/set-commit-status-action@v2.0.1
|
||||
# Always run this step regardless of the job failing early:
|
||||
if: ${{ always() }}
|
||||
# Custom status descriptions:
|
||||
env:
|
||||
DEPLOY_SUCCESS: Successfully deployed preview.
|
||||
DEPLOY_FAILURE: Failed to deploy preview.
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
status: ${{ job.status == 'success' && 'success' || 'failure' }}
|
||||
sha: ${{ github.event.workflow_run.head_sha }}
|
||||
sha: ${{ env.PR_HEADSHA }}
|
||||
context: 'Deploy Preview (pull_request => workflow_run)'
|
||||
description: ${{ job.status == 'success' && env.DEPLOY_SUCCESS || env.DEPLOY_FAILURE }}
|
||||
|
|
|
@ -7,74 +7,68 @@ on:
|
|||
- '.github/workflows/scripts/docs/build-docs.sh'
|
||||
- '.github/workflows/docs-preview-prepare.yml'
|
||||
|
||||
# If the workflow for a PR is triggered multiple times, previous existing runs will be canceled.
|
||||
# eg: Applying multiple suggestions from a review directly via the Github UI.
|
||||
# Instances of the 2nd phase of this workflow (via `workflow_run`) presently lack concurrency limits due to added complexity.
|
||||
# If this workflow is triggered while already running for the PR, cancel any earlier running instances:
|
||||
# Instances of the 2nd phase of this workflow (via `workflow_run`) lack any concurrency limits due to added complexity.
|
||||
concurrency:
|
||||
group: deploypreview-pullrequest-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# Build output directory (created by the mkdocs-material container, keep this in sync with `build-docs.sh`):
|
||||
BUILD_DIR: docs/site/
|
||||
# These two are only needed to construct `PREVIEW_URL`:
|
||||
PREVIEW_SITE_NAME: dms-doc-previews
|
||||
PREVIEW_SITE_PREFIX: pullrequest-${{ github.event.pull_request.number }}
|
||||
|
||||
# `pull_request` workflow is unreliable alone: Non-collaborator contributions lack access to secrets for security reasons.
|
||||
# A separate workflow (docs-preview-deploy.yml) handles the deploy after the potentially untrusted code is first run in this workflow.
|
||||
# See: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
|
||||
permissions:
|
||||
# Required by `actions/checkout` for git checkout:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
prepare-preview:
|
||||
name: 'Build Preview'
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
BUILD_DIR: docs/site
|
||||
NETLIFY_SITE_PREFIX: pullrequest-${{ github.event.pull_request.number }}
|
||||
NETLIFY_SITE_NAME: dms-doc-previews
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# ================== #
|
||||
# Build docs preview #
|
||||
# ================== #
|
||||
|
||||
- name: 'Build with mkdocs-material via Docker'
|
||||
working-directory: docs
|
||||
working-directory: docs/
|
||||
env:
|
||||
PREVIEW_URL: 'https://${NETLIFY_SITE_PREFIX}--${NETLIFY_SITE_NAME}.netlify.app/'
|
||||
NETLIFY_BRANDING: '<a href="https://www.netlify.com/"><img alt="Deploys by Netlify" src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" style="float: right;"></a>'
|
||||
PREVIEW_URL: 'https://${{ env.PREVIEW_SITE_PREFIX }}--${{ env.PREVIEW_SITE_NAME }}.netlify.app/'
|
||||
run: |
|
||||
# Adjust mkdocs.yml for preview build
|
||||
sed -i "s|^site_url:.*|site_url: '${PREVIEW_URL}'|" mkdocs.yml
|
||||
# Adjust `mkdocs.yml` for the preview build requirements:
|
||||
# - Replace production `site_url` with the preview URL (only affects the canonical link: https://en.wikipedia.org/wiki/Canonical_link_element#HTML)
|
||||
# - Prepend Netlify logo link to `copyright` content
|
||||
sed -i "s|^site_url:.*|site_url: '${{ env.PREVIEW_URL }}'|" mkdocs.yml
|
||||
|
||||
# Insert sponsor branding into page content (Provider OSS plan requirement):
|
||||
# Upstream does not provide a nicer maintainable way to do this..
|
||||
# Prepends HTML to copyright text and then aligns to the right side.
|
||||
# Insert branding into page content (Netlify OSS plan requirement):
|
||||
# - `mkdocs-material` does not provide a better way to do this.
|
||||
# - Prepends HTML to the copyright text and then aligns the logo to the right-side of the page.
|
||||
NETLIFY_BRANDING='<a href="https://www.netlify.com/"><img alt="Deploys by Netlify" src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" style="float: right;"></a>'
|
||||
sed -i "s|^copyright: '|copyright: '${NETLIFY_BRANDING}|" mkdocs.yml
|
||||
# Need to override a CSS media query for parent element to always be full width:
|
||||
# Override a CSS media query for the parent element to always be full width:
|
||||
echo '.md-footer-copyright { width: 100%; }' >> content/assets/css/customizations.css
|
||||
|
||||
../.github/workflows/scripts/docs/build-docs.sh
|
||||
# Build and prepare for upload:
|
||||
echo "::group::Build (stdout)"
|
||||
bash ../.github/workflows/scripts/docs/build-docs.sh
|
||||
echo "::endgroup::"
|
||||
|
||||
# ============================== #
|
||||
# Volley over to secure workflow #
|
||||
# ============================== #
|
||||
|
||||
# Minimize risk of upload failure by bundling files to a single compressed archive (tar + zstd).
|
||||
# Bundles build dir and env file into a compressed archive, nested file paths will be preserved.
|
||||
- name: 'Prepare artifact for transfer'
|
||||
env:
|
||||
# As a precaution, reference this value by an interpolated ENV var;
|
||||
# instead of interpolating user controllable input directly in the shell script..
|
||||
# https://github.com/docker-mailserver/docker-mailserver/issues/2332#issuecomment-998326798
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
run: |
|
||||
# Save ENV for transfer
|
||||
{
|
||||
echo "PR_HEADSHA=${{ github.event.pull_request.head.sha }}"
|
||||
echo "PR_NUMBER=${{ github.event.pull_request.number }}"
|
||||
echo "PR_TITLE=${PR_TITLE}"
|
||||
echo "NETLIFY_SITE_PREFIX=${{ env.NETLIFY_SITE_PREFIX }}"
|
||||
echo "BUILD_DIR=${{ env.BUILD_DIR }}"
|
||||
} >> pr.env
|
||||
tar --zstd -cf artifact.tar.zst pr.env ${{ env.BUILD_DIR }}
|
||||
|
||||
# Archives directory `path` into a ZIP file:
|
||||
- name: 'Upload artifact for workflow transfer'
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: preview-build
|
||||
path: artifact.tar.zst
|
||||
path: ${{ env.BUILD_DIR }}
|
||||
retention-days: 1
|
||||
|
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
name: 'Deploy Docs'
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 'Check if deploy is for a `v<major>.<minor>` tag version instead of `edge`'
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
|
@ -59,7 +59,7 @@ jobs:
|
|||
{} +
|
||||
|
||||
- name: 'Deploy to Github Pages'
|
||||
uses: peaceiris/actions-gh-pages@v3.9.3
|
||||
uses: peaceiris/actions-gh-pages@v4.0.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Build directory contents to publish to the `gh-pages` branch:
|
||||
|
@ -79,10 +79,10 @@ jobs:
|
|||
needs: deploy
|
||||
steps:
|
||||
- name: 'Checkout the tagged commit (shallow clone)'
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 'Checkout the docs deployment branch to a subdirectory'
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: gh-pages
|
||||
path: gh-pages
|
||||
|
@ -115,7 +115,7 @@ jobs:
|
|||
needs: add-version-to-docs
|
||||
steps:
|
||||
- name: 'Checkout the docs deployment branch'
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: gh-pages
|
||||
|
||||
|
@ -123,12 +123,11 @@ jobs:
|
|||
id: update-latest
|
||||
run: |
|
||||
DOCS_VERSION=$(grep -oE 'v[0-9]+\.[0-9]+' <<< "${GITHUB_REF}")
|
||||
echo "DOCS_VERSION=${DOCS_VERSION}" >> "${GITHUB_ENV}"
|
||||
ln -sf ${DOCS_VERSION} latest
|
||||
echo "DOCS_VERSION=${DOCS_VERSION}" >>"${GITHUB_ENV}"
|
||||
rm latest
|
||||
ln -s "${DOCS_VERSION}" latest
|
||||
|
||||
- name: 'Push update for `latest` symlink'
|
||||
# The step will fail if no change was made; ignore that failure
|
||||
continue-on-error: true
|
||||
run: |
|
||||
git config user.name ${{ env.GIT_USER }}
|
||||
git config user.email ${{ env.GIT_EMAIL }}
|
||||
|
|
|
@ -28,11 +28,11 @@ jobs:
|
|||
build-cache-key: ${{ steps.derive-image-cache-key.outputs.digest }}
|
||||
steps:
|
||||
- name: 'Checkout'
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
# Can potentially be replaced by: `${{ hashFiles('target/**', 'Dockerfile', 'VERSION') }}`
|
||||
# Can potentially be replaced by: `${{ hashFiles('target/**', 'Dockerfile') }}`
|
||||
# Must not be affected by file metadata changes and have a consistent sort order:
|
||||
# https://docs.github.com/en/actions/learn-github-actions/expressions#hashfiles
|
||||
# Keying by the relevant build context is more re-usable than a commit SHA.
|
||||
|
@ -40,10 +40,7 @@ jobs:
|
|||
id: derive-image-cache-key
|
||||
shell: bash
|
||||
run: |
|
||||
ADDITIONAL_FILES=(
|
||||
'Dockerfile'
|
||||
'VERSION'
|
||||
)
|
||||
ADDITIONAL_FILES=( 'Dockerfile' )
|
||||
|
||||
# Recursively collect file paths from `target/` and pipe a list of
|
||||
# checksums to be sorted (by hash value) and finally generate a checksum
|
||||
|
@ -64,7 +61,7 @@ jobs:
|
|||
# When full, the least accessed cache upload is evicted to free up storage.
|
||||
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
|
||||
- name: 'Handle Docker build layer cache'
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: cache-buildx-${{ steps.derive-image-cache-key.outputs.digest }}
|
||||
|
@ -74,16 +71,16 @@ jobs:
|
|||
cache-buildx-
|
||||
|
||||
- name: 'Set up QEMU'
|
||||
uses: docker/setup-qemu-action@v2.1.0
|
||||
uses: docker/setup-qemu-action@v3.6.0
|
||||
with:
|
||||
platforms: arm64
|
||||
|
||||
- name: 'Set up Docker Buildx'
|
||||
uses: docker/setup-buildx-action@v2.5.0
|
||||
uses: docker/setup-buildx-action@v3.10.0
|
||||
|
||||
# NOTE: AMD64 can build within 2 minutes
|
||||
- name: 'Build images'
|
||||
uses: docker/build-push-action@v4.0.0
|
||||
uses: docker/build-push-action@v6.15.0
|
||||
with:
|
||||
context: .
|
||||
# Build at least the AMD64 image (which runs against the test suite).
|
||||
|
|
|
@ -17,13 +17,13 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: 'Checkout'
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: 'Prepare tags'
|
||||
id: prep
|
||||
uses: docker/metadata-action@v4.3.0
|
||||
uses: docker/metadata-action@v5.7.0
|
||||
with:
|
||||
images: |
|
||||
${{ secrets.DOCKER_REPOSITORY }}
|
||||
|
@ -35,18 +35,18 @@ jobs:
|
|||
type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
||||
|
||||
- name: 'Set up QEMU'
|
||||
uses: docker/setup-qemu-action@v2.1.0
|
||||
uses: docker/setup-qemu-action@v3.6.0
|
||||
with:
|
||||
platforms: arm64
|
||||
|
||||
- name: 'Set up Docker Buildx'
|
||||
uses: docker/setup-buildx-action@v2.5.0
|
||||
uses: docker/setup-buildx-action@v3.10.0
|
||||
|
||||
# Try get the cached build layers from a prior `generic_build.yml` job.
|
||||
# NOTE: Until adopting `type=gha` scoped cache exporter (in `docker/build-push-action`),
|
||||
# only AMD64 image is expected to be cached, ARM images will build from scratch.
|
||||
- name: 'Retrieve image build from build cache'
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: cache-buildx-${{ inputs.cache-key }}
|
||||
|
@ -54,30 +54,25 @@ jobs:
|
|||
cache-buildx-
|
||||
|
||||
- name: 'Login to DockerHub'
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: 'Login to GitHub Container Registry'
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 'Acquire the image version'
|
||||
id: get-version
|
||||
shell: bash
|
||||
run: echo "version=$(<VERSION)" >>"${GITHUB_OUTPUT}"
|
||||
|
||||
- name: 'Build and publish images'
|
||||
uses: docker/build-push-action@v4.0.0
|
||||
uses: docker/build-push-action@v6.15.0
|
||||
with:
|
||||
context: .
|
||||
build-args: |
|
||||
DMS_RELEASE=${{ github.ref_type == 'tag' && github.ref_name || 'edge' }}
|
||||
VCS_REVISION=${{ github.sha }}
|
||||
VCS_VERSION=${{ steps.get-version.outputs.version }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
|
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Required to retrieve bats (core + extras):
|
||||
submodules: recursive
|
||||
|
@ -29,7 +29,7 @@ jobs:
|
|||
# This should always be a cache-hit, thus `restore-keys` fallback is not used.
|
||||
# No new cache uploads should ever happen for this job.
|
||||
- name: 'Retrieve image built from build cache'
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: cache-buildx-${{ inputs.cache-key }}
|
||||
|
@ -38,12 +38,12 @@ jobs:
|
|||
# Ensures consistent BuildKit version (not coupled to Docker Engine),
|
||||
# and increased compatibility of the build cache vs mixing buildx drivers.
|
||||
- name: 'Set up Docker Buildx'
|
||||
uses: docker/setup-buildx-action@v2.5.0
|
||||
uses: docker/setup-buildx-action@v3.10.0
|
||||
|
||||
# Importing from the cache should create the image within approx 30 seconds:
|
||||
# NOTE: `qemu` step is not needed as we only test for AMD64.
|
||||
- name: 'Build AMD64 image from cache'
|
||||
uses: docker/build-push-action@v4.0.0
|
||||
uses: docker/build-push-action@v6.15.0
|
||||
with:
|
||||
context: .
|
||||
tags: mailserver-testing:ci
|
||||
|
|
|
@ -22,13 +22,13 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: 'Checkout'
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Get the cached build layers from the build job:
|
||||
# This should always be a cache-hit, thus `restore-keys` fallback is not used.
|
||||
# No new cache uploads should ever happen for this job.
|
||||
- name: 'Retrieve image built from build cache'
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: cache-buildx-${{ inputs.cache-key }}
|
||||
|
@ -37,12 +37,12 @@ jobs:
|
|||
# Ensures consistent BuildKit version (not coupled to Docker Engine),
|
||||
# and increased compatibility of the build cache vs mixing buildx drivers.
|
||||
- name: 'Set up Docker Buildx'
|
||||
uses: docker/setup-buildx-action@v2.5.0
|
||||
uses: docker/setup-buildx-action@v3.10.0
|
||||
|
||||
# Importing from the cache should create the image within approx 30 seconds:
|
||||
# NOTE: `qemu` step is not needed as we only test for AMD64.
|
||||
- name: 'Build AMD64 image from cache'
|
||||
uses: docker/build-push-action@v4.0.0
|
||||
uses: docker/build-push-action@v6.15.0
|
||||
with:
|
||||
context: .
|
||||
tags: mailserver-testing:ci
|
||||
|
@ -55,13 +55,13 @@ jobs:
|
|||
provenance: false
|
||||
|
||||
- name: 'Run the Anchore Grype scan action'
|
||||
uses: anchore/scan-action@v3.3.5
|
||||
uses: anchore/scan-action@v6.1.0
|
||||
id: scan
|
||||
with:
|
||||
image: mailserver-testing:ci
|
||||
fail-build: false
|
||||
|
||||
- name: 'Upload vulnerability report'
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: ${{ steps.scan.outputs.sarif }}
|
||||
|
|
|
@ -15,7 +15,7 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Close stale issues
|
||||
uses: actions/stale@v8
|
||||
uses: actions/stale@v9
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 20
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
# A workflow that creates a PR will not trigger this workflow,
|
||||
# Providing a manual trigger as a workaround
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
@ -13,7 +16,7 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Hadolint
|
||||
run: make hadolint
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
name: 'Deploy :edge on Schedule'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: 0 0 * * 5
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
build-images:
|
||||
|
|
|
@ -7,10 +7,11 @@ set -ex
|
|||
# `build --strict` ensures the build fails when any warnings are omitted.
|
||||
docker run \
|
||||
--rm \
|
||||
--quiet \
|
||||
--user "$(id -u):$(id -g)" \
|
||||
--volume "${PWD}:/docs" \
|
||||
--volume "./:/docs" \
|
||||
--name "build-docs" \
|
||||
squidfunk/mkdocs-material:9.1.5 build --strict
|
||||
squidfunk/mkdocs-material:9.6 build --strict
|
||||
|
||||
# Remove unnecessary build artifacts: https://github.com/squidfunk/mkdocs-material/issues/2519
|
||||
# site/ is the build output folder.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#################################################
|
||||
|
||||
.env
|
||||
compose.override.yaml
|
||||
docs/site/
|
||||
docker-data/
|
||||
|
||||
|
|
637
CHANGELOG.md
637
CHANGELOG.md
|
@ -2,11 +2,537 @@
|
|||
|
||||
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased](https://github.com/docker-mailserver/docker-mailserver/compare/v12.0.0...HEAD)
|
||||
## [Unreleased](https://github.com/docker-mailserver/docker-mailserver/compare/v15.0.2...HEAD)
|
||||
|
||||
> **Note**: Changes and additions listed here are contained in the `:edge` image tag. These changes may not be as stable as released changes.
|
||||
|
||||
## [12.0.0](https://github.com/docker-mailserver/docker-mailserver/compare/v12.0.0...HEAD)
|
||||
### Updates
|
||||
|
||||
- **Documentation:**
|
||||
- Added a compatibility note for a Dovecot + Solr 9.8 breaking change ([#4433](https://github.com/docker-mailserver/docker-mailserver/pull/4433))
|
||||
- **Internal:**
|
||||
- Refactored `setup config dkim` (`open-dkim`) ([#4375](https://github.com/docker-mailserver/docker-mailserver/pull/4375))
|
||||
|
||||
## [v15.0.2](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v15.0.2)
|
||||
|
||||
### Fixes
|
||||
|
||||
- **Postfix**
|
||||
- Avoid modifying the message body when filtering sender headers. This regression was introduced from [#4120](https://github.com/docker-mailserver/docker-mailserver/pull/4120) as part of DMS v15.0.0 ([#4429](https://github.com/docker-mailserver/docker-mailserver/pull/4429))
|
||||
|
||||
## [v15.0.1](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v15.0.1)
|
||||
|
||||
### Added
|
||||
|
||||
- **Internal:**
|
||||
- Added the Smallstep `step` CLI command for future internal usage ([#4376](https://github.com/docker-mailserver/docker-mailserver/pull/4376))
|
||||
|
||||
### Fixes
|
||||
|
||||
- **Postfix:**
|
||||
- `setup email restrict` generated configs now only prepend to `dms_smtpd_sender_restrictions` ([#4379](https://github.com/docker-mailserver/docker-mailserver/pull/4379))
|
||||
- **Rspamd:**
|
||||
- Change detection support now monitors all files found within the DMS _Config Volume_ Rspamd directory ([#4418](https://github.com/docker-mailserver/docker-mailserver/pull/4418))
|
||||
- **Internal:**
|
||||
- A permissions fix for `/var/log/mail` that was [added in DMS v15]((https://github.com/docker-mailserver/docker-mailserver/pull/4374)) no longer encounters an error when no log files are present during a container restart, such as with a `tmpfs` volume mount ([#4391](https://github.com/docker-mailserver/docker-mailserver/pull/4391))
|
||||
- The DMS _State Volume_ (`/var/mail-state`) will now ensure it's file tree is accessible for services when the volume was created with missing executable bit ([#4420](https://github.com/docker-mailserver/docker-mailserver/pull/4420))
|
||||
- The DMS _Config Volume_ (`/tmp/docker-mailserver`) now correctly updates permissions on container restarts ([#4417](https://github.com/docker-mailserver/docker-mailserver/pull/4417))
|
||||
|
||||
### Updates
|
||||
|
||||
- **Internal:**
|
||||
- Minor improvements to `_install_utils()` in `packages.sh` ([#4376](https://github.com/docker-mailserver/docker-mailserver/pull/4376))
|
||||
|
||||
## [v15.0.0](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v15.0.0)
|
||||
|
||||
### Breaking
|
||||
|
||||
- **saslauthd** mechanism support via ENV `SASLAUTHD_MECHANISMS` with `pam`, `shadow`, `mysql` values has been removed. Only `ldap` and `rimap` remain supported ([#4259](https://github.com/docker-mailserver/docker-mailserver/pull/4259))
|
||||
- **getmail6** has been refactored: ([#4156](https://github.com/docker-mailserver/docker-mailserver/pull/4156))
|
||||
- The [DMS config volume](https://docker-mailserver.github.io/docker-mailserver/v15.0/config/advanced/optional-config/#volumes) now has support for `getmailrc_general.cf` for overriding [common default settings](https://docker-mailserver.github.io/docker-mailserver/v15.0/config/advanced/mail-getmail/#common-options). If you previously mounted this config file directly to `/etc/getmailrc_general` you should switch to our config volume support.
|
||||
- Generated getmail configuration files no longer set the `message_log` option. Instead of individual log files per config, the [default base settings DMS configures](https://github.com/docker-mailserver/docker-mailserver/tree/v15.0.0/target/getmail/getmailrc_general) now enables `message_log_syslog`. This aligns with how other services in DMS log to syslog where it is captured in `mail.log`.
|
||||
- Getmail configurations have changed location from the base of the DMS Config Volume, to the `getmail/` subdirectory. Any existing configurations **must be migrated manually.**
|
||||
- **DMS v14 mistakenly** relocated the _getmail state directory_ to the _DMS Config Volume_ as a `getmail/` subdirectory.
|
||||
- This has been corrected to `/var/lib/getmail` (_if you have mounted a DMS State Volume to `/var/mail-state`, `/var/lib/getmail` will be symlinked to `/var/mail-state/lib-getmail`_).
|
||||
- To preserve this state when upgrading to DMS v15, **you must manually migrate `getmail/` from the _DMS Config Volume_ to `lib-getmail/` in the _DMS State Volume_.**
|
||||
- `setup email delete <EMAIL ADDRESS>` now requires explicit confirmation if the mailbox data should be deleted ([#4365](https://github.com/docker-mailserver/docker-mailserver/pull/4365)).
|
||||
- **Rspamd:** Removed deprecated file path check (_DMS config volume: `./rspamd-modules.conf` => `./rspamd/custom-commands.conf`_) ([#4373](https://github.com/docker-mailserver/docker-mailserver/pull/4373))
|
||||
|
||||
### Added
|
||||
|
||||
- **Internal:**
|
||||
- Add password confirmation to several `setup` CLI subcommands ([#4072](https://github.com/docker-mailserver/docker-mailserver/pull/4072))
|
||||
- Added a `debug getmail` subcommand to `setup` ([#4346](https://github.com/docker-mailserver/docker-mailserver/pull/4346))
|
||||
|
||||
### Updates
|
||||
|
||||
- **Internal:**
|
||||
- **Removed `VERSION` file** from the repo. Releases of DMS prior to v13 (Nov 2023) would check this to detect new releases ([#3677](https://github.com/docker-mailserver/docker-mailserver/issues/3677), [#4321](https://github.com/docker-mailserver/docker-mailserver/pull/4321))
|
||||
- During image build, ensure a secure connection when downloading the `fail2ban` package ([#4080](https://github.com/docker-mailserver/docker-mailserver/pull/4080))
|
||||
- **Documentation:**
|
||||
- Account Management and Authentication pages have been rewritten and better organized ([#4122](https://github.com/docker-mailserver/docker-mailserver/pull/4122))
|
||||
- Add a caveat for `DMS_VMAIL_UID` not being compatible with `0` / root ([#4143](https://github.com/docker-mailserver/docker-mailserver/pull/4143))
|
||||
- **Getmail:** ([#4156](https://github.com/docker-mailserver/docker-mailserver/pull/4156))
|
||||
- Added `getmail` as a new service for `supervisor` to manage, replacing cron for periodic polling.
|
||||
- IMAP/POP3 example configs added to our [`config-examples`](https://github.com/docker-mailserver/docker-mailserver/tree/v15.0.0/config-examples/getmail).
|
||||
- ENV [`GETMAIL_POLL`](https://docker-mailserver.github.io/docker-mailserver/v15.0/config/environment/#getmail_poll) now supports values above 30 minutes.
|
||||
- **Postfix:**
|
||||
- By default opt-out from _Microsoft reactions_ for outbound mail ([#4120](https://github.com/docker-mailserver/docker-mailserver/pull/4120))
|
||||
- **Rspamd:**
|
||||
- Updated GTube settings and tests ([#4191](https://github.com/docker-mailserver/docker-mailserver/pull/4191))
|
||||
- Updated externally installed software ([#4357](https://github.com/docker-mailserver/docker-mailserver/pull/4357)):
|
||||
- `DOVECOT_COMMUNITY_REPO=1` custom image build ARG now supports the latest Dovecot [`2.4.x`](https://github.com/dovecot/core/releases/tag/2.4.0) (_DMS provides Dovecot `2.3.19` by default_)
|
||||
- Dovecot FTS Xapian module (`1.7.12` => [`1.9.0`](https://github.com/grosjo/fts-xapian/releases/tag/1.9))
|
||||
- `jaq` (`1.3.0` => [`2.1.0`](https://github.com/01mf02/jaq/releases/tag/v2.1.0))
|
||||
- Fail2Ban (`1.0.2-2` => [`1.1.0`](https://github.com/fail2ban/fail2ban/releases/tag/1.1.0)) ([#4045](https://github.com/docker-mailserver/docker-mailserver/pull/4045))
|
||||
- Rspamd (`3.8.4` => [`3.11.0`](https://github.com/rspamd/rspamd/releases/tag/3.11.0)) - Implicitly upgraded during image build, as the third-party repo lacks version pinning support.
|
||||
|
||||
### Fixes
|
||||
|
||||
- **Dovecot:**
|
||||
- The logwatch `ignore.conf` now also excludes Xapian messages about pending documents ([#4060](https://github.com/docker-mailserver/docker-mailserver/pull/4060))
|
||||
- `dovecot-fts-xapian` plugin was updated, fixing a regression with indexing ([#4095](https://github.com/docker-mailserver/docker-mailserver/pull/4095))
|
||||
- The "dummy account" workaround for _Dovecot Quota_ feature support no longer treats the alias as a regex when checking the Dovecot UserDB ([#4222](https://github.com/docker-mailserver/docker-mailserver/pull/4222))
|
||||
- **LDAP:**
|
||||
- Correctly apply a compatibility fix for OAuth2 introduced in DMS `v13.3.1` which had not been applied to the actual LDAP config changes ([#4175](https://github.com/docker-mailserver/docker-mailserver/pull/4175))
|
||||
- **Internal:**
|
||||
- The main `mail.log` (_which is piped to stdout via `tail`_) now correctly begins from the first log line of the active container run. Previously some daemon logs and potential warnings/errors were omitted ([#4146](https://github.com/docker-mailserver/docker-mailserver/pull/4146))
|
||||
- `start-mailserver.sh` removed unused `shopt -s inherit_errexit` ([#4161](https://github.com/docker-mailserver/docker-mailserver/pull/4161))
|
||||
- Fixed a regression introduced in DMS v14 where `postfix-main.cf` appended `stderr` output into `/etc/postfix/main.cf`, causing Postfix startup to fail ([#4147](https://github.com/docker-mailserver/docker-mailserver/pull/4147))
|
||||
- Fixed a regression introduced in DMS v14 to better support running `start-mailserver.sh` with container restarts, which now only skip calling `_setup()` ([#4323](https://github.com/docker-mailserver/docker-mailserver/pull/4323#issuecomment-2629559254), [#4374](https://github.com/docker-mailserver/docker-mailserver/pull/4374))
|
||||
- The command `swaks --help` is now functional ([#4282](https://github.com/docker-mailserver/docker-mailserver/pull/4282))
|
||||
- **Rspamd:**
|
||||
- DKIM private key path checking is now performed only on paths that do not contain `$` ([#4201](https://github.com/docker-mailserver/docker-mailserver/pull/4201))
|
||||
|
||||
### CI
|
||||
|
||||
- Removed `CONTRIBUTORS.md`, `.all-contributorsrc`, and workflow ([#4141](https://github.com/docker-mailserver/docker-mailserver/pull/4141))
|
||||
- Refactored the workflows to be more secure for generating documentation previews on PRs ([#4267](https://github.com/docker-mailserver/docker-mailserver/pull/4267), [#4264](https://github.com/docker-mailserver/docker-mailserver/pull/4264), [#4262](https://github.com/docker-mailserver/docker-mailserver/pull/4262), [#4247](https://github.com/docker-mailserver/docker-mailserver/pull/4247), [#4244](https://github.com/docker-mailserver/docker-mailserver/pull/4244))
|
||||
|
||||
## [v14.0.0](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v14.0.0)
|
||||
|
||||
The most noteworthy change of this release is the update of the container's base image from Debian 11 ("Bullseye") to Debian 12 ("Bookworm"). This update alone involves breaking changes and requires a careful update!
|
||||
|
||||
### Breaking
|
||||
|
||||
- **Updated base image to Debian 12** ([#3403](https://github.com/docker-mailserver/docker-mailserver/pull/3403))
|
||||
- Changed the default of `DOVECOT_COMMUNITY_REPO` to `0` (disabled) - the Dovecot community repo will (for now) not be the default when building the DMS.
|
||||
- While Debian 12 (Bookworm) was released in June 2023 and the latest Dovecot `2.3.21` in Sep 2023, as of Jan 2024 there is no [Dovecot community repo available for Debian 12](https://repo.dovecot.org).
|
||||
- This results in the Dovecot version being downgraded from `2.3.21` (DMS v13.3) to `2.3.19`, which [may affect functionality when you've explicitly configured for these features](https://github.com/dovecot/core/blob/30cde20f63650d8dcc4c7ad45418986f03159946/NEWS#L1-L158):
|
||||
- OAuth2 (_mostly regarding JWT usage, or POST requests (`introspection_mode = post`) with `client_id` + `client_secret`_).
|
||||
- Lua HTTP client (_DNS related_).
|
||||
- Updated packages. For an overview, [we have a review comment on the PR that introduces Debian 12](https://github.com/docker-mailserver/docker-mailserver/pull/3403#issuecomment-1694563615)
|
||||
- Notable major version bump: `openssl 3`, `clamav 1`, `spamassassin 4`, `redis-server 7`.
|
||||
- Notable minor version bump: `postfix 3.5.23 => 3.7.9`
|
||||
- Notable minor version bump + downgrade: `dovecot 2.3.13 => 2.3.19` (_Previous release provided `2.3.21` via community repo, `2.3.19` is now the default_)
|
||||
- Updates to `packages.sh`:
|
||||
- Removed custom installations of Fail2Ban, getmail6 and Rspamd
|
||||
- Updated packages lists and added comments for maintainability
|
||||
- OpenDMARC upgrade: `v1.4.0` => `v1.4.2` ([#3841](https://github.com/docker-mailserver/docker-mailserver/pull/3841))
|
||||
- Previous versions of OpenDMARC would place incoming mail from domains announcing `p=quarantaine` (_that fail the DMARC check_) into the [Postfix "hold" queue](https://www.postfix.org/QSHAPE_README.html#hold_queue) until administrative intervention.
|
||||
- [OpenDMARC v1.4.2 has disabled that feature by default](https://github.com/trusteddomainproject/OpenDMARC/issues/105), but it can be enabled again by adding the setting `HoldQuarantinedMessages true` to [`/etc/opendmarc.conf`](https://github.com/docker-mailserver/docker-mailserver/blob/v13.3.1/target/opendmarc/opendmarc.conf) (_provided from DMS_).
|
||||
- [Our `user-patches.sh` feature](https://docker-mailserver.github.io/docker-mailserver/latest/config/advanced/override-defaults/user-patches/) provides a convenient approach to updating that config file.
|
||||
- Please let us know if you disagree with the upstream default being carried with DMS, or the value of providing alternative configuration support within DMS.
|
||||
- **Postfix:**
|
||||
- Postfix upgrade from 3.5 to 3.7 ([#3403](https://github.com/docker-mailserver/docker-mailserver/pull/3403))
|
||||
- `compatibility_level` was raised from `2` to `3.6`
|
||||
- Postfix has deprecated the usage of `whitelist` / `blacklist` in config parameters and logging in favor of `allowlist` / `denylist` and similar variations. ([#3403](https://github.com/docker-mailserver/docker-mailserver/pull/3403/files#r1306356328))
|
||||
- This [may affect monitoring / analysis of logs output from Postfix](https://www.postfix.org/COMPATIBILITY_README.html#respectful_logging) that expects to match patterns on the prior terminology used.
|
||||
- DMS `main.cf` has renamed `postscreen_dnsbl_whitelist_threshold` to `postscreen_dnsbl_allowlist_threshold` as part of this change.
|
||||
- `smtpd_relay_restrictions` (relay policy) is now evaluated after `smtpd_recipient_restrictions` (spam policy). Previously it was evaluated before `smtpd_recipient_restrictions`. Mail to be relayed via DMS must now pass through the spam policy first.
|
||||
- The TLS fingerprint policy has changed the default from MD5 to SHA256 (_DMS does not modify this Postfix parameter, but may affect any user customizations that do_).
|
||||
- **Dovecot**
|
||||
- The "Junk" mailbox (folder) is now referenced by it's [special-use flag `\Junk`](https://docker-mailserver.github.io/docker-mailserver/v13.3/examples/use-cases/imap-folders/) instead of an explicit mailbox. ([#3925](https://github.com/docker-mailserver/docker-mailserver/pull/3925))
|
||||
- This provides compatibility for the Junk mailbox when it's folder name differs (_eg: Renamed to "Spam"_).
|
||||
- Potential breakage if your deployment modifies our `spam_to_junk.sieve` sieve script (_which is created during container startup when ENV `MOVE_SPAM_TO_JUNK=1`_) that handles storing spam mail into a users "Junk" mailbox folder.
|
||||
- **Removed support for Solr integration:** ([#4025](https://github.com/docker-mailserver/docker-mailserver/pull/4025))
|
||||
- This was a community contributed feature for FTS (Full Text Search), the docs advise using an image that has not been maintained for over 2 years and lacks ARM64 support. Based on user engagement over the years this feature has very niche value to continue to support, thus is being removed.
|
||||
- If you use Solr, support can be restored if you're willing to contribute docs for the feature that resolves the concerns raised
|
||||
- **Log:**
|
||||
- The format of DMS specific logs (_from our scripts, not running services_) has been changed. The new format is `<RFC 3339 TIMESTAMP> <LOG LEVEL> <LOG EVENT SRC>: <MESSAGE>` ([#4035](https://github.com/docker-mailserver/docker-mailserver/pull/4035))
|
||||
- **rsyslog:**
|
||||
- Debian 12 adjusted the `rsyslog` configuration for the default file template from `RSYSLOG_TraditionalFileFormat` to `RSYSLOG_FileFormat` (_upstream default since 2012_). This change may affect you if you have any monitoring / analysis of log output (_eg: `mail.log` / `docker logs`_).
|
||||
- The two formats are roughly equivalent to [RFC 3164](https://www.rfc-editor.org/rfc/rfc3164)) and [RFC 5424](https://datatracker.ietf.org/doc/html/rfc5424#section-1) respectively.
|
||||
- A notable difference is the change to [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339.html#appendix-A) timestamps (_a strict subset of ISO 8601_). The [previous non-standardized timestamp format was defined in RFC 3164](https://www.rfc-editor.org/rfc/rfc3164.html#section-4.1.2) as `Mmm dd hh:mm:ss`.
|
||||
- To revert this change you can add `sedfile -i '1i module(load="builtin:omfile" template="RSYSLOG_TraditionalFileFormat")' /etc/rsyslog.conf` via [our `user-patches.sh` feature](https://docker-mailserver.github.io/docker-mailserver/v14.0/config/advanced/override-defaults/user-patches/).
|
||||
- Rsyslog now creates fewer log files:
|
||||
- The files `/var/log/mail/mail.{info,warn,err}` are no longer created. These files represented `/var/log/mail.log` filtered into separate priority levels. As `/var/log/mail.log` contains all mail related messages, these files (_and their rotated counterparts_) can be deleted safely.
|
||||
- `/var/log/messages`, `/var/log/debug` and several other log files not relevant to DMS were configured by default by Debian previously. These are not part of the `/var/log/mail/` volume mount, so should not impact anyone.
|
||||
- **Features:**
|
||||
- The relay host feature was refactored ([#3845](https://github.com/docker-mailserver/docker-mailserver/pull/3845))
|
||||
- The only breaking change this should introduce is with the Change Detection service (`check-for-changes.sh`).
|
||||
- When credentials are configured for relays, change events that trigger the relayhost logic now reapply the relevant Postfix settings:
|
||||
- `smtp_sasl_auth_enable = yes` (_SASL auth to outbound MTA connections is enabled_)
|
||||
- `smtp_sasl_security_options = noanonymous` (_credentials are mandatory for outbound mail delivery_)
|
||||
- `smtp_tls_security_level = encrypt` (_the outbound MTA connection must always be secure due to credentials sent_)
|
||||
- **Environment Variables:**
|
||||
- `SA_SPAM_SUBJECT` has been renamed into `SPAM_SUBJECT` to become anti-spam service agnostic. ([#3820](https://github.com/docker-mailserver/docker-mailserver/pull/3820))
|
||||
- As this functionality is now handled in Dovecot via a Sieve script instead of the respective anti-spam service during Postfix processing, this feature will only apply to mail stored in Dovecot. If you have relied on this feature in a different context, it will no longer be available.
|
||||
- Rspamd previously handled this functionality via the `rewrite_subject` action which as now been disabled by default in favor of the new approach with `SPAM_SUBJECT`.
|
||||
- `SA_SPAM_SUBJECT` is now deprecated and will log a warning if used. The value is copied as a fallback to `SPAM_SUBJECT`.
|
||||
- The default has changed to not prepend any prefix to the subject unless configured to do so. If you relied on the implicit prefix, you will now need to provide one explicitly.
|
||||
- `undef` was previously supported as an opt-out with `SA_SPAM_SUBJECT`. This is no longer valid, the equivalent opt-out value is now an empty value (_or rather the omission of this ENV being configured_).
|
||||
- The feature to include [`_SCORE_` tag](https://spamassassin.apache.org/full/4.0.x/doc/Mail_SpamAssassin_Conf.html#rewrite_header-subject-from-to-STRING) in your value to be replaced by the associated spam score is no longer available.
|
||||
- **Supervisord:**
|
||||
- `supervisor-app.conf` renamed to `dms-services.conf` ([#3908](https://github.com/docker-mailserver/docker-mailserver/pull/3908))
|
||||
- **Rspamd:**
|
||||
- The Redis history key has been changed in order to not incorporate the hostname of the container (which is desirable in Kubernetes environments) ([#3927](https://github.com/docker-mailserver/docker-mailserver/pull/3927))
|
||||
- **Account Management:**
|
||||
- Addresses (accounts) are now normalized to lowercase automatically and a warning is logged in case uppercase letters are supplied ([#4033](https://github.com/docker-mailserver/docker-mailserver/pull/4033))
|
||||
|
||||
### Added
|
||||
|
||||
- **Documentation:**
|
||||
- A guide for configuring a public server to relay inbound and outbound mail from DMS on a private server ([#3973](https://github.com/docker-mailserver/docker-mailserver/pull/3973))
|
||||
- **Environment Variables:**
|
||||
- `LOGROTATE_COUNT` defines the number of files kept by logrotate ([#3907](https://github.com/docker-mailserver/docker-mailserver/pull/3907))
|
||||
- The fail2ban log file is now also taken into account by `LOGROTATE_COUNT` and `LOGROTATE_INTERVAL` ([#3915](https://github.com/docker-mailserver/docker-mailserver/pull/3915), [#3919](https://github.com/docker-mailserver/docker-mailserver/pull/3919))
|
||||
|
||||
- **Internal:**
|
||||
- Regular container restarts are now better supported. Setup scripts that ran previously will now be skipped ([#3929](https://github.com/docker-mailserver/docker-mailserver/pull/3929))
|
||||
|
||||
### Updates
|
||||
|
||||
- **Environment Variables:**
|
||||
- `ONE_DIR` has been removed (legacy ENV) ([#3840](https://github.com/docker-mailserver/docker-mailserver/pull/3840))
|
||||
- It's only functionality remaining was to opt-out of run-time state consolidation with `ONE_DIR=0` (_when a volume was already mounted to `/var/mail-state`_).
|
||||
- **Internal:**
|
||||
- Changed the Postgrey whitelist retrieved during build to [source directly from Github](https://github.com/schweikert/postgrey/blob/master/postgrey_whitelist_clients) as the list is updated more frequently than the [author publishes at their website](https://postgrey.schweikert.ch) ([#3879](https://github.com/docker-mailserver/docker-mailserver/pull/3879))
|
||||
- Enable spamassassin only, when amavis is enabled too. ([#3943](https://github.com/docker-mailserver/docker-mailserver/pull/3943))
|
||||
- **Tests:**
|
||||
- Refactored helper methods for sending e-mails with specific `Message-ID` headers and the helpers for retrieving + filtering logs, which together help isolate logs relevant to specific mail when multiple mails have been processed within a single test. ([#3786](https://github.com/docker-mailserver/docker-mailserver/pull/3786))
|
||||
- **Rspamd:**
|
||||
- The `rewrite_subject` action, is now disabled by default. It has been replaced with the new `SPAM_SUBJECT` environment variable, which implements the functionality via a Sieve script instead which is anti-spam service agnostic ([#3820](https://github.com/docker-mailserver/docker-mailserver/pull/3820))
|
||||
- `RSPAMD_NEURAL` was added and is disabled by default. If switched on it will enable the experimental Rspamd "Neural network" module to add a layer of analysis to spam detection ([#3833](https://github.com/docker-mailserver/docker-mailserver/pull/3833))
|
||||
- The symbol weights of SPF, DKIM and DMARC have been adjusted again. Fixes a bug and includes more appropriate combinations of symbols ([#3913](https://github.com/docker-mailserver/docker-mailserver/pull/3913), [#3923](https://github.com/docker-mailserver/docker-mailserver/pull/3923))
|
||||
- **Dovecot:**
|
||||
- `logwatch` now filters out non-error logs related to the status of the `index-worker` process for FTS indexing. ([#4012](https://github.com/docker-mailserver/docker-mailserver/pull/4012))
|
||||
- updated FTS Xapian from version 1.5.5 to 1.7.12
|
||||
|
||||
### Fixes
|
||||
|
||||
- DMS config:
|
||||
- Files that are parsed line by line are now more robust to parse by detecting and fixing line-endings ([#3819](https://github.com/docker-mailserver/docker-mailserver/pull/3819))
|
||||
- The override config `postfix-main.cf` now retains custom parameters intended for use with `postfix-master.cf` ([#3880](https://github.com/docker-mailserver/docker-mailserver/pull/3880))
|
||||
- Variables related to Rspamd are declared as `readonly`, which would cause warnings in the log when being re-declared; we now guard against this issue ([#3837](https://github.com/docker-mailserver/docker-mailserver/pull/3837))
|
||||
- Relay host feature refactored ([#3845](https://github.com/docker-mailserver/docker-mailserver/pull/3845))
|
||||
- `DEFAULT_RELAY_HOST` ENV can now also use the `RELAY_USER` + `RELAY_PASSWORD` ENV for supplying credentials.
|
||||
- `RELAY_HOST` ENV no longer enforces configuring outbound SMTP to require credentials. Like `DEFAULT_RELAY_HOST` it can now configure a relay where credentials are optional.
|
||||
- Restarting DMS should not be required when configuring relay hosts without these ENV, but solely via `setup relay ...`, as change detection events now apply relevant Postfix setting changes for supporting credentials too.
|
||||
- Rspamd configuration: Add a missing comma in `local_networks` so that all internal IP addresses are actually considered as internal ([#3862](https://github.com/docker-mailserver/docker-mailserver/pull/3862))
|
||||
- Ensure correct SELinux security context labels for files and directories moved to the mail-state volume during setup ([#3890](https://github.com/docker-mailserver/docker-mailserver/pull/3890))
|
||||
- Use correct environment variable for fetchmail ([#3901](https://github.com/docker-mailserver/docker-mailserver/pull/3901))
|
||||
- When using `ENABLE_GETMAIL=1` the undocumented internal location `/var/lib/getmail/` usage has been removed. Only the config volume `/tmp/docker-mailserver/getmail/` location is supported when Getmail has not been configured to deliver mail to Dovecot as advised in the DMS docs ([#4018](https://github.com/docker-mailserver/docker-mailserver/pull/4018))
|
||||
- Dovecot dummy accounts (_virtual alias workaround for dovecot feature `ENABLE_QUOTAS=1`_) now correctly matches the home location of the user for that alias ([#3997](https://github.com/docker-mailserver/docker-mailserver/pull/3997))
|
||||
|
||||
## [v13.3.1](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v13.3.1)
|
||||
|
||||
### Fixes
|
||||
|
||||
- **Dovecot:**
|
||||
- Restrict the auth mechanisms for PassDB configs we manage (oauth2, passwd-file, ldap) ([#3812](https://github.com/docker-mailserver/docker-mailserver/pull/3812))
|
||||
- Prevents misleading auth failures from attempting to authenticate against a PassDB with incompatible auth mechanisms.
|
||||
- When the new OAuth2 feature was enabled, it introduced false-positives with logged auth failures which triggered Fail2Ban to ban the IP.
|
||||
- **Rspamd:**
|
||||
- Ensure correct ownership (`_rspamd:_rspamd`) for the Rspamd DKIM directory + files `/tmp/docker-mailserver/rspamd/dkim/` ([#3813](https://github.com/docker-mailserver/docker-mailserver/pull/3813))
|
||||
|
||||
## [v13.3.0](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v13.3.0)
|
||||
|
||||
### Features
|
||||
|
||||
- **Authentication with OIDC / OAuth 2.0** 🎉
|
||||
- DMS now supports authentication via OAuth2 (_via `XOAUTH2` or `OAUTHBEARER` SASL mechanisms_) from capable services (_like Roundcube_).
|
||||
- This does not replace the need for an `ACCOUNT_PROVISIONER` (`FILE` / `LDAP`), which is required for an account to receive or send mail.
|
||||
- Successful authentication (_via Dovecot PassDB_) still requires an existing account (_lookup via Dovecot UserDB_).
|
||||
- **MTA-STS** (_Optional support for mandatory outgoing TLS encryption_)
|
||||
- If enabled and the outbound recipient has an MTA-STS policy set, TLS is mandatory for delivering to that recipient.
|
||||
- Enable via the ENV `ENABLE_MTA_STS=1`
|
||||
- Supported by major email service providers like Gmail, Yahoo and Outlook.
|
||||
|
||||
### Added
|
||||
|
||||
- **Documentation:**
|
||||
- An example for how to bind outbound SMTP connections to a specific network interface ([#3465](https://github.com/docker-mailserver/docker-mailserver/pull/3465))
|
||||
|
||||
### Updates
|
||||
|
||||
- **Tests:**
|
||||
- Revised OAuth2 test ([#3795](https://github.com/docker-mailserver/docker-mailserver/pull/3795))
|
||||
- Replace `wc -l` with `grep -c` ([#3752](https://github.com/docker-mailserver/docker-mailserver/pull/3752))
|
||||
- Revised testing of service process management (supervisord) to be more robust ([#3780](https://github.com/docker-mailserver/docker-mailserver/pull/3780))
|
||||
- Refactored mail sending ([#3747](https://github.com/docker-mailserver/docker-mailserver/pull/3747) & [#3772](https://github.com/docker-mailserver/docker-mailserver/pull/3772)):
|
||||
- This change is a follow-up to [#3732](https://github.com/docker-mailserver/docker-mailserver/pull/3732) from DMS v13.2.
|
||||
- `swaks` version is now the latest from Github releases instead of the Debian package.
|
||||
- `_nc_wrapper`, `_send_mail` and related helpers expect the `.txt` filepath extension again.
|
||||
- `sending.bash` helper methods were refactored to better integrate `swaks` and accommodate different usage contexts.
|
||||
- `test/files/emails/existing/` files were removed similar to previous removal of SMTP auth files as they became redundant with `swaks`.
|
||||
- **Internal:**
|
||||
- Postfix is now configured with `smtputf8_enable = no` in our default `main.cf` config (_instead of during container startup_). ([#3750](https://github.com/docker-mailserver/docker-mailserver/pull/3750))
|
||||
- **Rspamd:** ([#3726](https://github.com/docker-mailserver/docker-mailserver/pull/3726)):
|
||||
- Symbol scores for SPF, DKIM & DMARC were updated to more closely align with [RFC7489](https://www.rfc-editor.org/rfc/rfc7489#page-24). Please note that complete alignment is undesirable as other symbols may be added as well, which changes the overall score calculation again, see [this issue](https://github.com/docker-mailserver/docker-mailserver/issues/3690#issuecomment-1866871996)
|
||||
- **Documentation:**
|
||||
- Revised the SpamAssassin ENV docs to better communicate configuration and their relation to other ENV settings. ([#3756](https://github.com/docker-mailserver/docker-mailserver/pull/3756))
|
||||
- Detailed how mail received is assigned a spam score by Rspamd and processed accordingly ([#3773](https://github.com/docker-mailserver/docker-mailserver/pull/3773))
|
||||
|
||||
### Fixes
|
||||
|
||||
- **Setup:**
|
||||
- `setup` CLI - `setup dkim domain` now creates the keys files with the user owning the key directory ([#3783](https://github.com/docker-mailserver/docker-mailserver/pull/3783))
|
||||
- **Dovecot:**
|
||||
- During container startup for Dovecot Sieve, `.sievec` source files compiled to `.svbin` now have their `mtime` adjusted post setup to ensure it is always older than the associated `.svbin` file. This avoids superfluous error logs for sieve scripts that don't actually need to be compiled again ([#3779](https://github.com/docker-mailserver/docker-mailserver/pull/3779))
|
||||
- **Internal:**
|
||||
- `.gitattributes`: Always use LF line endings on checkout for files with shell script content ([#3755](https://github.com/docker-mailserver/docker-mailserver/pull/3755))
|
||||
- Fix missing 'jaq' binary for ARM architecture ([#3766](https://github.com/docker-mailserver/docker-mailserver/pull/3766))
|
||||
|
||||
## [v13.2.0](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v13.2.0)
|
||||
|
||||
### Security
|
||||
|
||||
DMS is now secured against the [recently published spoofing attack "SMTP Smuggling"](https://www.postfix.org/smtp-smuggling.html) that affected Postfix ([#3727](https://github.com/docker-mailserver/docker-mailserver/pull/3727)):
|
||||
|
||||
- Postfix upgraded from `3.5.18` to `3.5.23` which provides the [long-term fix with `smtpd_forbid_bare_newline = yes`](https://www.postfix.org/smtp-smuggling.html#long)
|
||||
- If you are unable to upgrade to this release of DMS, you may follow [these instructions](https://github.com/docker-mailserver/docker-mailserver/issues/3719#issuecomment-1870865118) for applying the [short-term workaround](https://www.postfix.org/smtp-smuggling.html#short).
|
||||
- This change should not cause compatibility concerns for legitimate mail clients, however if you use software like `netcat` to send mail to DMS (_like our test-suite previously did_) it may now be rejected (_especially with the the short-term workaround `smtpd_data_restrictions = reject_unauth_pipelining`_).
|
||||
- **NOTE:** This Postfix update also includes the new parameter [`smtpd_forbid_bare_newline_exclusions`](https://www.postfix.org/postconf.5.html#smtpd_forbid_bare_newline_exclusions) which defaults to `$mynetworks` for excluding trusted mail clients excluded from the restriction.
|
||||
- With our default `PERMIT_DOCKER=none` this is not a concern.
|
||||
- Presently the Docker daemon config has `user-proxy: true` enabled by default.
|
||||
- On a host that can be reached by IPv6, this will route to a DMS IPv4 only container implicitly through the Docker network bridge gateway which rewrites the source address.
|
||||
- If your `PERMIT_DOCKER` setting allows that gateway IP, then it is part of `$mynetworks` and this attack would not be prevented from such connections.
|
||||
- If this affects your deployment, refer to [our IPv6 docs](https://docker-mailserver.github.io/docker-mailserver/v13.2/config/advanced/ipv6/) for advice on handling IPv6 correctly in Docker. Alternatively [use our `postfix-main.cf`](https://docker-mailserver.github.io/docker-mailserver/v13.2/config/advanced/override-defaults/postfix/) to set `smtpd_forbid_bare_newline_exclusions=` as empty.
|
||||
|
||||
### Updates
|
||||
|
||||
- The test suite now uses `swaks` instead of `nc`, which has multiple benefits ([#3732](https://github.com/docker-mailserver/docker-mailserver/pull/3732)):
|
||||
- `swaks` handles pipelining correctly, hence we can now use `reject_unauth_pipelining` in Postfix's configuration.
|
||||
- `swaks` provides better CLI options that make many files superflous.
|
||||
- `swaks` can also replace `openssl s_client` and handles authentication on submission ports better.
|
||||
- **Postfix:**
|
||||
- We now defer rejection from unauthorized pipelining until the SMTP `DATA` command via `smtpd_data_restrictions` (_i.e. at the end of the mail transfer transaction_) ([#3744](https://github.com/docker-mailserver/docker-mailserver/pull/3744))
|
||||
- Prevously our configuration only handled this during the client and recipient restriction stages. Postfix will flag this activity when encountered, but the rejection now is handled at `DATA` where unauthorized pipelining would have been valid from this point.
|
||||
- If you had the Amavis service enabled (default), this restriction was already in place. Otherwise the concerns expressed with `smtpd_data_restrictions = reject_unauth_pipelining` from the security section above apply. We have permitted trusted clients (_`$mynetworks` or authenticated_) to bypass this restriction.
|
||||
|
||||
## [v13.1.0](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v13.1.0)
|
||||
|
||||
### Added
|
||||
|
||||
- **Dovecot:**
|
||||
- ENV `ENABLE_IMAP` ([#3703](https://github.com/docker-mailserver/docker-mailserver/pull/3703))
|
||||
- **Tests:**
|
||||
- You can now use `make run-local-instance` to run a DMS image that was built locally to test changes ([#3663](https://github.com/docker-mailserver/docker-mailserver/pull/3663))
|
||||
- **Internal:**
|
||||
- Log a warning when update-check is enabled, but no stable release image is used ([#3684](https://github.com/docker-mailserver/docker-mailserver/pull/3684))
|
||||
|
||||
### Updates
|
||||
|
||||
- **Documentation:**
|
||||
- Debugging - Raise awareness in the troubleshooting page for a common misconfiguration when deviating from our advice by using a bare domain ([#3680](https://github.com/docker-mailserver/docker-mailserver/pull/3680))
|
||||
- Debugging - Raise awareness of temporary downtime during certificate renewal that can cause a failure to deliver local mail ([#3718](https://github.com/docker-mailserver/docker-mailserver/pull/3718))
|
||||
- **Internal:**
|
||||
- Postfix configures `virtual_mailbox_maps` and `virtual_transport` during startup instead of using defaults (configured for Dovecot) via our `main.cf` ([#3681](https://github.com/docker-mailserver/docker-mailserver/pull/3681))
|
||||
- **Rspamd:**
|
||||
- Upgraded to version `3.7.5`. This was previously inconsistent between our AMD64 (`3.5`) and ARM64 (`3.4`) images ([#3686](https://github.com/docker-mailserver/docker-mailserver/pull/3686))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Internal:**
|
||||
- The container startup welcome log message now references `DMS_RELEASE` ([#3676](https://github.com/docker-mailserver/docker-mailserver/pull/3676))
|
||||
- `VERSION` was incremented for prior releases to be notified of the v13.0.1 patch release ([#3676](https://github.com/docker-mailserver/docker-mailserver/pull/3676))
|
||||
- `VERSION` is no longer included in the image ([#3711](https://github.com/docker-mailserver/docker-mailserver/pull/3711))
|
||||
- Update-check: fix 'read' exit status ([#3688](https://github.com/docker-mailserver/docker-mailserver/pull/3688))
|
||||
- `ENABLE_QUOTAS=0` no longer tries to remove non-existent config ([#3715](https://github.com/docker-mailserver/docker-mailserver/pull/3715))
|
||||
- The `postgrey` service now writes logs to the supervisor directory like all other services. Previously this was `/var/log/mail/mail.log` ([#3724](https://github.com/docker-mailserver/docker-mailserver/pull/3724))
|
||||
- **Rspamd:**
|
||||
- Switch to official arm64 packages to avoid segfaults ([#3686](https://github.com/docker-mailserver/docker-mailserver/pull/3686))
|
||||
- **CI / Automation:**
|
||||
- The lint workflow can now be manually triggered by maintainers ([#3714]https://github.com/docker-mailserver/docker-mailserver/pull/3714)
|
||||
|
||||
## [v13.0.1](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v13.0.1)
|
||||
|
||||
This patch release fixes two bugs that Rspamd users encountered with the `v13.0.0` release. Big thanks to the those that helped to identify these issues! ❤️
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Internal:**
|
||||
- The update check service now queries the latest GH release for a version tag (_instead of from a `VERSION` file at the GH repo_). This should provide more reliable update notifications ([#3666](https://github.com/docker-mailserver/docker-mailserver/pull/3666))
|
||||
- **Rspamd:**
|
||||
- The check for correct permission on the private key when signing e-mails with DKIM was flawed. The result was that a false warning was emitted ([#3669](https://github.com/docker-mailserver/docker-mailserver/pull/3669))
|
||||
- When [`RSPAMD_CHECK_AUTHENTICATED=0`][docs::env-rspamd-check-auth], DKIM signing for outbound e-mail was disabled, which is undesirable ([#3669](https://github.com/docker-mailserver/docker-mailserver/pull/3669)). **Make sure to check the documentation of [`RSPAMD_CHECK_AUTHENTICATED`][docs::env-rspamd-check-auth]**!
|
||||
|
||||
[docs::env-rspamd-check-auth]: https://docker-mailserver.github.io/docker-mailserver/v13.0/config/environment/#rspamd_check_authenticated
|
||||
|
||||
## [v13.0.0](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v13.0.0)
|
||||
|
||||
### Breaking
|
||||
|
||||
- **LDAP:**
|
||||
- ENV `LDAP_SERVER_HOST`, `DOVECOT_URIS`, and `SASLAUTHD_LDAP_SERVER` will now log an error if the LDAP URI scheme is missing. Previously there was an implicit fallback to `ldap://` ([#3522](https://github.com/docker-mailserver/docker-mailserver/pull/3522))
|
||||
- `ENABLE_LDAP=1` is no longer supported, please use `ACCOUNT_PROVISIONER=LDAP` ([#3507](https://github.com/docker-mailserver/docker-mailserver/pull/3507))
|
||||
- **Rspamd:**
|
||||
- The deprecated path for the Rspamd custom commands file (`/tmp/docker-mailserver/rspamd-modules.conf`) now prevents successful startup. The correct path is `/tmp/docker-mailserver/rspamd/custom-commands.conf`.
|
||||
- **Dovecot:**
|
||||
- Dovecot mail storage per account in `/var/mail` previously shared the same path for the accounts home directory ([#3335](https://github.com/docker-mailserver/docker-mailserver/pull/3335))
|
||||
- The home directory now is a subdirectory `home/`. This change better supports sieve scripts.
|
||||
- **NOTE:** The change has not yet been implemented for `ACCOUNT_PROVISIONER=LDAP`.
|
||||
- **Postfix:**
|
||||
- `/etc/postfix/master.cf` has renamed the "smtps" service to "submissions" ([#3235](https://github.com/docker-mailserver/docker-mailserver/pull/3235))
|
||||
- This is the modern `/etc/services` name for port 465, aligning with the similar "submission" port 587.
|
||||
- If you have configured Proxy Protocol support with a reverse proxy via `postfix-master.cf` (_as [per our docs guide](https://docker-mailserver.github.io/docker-mailserver/v13.0/examples/tutorials/mailserver-behind-proxy/)_), you will want to update `smtps` to `submissions` there.
|
||||
- Postfix now defaults to supporting DSNs (_[Delivery Status Notifications](https://github.com/docker-mailserver/docker-mailserver/pull/3572#issuecomment-1751880574)_) only for authenticated users (_via ports 465 + 587_). This is a security measure to reduce spammer abuse of your DMS instance as a backscatter source. ([#3572](https://github.com/docker-mailserver/docker-mailserver/pull/3572))
|
||||
- If you need to modify this change, please let us know by opening an issue / discussion.
|
||||
- You can [opt out (_enable DSNs_) via the `postfix-main.cf` override support](https://docker-mailserver.github.io/docker-mailserver/v12.1/config/advanced/override-defaults/postfix/) using the contents: `smtpd_discard_ehlo_keywords =`.
|
||||
- Likewise for authenticated users, the submission(s) ports (465 + 587) are configured internally via `master.cf` to keep DSNs enabled (_since authentication protects from abuse_).
|
||||
|
||||
If necessary, DSNs for authenticated users can be disabled via the `postfix-master.cf` override with the following contents:
|
||||
|
||||
```cf
|
||||
submission/inet/smtpd_discard_ehlo_keywords=silent-discard,dsn
|
||||
submissions/inet/smtpd_discard_ehlo_keywords=silent-discard,dsn
|
||||
```
|
||||
|
||||
### Added
|
||||
|
||||
- **Features:**
|
||||
- `getmail` as an alternative to `fetchmail` ([#2803](https://github.com/docker-mailserver/docker-mailserver/pull/2803))
|
||||
- `setup` CLI - `setup fail2ban` gained a new `status <JAIL>` subcommand ([#3455](https://github.com/docker-mailserver/docker-mailserver/pull/3455))
|
||||
- **Environment Variables:**
|
||||
- `MARK_SPAM_AS_READ`. When set to `1`, marks incoming spam as "read" to avoid unwanted "new mail" notifications for junk mail ([#3489](https://github.com/docker-mailserver/docker-mailserver/pull/3489))
|
||||
- `DMS_VMAIL_UID` and `DMS_VMAIL_GID` allow changing the default ID values (`5000:5000`) for the Dovecot vmail user and group ([#3550](https://github.com/docker-mailserver/docker-mailserver/pull/3550))
|
||||
- `RSPAMD_CHECK_AUTHENTICATED` allows authenticated users to avoid additional security checks by Rspamd ([#3440](https://github.com/docker-mailserver/docker-mailserver/pull/3440))
|
||||
- **Documentation:**
|
||||
- Use-case examples / tutorials:
|
||||
- iOS mail push support ([#3513](https://github.com/docker-mailserver/docker-mailserver/pull/3513))
|
||||
- Guide for setting up Dovecot Authentication via Lua ([#3579](https://github.com/docker-mailserver/docker-mailserver/pull/3579))
|
||||
- Guide for integrating with the Crowdsec service ([#3651](https://github.com/docker-mailserver/docker-mailserver/pull/3651))
|
||||
- Debugging page:
|
||||
- New compatibility section ([#3404](https://github.com/docker-mailserver/docker-mailserver/pull/3404))
|
||||
- Now advises how to (re)start DMS correctly ([#3654](https://github.com/docker-mailserver/docker-mailserver/pull/3654))
|
||||
- Better communicate distinction between DMS FQDN and DMS mail accounts ([#3372](https://github.com/docker-mailserver/docker-mailserver/pull/3372))
|
||||
- Traefik example now includes `passthrough=true` on implicit ports ([#3568](https://github.com/docker-mailserver/docker-mailserver/pull/3568))
|
||||
- Rspamd docs have received a variety of revisions ([#3318](https://github.com/docker-mailserver/docker-mailserver/pull/3318), [#3325](https://github.com/docker-mailserver/docker-mailserver/pull/3325), [#3329](https://github.com/docker-mailserver/docker-mailserver/pull/3329))
|
||||
- IPv6 config examples with content tabs ([#3436](https://github.com/docker-mailserver/docker-mailserver/pull/3436))
|
||||
- Mention [internet.nl](https://internet.nl/test-mail/) as another testing service ([#3445](https://github.com/docker-mailserver/docker-mailserver/pull/3445))
|
||||
- `setup alias add ...` CLI help message now includes an example for aliasing to multiple recipients ([#3600](https://github.com/docker-mailserver/docker-mailserver/pull/3600))
|
||||
- `SPAMASSASSIN_SPAM_TO_INBOX=1`, now emits a debug log to raise awareness that `SA_KILL` will be ignored ([#3360](https://github.com/docker-mailserver/docker-mailserver/pull/3360))
|
||||
- `CLAMAV_MESSAGE_SIZE_LIMIT` now logs a warning when the value exceeds what ClamAV is capable of supporting (4GiB max scan size [#3332](https://github.com/docker-mailserver/docker-mailserver/pull/3332), 2GiB max file size [#3341](https://github.com/docker-mailserver/docker-mailserver/pull/3341))
|
||||
- Added note to caution against changing `mydestination` in Postfix's `main.cf` ([#3316](https://github.com/docker-mailserver/docker-mailserver/pull/3316))
|
||||
- **Internal:**
|
||||
- Added a wrapper to update Postfix configuration safely ([#3484](https://github.com/docker-mailserver/docker-mailserver/pull/3484), [#3503](https://github.com/docker-mailserver/docker-mailserver/pull/3503))
|
||||
- Add debug group to `packages.sh` ([#3578](https://github.com/docker-mailserver/docker-mailserver/pull/3578))
|
||||
- **Tests:**
|
||||
- Additional linting check for BASH syntax ([#3369](https://github.com/docker-mailserver/docker-mailserver/pull/3369))
|
||||
|
||||
### Updates
|
||||
|
||||
- **Misc:**
|
||||
- Changed `setup config dkim` default key size to `2048` (`open-dkim`) ([#3508](https://github.com/docker-mailserver/docker-mailserver/pull/3508))
|
||||
- **Postfix:**
|
||||
- Dropped special bits from `maildrop/` and `public/` directory permissions ([#3625](https://github.com/docker-mailserver/docker-mailserver/pull/3625))
|
||||
- **Rspamd:**
|
||||
- Adjusted learning of ham ([#3334](https://github.com/docker-mailserver/docker-mailserver/pull/3334))
|
||||
- Adjusted `antivirus.conf` ([#3331](https://github.com/docker-mailserver/docker-mailserver/pull/3331))
|
||||
- `logrotate` setup + Rspamd log path + tests log helper fallback path ([#3576](https://github.com/docker-mailserver/docker-mailserver/pull/3576))
|
||||
- Setup during container startup is now more resilient ([#3578](https://github.com/docker-mailserver/docker-mailserver/pull/3578))
|
||||
- Changed DKIM default config location ([#3597](https://github.com/docker-mailserver/docker-mailserver/pull/3597))
|
||||
- Removed the symlink for the `override.d/` directory in favor of using `cp`, integrated into the changedetector service, added a `--force` option for the Rspamd DKIM management, and provided a dedicated helper script for common ENV variables ([#3599](https://github.com/docker-mailserver/docker-mailserver/pull/3599))
|
||||
- Required permissions are now verified for DKIM private key files ([#3627](https://github.com/docker-mailserver/docker-mailserver/pull/3627))
|
||||
- **Documentation:**
|
||||
- Documentation aligned to Compose v2 conventions, `docker-compose` command changed to `docker compose`, `docker-compose.yaml` to `compose.yaml` ([#3295](https://github.com/docker-mailserver/docker-mailserver/pull/3295))
|
||||
- Restored missing edit button ([#3338](https://github.com/docker-mailserver/docker-mailserver/pull/3338))
|
||||
- Complete rewrite of the IPv6 page ([#3244](https://github.com/docker-mailserver/docker-mailserver/pull/3244), [#3531](https://github.com/docker-mailserver/docker-mailserver/pull/3531))
|
||||
- Complete rewrite of the "Update and Cleanup" maintenance page ([#3539](https://github.com/docker-mailserver/docker-mailserver/pull/3539), [#3583](https://github.com/docker-mailserver/docker-mailserver/pull/3583))
|
||||
- Improved debugging page advice on working with logs ([#3626](https://github.com/docker-mailserver/docker-mailserver/pull/3626), [#3640](https://github.com/docker-mailserver/docker-mailserver/pull/3640))
|
||||
- Clarified the default for ENV `FETCHMAIL_PARALLEL` ([#3603](https://github.com/docker-mailserver/docker-mailserver/pull/3603))
|
||||
- Removed port 25 from FAQ entry for mail client ports supporting authenticated submission ([#3496](https://github.com/docker-mailserver/docker-mailserver/pull/3496))
|
||||
- Updated home path in docs for Dovecot Sieve ([#3370](https://github.com/docker-mailserver/docker-mailserver/pull/3370), [#3650](https://github.com/docker-mailserver/docker-mailserver/pull/3650))
|
||||
- Fixed path to `rspamd.log` ([#3585](https://github.com/docker-mailserver/docker-mailserver/pull/3585))
|
||||
- "Optional Config" page now uses consistent lowercase convention for directory names ([#3629](https://github.com/docker-mailserver/docker-mailserver/pull/3629))
|
||||
- `CONTRIBUTORS.md`: Removed redundant "All Contributors" section ([#3638](https://github.com/docker-mailserver/docker-mailserver/pull/3638))
|
||||
- **Internal:**
|
||||
- LDAP config improvements (Removed implicit `ldap://` LDAP URI scheme fallback) ([#3522](https://github.com/docker-mailserver/docker-mailserver/pull/3522))
|
||||
- Changed style conventions for internal scripts ([#3361](https://github.com/docker-mailserver/docker-mailserver/pull/3361), [#3364](https://github.com/docker-mailserver/docker-mailserver/pull/3364), [#3365](https://github.com/docker-mailserver/docker-mailserver/pull/3365), [#3366](https://github.com/docker-mailserver/docker-mailserver/pull/3366), [#3368](https://github.com/docker-mailserver/docker-mailserver/pull/3368), [#3464](https://github.com/docker-mailserver/docker-mailserver/pull/3464))
|
||||
- **CI / Automation:**
|
||||
- `.gitattributes` now ensures files are committed with `eol=lf` ([#3527](https://github.com/docker-mailserver/docker-mailserver/pull/3527))
|
||||
- Revised the GitHub issue bug report template ([#3317](https://github.com/docker-mailserver/docker-mailserver/pull/3317), [#3381](https://github.com/docker-mailserver/docker-mailserver/pull/3381), [#3435](https://github.com/docker-mailserver/docker-mailserver/pull/3435))
|
||||
- Clarified that the issue tracker is not for personal support ([#3498](https://github.com/docker-mailserver/docker-mailserver/pull/3498), [#3502](https://github.com/docker-mailserver/docker-mailserver/pull/3502))
|
||||
- Bumped versions of miscellaneous software (also shoutout to @dependabot) ([#3371](https://github.com/docker-mailserver/docker-mailserver/pull/3371), [#3584](https://github.com/docker-mailserver/docker-mailserver/pull/3584), [#3504](https://github.com/docker-mailserver/docker-mailserver/pull/3504), [#3516](https://github.com/docker-mailserver/docker-mailserver/pull/3516))
|
||||
- **Tests:**
|
||||
- Refactored LDAP tests to current conventions ([#3483](https://github.com/docker-mailserver/docker-mailserver/pull/3483))
|
||||
- Changed OpenLDAP image to `bitnami/openldap` ([#3494](https://github.com/docker-mailserver/docker-mailserver/pull/3494))
|
||||
- Revised LDAP config + setup ([#3514](https://github.com/docker-mailserver/docker-mailserver/pull/3514))
|
||||
- Added tests for the helper function `_add_to_or_update_postfix_main()` ([#3505](https://github.com/docker-mailserver/docker-mailserver/pull/3505))
|
||||
- EditorConfig Checker lint now uses a mount path to `/check` instead of `/ci` ([#3655](https://github.com/docker-mailserver/docker-mailserver/pull/3655))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Security:**
|
||||
- Fixed issue with concatenating `$dmarc_milter` and `$dkim_milter` in `main.cf` ([#3380](https://github.com/docker-mailserver/docker-mailserver/pull/3380))
|
||||
- Fixed Rspamd DKIM signing for inbound emails ([#3439](https://github.com/docker-mailserver/docker-mailserver/pull/3439), [#3453](https://github.com/docker-mailserver/docker-mailserver/pull/3453))
|
||||
- OpenDKIM key generation is no longer broken when Rspamd is also enabled ([#3535](https://github.com/docker-mailserver/docker-mailserver/pull/3535))
|
||||
- **Internal:**
|
||||
- The "database" files (_for managing users and aliases_) now correctly filters within lookup query ([#3359](https://github.com/docker-mailserver/docker-mailserver/pull/3359))
|
||||
- `_setup_spam_to_junk()` no longer registered when `SMTP_ONLY=1` ([#3385](https://github.com/docker-mailserver/docker-mailserver/pull/3385))
|
||||
- Dovecot `fts_xapian` is now compiled from source to match the Dovecot package ABI ([#3373](https://github.com/docker-mailserver/docker-mailserver/pull/3373))
|
||||
- **CI:**
|
||||
- Scheduled build now have the correct permissions to run successfully ([#3345](https://github.com/docker-mailserver/docker-mailserver/pull/3345))
|
||||
- **Documentation:**
|
||||
- Miscellaneous spelling and wording improvements ([#3324](https://github.com/docker-mailserver/docker-mailserver/pull/3324), [#3330](https://github.com/docker-mailserver/docker-mailserver/pull/3330), [#3337](https://github.com/docker-mailserver/docker-mailserver/pull/3337), [#3339](https://github.com/docker-mailserver/docker-mailserver/pull/3339), [#3344](https://github.com/docker-mailserver/docker-mailserver/pull/3344), [#3367](https://github.com/docker-mailserver/docker-mailserver/pull/3367), [#3411](https://github.com/docker-mailserver/docker-mailserver/pull/3411), [#3443](https://github.com/docker-mailserver/docker-mailserver/pull/3443))
|
||||
- **Tests:**
|
||||
- Run `pgrep` within the actual container ([#3553](https://github.com/docker-mailserver/docker-mailserver/pull/3553))
|
||||
- `lmtp_ip.bats` improved partial failure output ([#3552](https://github.com/docker-mailserver/docker-mailserver/pull/3552))
|
||||
- Improvements to LDIF test data ([#3506](https://github.com/docker-mailserver/docker-mailserver/pull/3506))
|
||||
- Normalized for `.gitattributes` + improved `eclint` coverage ([#3566](https://github.com/docker-mailserver/docker-mailserver/pull/3566))
|
||||
- Fixed ShellCheck linting for BATS tests ([#3347](https://github.com/docker-mailserver/docker-mailserver/pull/3347))
|
||||
|
||||
## [v12.1.0](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v12.1.0)
|
||||
|
||||
### Added
|
||||
|
||||
- Rspamd:
|
||||
- note about Rspamd's web interface ([#3245](https://github.com/docker-mailserver/docker-mailserver/pull/3245))
|
||||
- add greylisting option & code refactoring ([#3206](https://github.com/docker-mailserver/docker-mailserver/pull/3206))
|
||||
- added `HFILTER_HOSTNAME_UNKNOWN` and make it configurable ([#3248](https://github.com/docker-mailserver/docker-mailserver/pull/3248))
|
||||
- add option to re-enable `reject_unknown_client_hostname` after #3248 ([#3255](https://github.com/docker-mailserver/docker-mailserver/pull/3255))
|
||||
- add DKIM helper script ([#3286](https://github.com/docker-mailserver/docker-mailserver/pull/3286))
|
||||
- make `policyd-spf` configurable ([#3246](https://github.com/docker-mailserver/docker-mailserver/pull/3246))
|
||||
- add 'log' command to set up for Fail2Ban ([#3299](https://github.com/docker-mailserver/docker-mailserver/pull/3299))
|
||||
- `setup` command now expects accounts and aliases to be mutually exclusive ([#3270](https://github.com/docker-mailserver/docker-mailserver/pull/3270))
|
||||
|
||||
### Updated
|
||||
|
||||
- update DKIM/DMARC/SPF docs ([#3231](https://github.com/docker-mailserver/docker-mailserver/pull/3231))
|
||||
- Fail2Ban:
|
||||
- made config more aggressive ([#3243](https://github.com/docker-mailserver/docker-mailserver/pull/3243) & [#3288](https://github.com/docker-mailserver/docker-mailserver/pull/3288))
|
||||
- update fail2ban config examples with current DMS default values ([#3258](https://github.com/docker-mailserver/docker-mailserver/pull/3258))
|
||||
- make Fail2Ban log persistent ([#3269](https://github.com/docker-mailserver/docker-mailserver/pull/3269))
|
||||
- update F2B docs & bind mount links ([#3293](https://github.com/docker-mailserver/docker-mailserver/pull/3293))
|
||||
- Rspamd:
|
||||
- improve Rspamd docs ([#3257](https://github.com/docker-mailserver/docker-mailserver/pull/3257))
|
||||
- script stabilization ([#3261](https://github.com/docker-mailserver/docker-mailserver/pull/3261) & [#3282](https://github.com/docker-mailserver/docker-mailserver/pull/3282))
|
||||
- remove WIP warnings ([#3283](https://github.com/docker-mailserver/docker-mailserver/pull/3283))
|
||||
- improve shutdown function by making PANIC_STRATEGY obsolete ([#3265](https://github.com/docker-mailserver/docker-mailserver/pull/3265))
|
||||
- update `bug_report.yml` ([#3275](https://github.com/docker-mailserver/docker-mailserver/pull/3275))
|
||||
- simplify `bug_report.yml` ([#3276](https://github.com/docker-mailserver/docker-mailserver/pull/3276))
|
||||
- revised the contributor workflow ([#2227](https://github.com/docker-mailserver/docker-mailserver/pull/2227))
|
||||
|
||||
### Changed
|
||||
|
||||
- default registry changed from DockerHub (`docker.io`) to GHCR (`ghcr.io`) ([#3233](https://github.com/docker-mailserver/docker-mailserver/pull/3233))
|
||||
- consistent namings in docs ([#3242](https://github.com/docker-mailserver/docker-mailserver/pull/3242))
|
||||
- get all `policyd-spf` setup in one place ([#3263](https://github.com/docker-mailserver/docker-mailserver/pull/3263))
|
||||
- miscellaneous script improvements ([#3281](https://github.com/docker-mailserver/docker-mailserver/pull/3281))
|
||||
- update FAQ entries ([#3294](https://github.com/docker-mailserver/docker-mailserver/pull/3294))
|
||||
|
||||
### Fixed
|
||||
|
||||
- GitHub Actions docs update workflow ([#3241](https://github.com/docker-mailserver/docker-mailserver/pull/3241))
|
||||
- fix dovecot: ldap mail delivery works ([#3252](https://github.com/docker-mailserver/docker-mailserver/pull/3252))
|
||||
- shellcheck: do not check .git folder ([#3267](https://github.com/docker-mailserver/docker-mailserver/pull/3267))
|
||||
- add missing -E for extended regexes in `smtpd_sender_restrictions` ([#3272](https://github.com/docker-mailserver/docker-mailserver/pull/3272))
|
||||
- fix setting `SRS_EXCLUDE_DOMAINS` during startup ([#3271](https://github.com/docker-mailserver/docker-mailserver/pull/3271))
|
||||
- remove superfluous `EOF` in `dmarc_dkim_spf.sh` ([#3266](https://github.com/docker-mailserver/docker-mailserver/pull/3266))
|
||||
- apply fixes to helpers when using `set -eE` ([#3285](https://github.com/docker-mailserver/docker-mailserver/pull/3285))
|
||||
|
||||
## [12.0.0](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v12.0.0)
|
||||
|
||||
Notable changes are:
|
||||
|
||||
|
@ -157,7 +683,11 @@ Notable changes are:
|
|||
|
||||
### Summary
|
||||
|
||||
This release features a lot of small and medium-sized changes, many related to how the image is build and tested during CI. The build now requires Docker Buildkit as the ClamAV Signatures are added via `COPY --link ...` during build-time. Moreover, the build is now multi-stage. `ENABLE_LDAP` is now deprecated.
|
||||
This release features a lot of small and medium-sized changes, many related to how the image is build and tested during CI. The build now multi-stage based and requires Docker Buildkit, as the ClamAV Signatures are added via `COPY --link ...` during build-time.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- The environment variable `ENABLE_LDAP` is deprecated and will be removed in [13.0.0]. Use `ACCOUNT_PROVISIONER=LDAP` now.
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -184,10 +714,6 @@ This release features a lot of small and medium-sized changes, many related to h
|
|||
- **build**: adjust build arguments
|
||||
- **build**: enhance build process
|
||||
|
||||
### Deprecated
|
||||
|
||||
- The environment variable `ENABLE_LDAP` is deprecated and will be removed in [13.0.0]. Use `ACCOUNT_PROVISIONER=LDAP` now.
|
||||
|
||||
### Removed
|
||||
|
||||
- **configuration**: remove unnecessary configuration files
|
||||
|
@ -254,8 +780,8 @@ In this release the relay-host support saw [significant internal refactoring](ht
|
|||
|
||||
1. **Many** minor improvements were made (cleanup & refactoring). Please refer to the section below to get an overview over all improvements. Moreover, there was a lot of cleanup in the scripts and in the tests. The documentation was adjusted accordingly.
|
||||
2. New environment variables were added:
|
||||
1. [`CLAMAV_MESSAGE_SIZE_LIMIT`](https://docker-mailserver.github.io/docker-mailserver/v11.0/config/environment/#clamav_message_size_limit)
|
||||
2. [`TZ`](https://docker-mailserver.github.io/docker-mailserver/v11.0/config/environment/#tz)
|
||||
1. [`CLAMAV_MESSAGE_SIZE_LIMIT`](https://docker-mailserver.github.io/docker-mailserver/v11.0/config/environment/#clamav_message_size_limit)
|
||||
2. [`TZ`](https://docker-mailserver.github.io/docker-mailserver/v11.0/config/environment/#tz)
|
||||
3. SpamAssassin KAM was added with [`ENABLE_SPAMASSASSIN_KAM`](https://docker-mailserver.github.io/docker-mailserver/v11.0/config/environment/#enable_spamassassin_kam).
|
||||
4. The `fail2ban` command was reworked and can now ban IP addresses as well.
|
||||
5. There were a few small fixes, especially when it comes to bugs in scripts and service restart loops (no functionality changes, only fixes of existing functionality). When building an image from the Dockerfile - Installation of Postfix on modern Linux distributions should now always succeed.
|
||||
|
@ -263,56 +789,55 @@ In this release the relay-host support saw [significant internal refactoring](ht
|
|||
|
||||
### Merged Pull Requests
|
||||
|
||||
- **[improvement]** tests: remove legacy functions / tests by @casperklein in [#2434](https://github.com/docker-mailserver/docker-mailserver/pull/2434)
|
||||
- **[improvement]** `PERMIT_DOCKER=none` as new default value by @casperklein in [#2424](https://github.com/docker-mailserver/docker-mailserver/pull/2424)
|
||||
- **[improvement]** Adjust environment variables to more sensible defaults by @georglauterbach in [#2428](https://github.com/docker-mailserver/docker-mailserver/pull/2428)
|
||||
- **[fix]** macOS linting support by @NorseGaud in [#2448](https://github.com/docker-mailserver/docker-mailserver/pull/2448)
|
||||
- **[improvement]** Rename config examples directory by @casperklein in [#2438](https://github.com/docker-mailserver/docker-mailserver/pull/2438)
|
||||
- **[docs]** FAQ - Update naked/bare domain section by @sportshead in [#2446](https://github.com/docker-mailserver/docker-mailserver/pull/2446)
|
||||
- **[improvement]** Remove obsolete `setup.sh debug inspect` command from usage description by @casperklein in [#2454](https://github.com/docker-mailserver/docker-mailserver/pull/2454)
|
||||
- **[feature]** Introduce `CLAMAV_MESSAGE_SIZE_LIMIT` env by @casperklein in [#2453](https://github.com/docker-mailserver/docker-mailserver/pull/2453)
|
||||
- **[fix]** remove SA reload for KAM by @georglauterbach in [#2456](https://github.com/docker-mailserver/docker-mailserver/pull/2456)
|
||||
- **[docs]** Enhance logrotate description by @casperklein in [#2469](https://github.com/docker-mailserver/docker-mailserver/pull/2469)
|
||||
- **[improvement]** Remove macOS specific code / support + shellcheck should avoid python, regardless of permissions by @NorseGaud in [#2466](https://github.com/docker-mailserver/docker-mailserver/pull/2466)
|
||||
- **[docs]** Update fail2ban.md by @casperklein in [#2484](https://github.com/docker-mailserver/docker-mailserver/pull/2484)
|
||||
- **[fix]** Makefile: Remove backup/restore of obsolete config directory by @casperklein in [#2479](https://github.com/docker-mailserver/docker-mailserver/pull/2479)
|
||||
- **[improvement]** scripts: small refactorings by @georglauterbach in [#2485](https://github.com/docker-mailserver/docker-mailserver/pull/2485)
|
||||
- **[fix]** Building on Ubuntu 21.10 failing to install postfix by @NorseGaud in [#2468](https://github.com/docker-mailserver/docker-mailserver/pull/2468)
|
||||
- **[improvement]** Use FQDN as `REPORT_SENDER` default value by @casperklein in [#2487](https://github.com/docker-mailserver/docker-mailserver/pull/2487)
|
||||
- **[improvement]** Improve test, get rid of sleep by @casperklein in [#2492](https://github.com/docker-mailserver/docker-mailserver/pull/2492)
|
||||
- **[feature]** scripts: new log by @georglauterbach in [#2493](https://github.com/docker-mailserver/docker-mailserver/pull/2493)
|
||||
- **[fix]** Restart supervisord early by @casperklein in [#2494](https://github.com/docker-mailserver/docker-mailserver/pull/2494)
|
||||
- **[improvement]** scripts: renamed function `_errex` -> `_exit_with_error` by @georglauterbach in [#2497](https://github.com/docker-mailserver/docker-mailserver/pull/2497)
|
||||
- **[improvement]** Remove invalid URL from SPF message by @casperklein in [#2503](https://github.com/docker-mailserver/docker-mailserver/pull/2503)
|
||||
- **[improvement]** scripts: refactored scripts located under `target/bin/` by @georglauterbach in [#2500](https://github.com/docker-mailserver/docker-mailserver/pull/2500)
|
||||
- **[improvement]** scripts: refactoring & miscellaneous small changes by @georglauterbach in [#2499](https://github.com/docker-mailserver/docker-mailserver/pull/2499)
|
||||
- **[improvement]** scripts: refactored `daemon-stack.sh` by @georglauterbach in [#2496](https://github.com/docker-mailserver/docker-mailserver/pull/2496)
|
||||
- **[fix]** add compatibility for Bash 4 to setup.sh by @georglauterbach in [#2519](https://github.com/docker-mailserver/docker-mailserver/pull/2519)
|
||||
- **[fix]** tests: disabled "quota exceeded" test by @georglauterbach in [#2511](https://github.com/docker-mailserver/docker-mailserver/pull/2511)
|
||||
- **[fix]** typo in setup-stack.sh by @eltociear in [#2521](https://github.com/docker-mailserver/docker-mailserver/pull/2521)
|
||||
- **[improvement]** scripts: introduce `_log` to `sedfile` by @georglauterbach in [#2507](https://github.com/docker-mailserver/docker-mailserver/pull/2507)
|
||||
- **[feature]** create `.github/FUNDING.yml` by @georglauterbach in [#2512](https://github.com/docker-mailserver/docker-mailserver/pull/2512)
|
||||
- **[improvement]** scripts: refactored `check-for-changes.sh` by @georglauterbach in [#2498](https://github.com/docker-mailserver/docker-mailserver/pull/2498)
|
||||
- **[improvement]** scripts: remove `DMS_DEBUG` by @georglauterbach in [#2523](https://github.com/docker-mailserver/docker-mailserver/pull/2523)
|
||||
- **[feature]** firewall: replace `iptables` with `nftables` by @georglauterbach in [#2505](https://github.com/docker-mailserver/docker-mailserver/pull/2505)
|
||||
- **[improvement]** log: adjust level and message(s) slightly for four messages by @georglauterbach in [#2532](https://github.com/docker-mailserver/docker-mailserver/pull/2532)
|
||||
- **[improvement]** log: introduce proper log level fallback and env getter function by @georglauterbach in [#2506](https://github.com/docker-mailserver/docker-mailserver/pull/2506)
|
||||
- **[feature]** scripts: added `TZ` environment variable to set timezone by @georglauterbach in [#2530](https://github.com/docker-mailserver/docker-mailserver/pull/2530)
|
||||
- **[improvement]** setup: added grace period for account creation by @georglauterbach in [#2531](https://github.com/docker-mailserver/docker-mailserver/pull/2531)
|
||||
- **[improvement]** refactor: letsencrypt implicit location discovery by @polarathene in [#2525](https://github.com/docker-mailserver/docker-mailserver/pull/2525)
|
||||
- **[improvement]** setup.sh/setup: show usage when no argument is given by @casperklein in [#2540](https://github.com/docker-mailserver/docker-mailserver/pull/2540)
|
||||
- **[improvement]** Dockerfile: Remove not needed ENVs and add comment by @casperklein in [#2541](https://github.com/docker-mailserver/docker-mailserver/pull/2541)
|
||||
- **[improvement]** chore: (setup-stack.sh) Fix a small typo by @polarathene in [#2552](https://github.com/docker-mailserver/docker-mailserver/pull/2552)
|
||||
- **[feature]** Add ban feature to fail2ban script by @casperklein in [#2538](https://github.com/docker-mailserver/docker-mailserver/pull/2538)
|
||||
- **[fix]** Fix changedetector restart loop by @casperklein in [#2548](https://github.com/docker-mailserver/docker-mailserver/pull/2548)
|
||||
- **[improvement]** chore: Drop `setup.sh` DATABASE fallback ENV by @polarathene in [#2556](https://github.com/docker-mailserver/docker-mailserver/pull/2556)
|
||||
- **[improvement]** tests: remove legacy functions / tests [#2434](https://github.com/docker-mailserver/docker-mailserver/pull/2434)
|
||||
- **[improvement]** `PERMIT_DOCKER=none` as new default value [#2424](https://github.com/docker-mailserver/docker-mailserver/pull/2424)
|
||||
- **[improvement]** Adjust environment variables to more sensible defaults [#2428](https://github.com/docker-mailserver/docker-mailserver/pull/2428)
|
||||
- **[fix]** macOS linting support [#2448](https://github.com/docker-mailserver/docker-mailserver/pull/2448)
|
||||
- **[improvement]** Rename config examples directory [#2438](https://github.com/docker-mailserver/docker-mailserver/pull/2438)
|
||||
- **[docs]** FAQ - Update naked/bare domain section [#2446](https://github.com/docker-mailserver/docker-mailserver/pull/2446)
|
||||
- **[improvement]** Remove obsolete `setup.sh debug inspect` command from usage description [#2454](https://github.com/docker-mailserver/docker-mailserver/pull/2454)
|
||||
- **[feature]** Introduce `CLAMAV_MESSAGE_SIZE_LIMIT` env [#2453](https://github.com/docker-mailserver/docker-mailserver/pull/2453)
|
||||
- **[fix]** remove SA reload for KAM [#2456](https://github.com/docker-mailserver/docker-mailserver/pull/2456)
|
||||
- **[docs]** Enhance logrotate description [#2469](https://github.com/docker-mailserver/docker-mailserver/pull/2469)
|
||||
- **[improvement]** Remove macOS specific code / support + shellcheck should avoid python, regardless of permissions [#2466](https://github.com/docker-mailserver/docker-mailserver/pull/2466)
|
||||
- **[docs]** Update fail2ban.md [#2484](https://github.com/docker-mailserver/docker-mailserver/pull/2484)
|
||||
- **[fix]** Makefile: Remove backup/restore of obsolete config directory [#2479](https://github.com/docker-mailserver/docker-mailserver/pull/2479)
|
||||
- **[improvement]** scripts: small refactorings [#2485](https://github.com/docker-mailserver/docker-mailserver/pull/2485)
|
||||
- **[fix]** Building on Ubuntu 21.10 failing to install postfix [#2468](https://github.com/docker-mailserver/docker-mailserver/pull/2468)
|
||||
- **[improvement]** Use FQDN as `REPORT_SENDER` default value [#2487](https://github.com/docker-mailserver/docker-mailserver/pull/2487)
|
||||
- **[improvement]** Improve test, get rid of sleep [#2492](https://github.com/docker-mailserver/docker-mailserver/pull/2492)
|
||||
- **[feature]** scripts: new log [#2493](https://github.com/docker-mailserver/docker-mailserver/pull/2493)
|
||||
- **[fix]** Restart supervisord early [#2494](https://github.com/docker-mailserver/docker-mailserver/pull/2494)
|
||||
- **[improvement]** scripts: renamed function `_errex` -> `_exit_with_error` [#2497](https://github.com/docker-mailserver/docker-mailserver/pull/2497)
|
||||
- **[improvement]** Remove invalid URL from SPF message [#2503](https://github.com/docker-mailserver/docker-mailserver/pull/2503)
|
||||
- **[improvement]** scripts: refactored scripts located under `target/bin/` [#2500](https://github.com/docker-mailserver/docker-mailserver/pull/2500)
|
||||
- **[improvement]** scripts: refactoring & miscellaneous small changes [#2499](https://github.com/docker-mailserver/docker-mailserver/pull/2499)
|
||||
- **[improvement]** scripts: refactored `daemon-stack.sh` [#2496](https://github.com/docker-mailserver/docker-mailserver/pull/2496)
|
||||
- **[fix]** add compatibility for Bash 4 to setup.sh [#2519](https://github.com/docker-mailserver/docker-mailserver/pull/2519)
|
||||
- **[fix]** tests: disabled "quota exceeded" test [#2511](https://github.com/docker-mailserver/docker-mailserver/pull/2511)
|
||||
- **[fix]** typo in setup-stack.sh [#2521](https://github.com/docker-mailserver/docker-mailserver/pull/2521)
|
||||
- **[improvement]** scripts: introduce `_log` to `sedfile` [#2507](https://github.com/docker-mailserver/docker-mailserver/pull/2507)
|
||||
- **[feature]** create `.github/FUNDING.yml` [#2512](https://github.com/docker-mailserver/docker-mailserver/pull/2512)
|
||||
- **[improvement]** scripts: refactored `check-for-changes.sh` [#2498](https://github.com/docker-mailserver/docker-mailserver/pull/2498)
|
||||
- **[improvement]** scripts: remove `DMS_DEBUG` [#2523](https://github.com/docker-mailserver/docker-mailserver/pull/2523)
|
||||
- **[feature]** firewall: replace `iptables` with `nftables` [#2505](https://github.com/docker-mailserver/docker-mailserver/pull/2505)
|
||||
- **[improvement]** log: adjust level and message(s) slightly for four messages [#2532](https://github.com/docker-mailserver/docker-mailserver/pull/2532)
|
||||
- **[improvement]** log: introduce proper log level fallback and env getter function [#2506](https://github.com/docker-mailserver/docker-mailserver/pull/2506)
|
||||
- **[feature]** scripts: added `TZ` environment variable to set timezone [#2530](https://github.com/docker-mailserver/docker-mailserver/pull/2530)
|
||||
- **[improvement]** setup: added grace period for account creation [#2531](https://github.com/docker-mailserver/docker-mailserver/pull/2531)
|
||||
- **[improvement]** refactor: letsencrypt implicit location discovery [#2525](https://github.com/docker-mailserver/docker-mailserver/pull/2525)
|
||||
- **[improvement]** setup.sh/setup: show usage when no argument is given [#2540](https://github.com/docker-mailserver/docker-mailserver/pull/2540)
|
||||
- **[improvement]** Dockerfile: Remove not needed ENVs and add comment [#2541](https://github.com/docker-mailserver/docker-mailserver/pull/2541)
|
||||
- **[improvement]** chore: (setup-stack.sh) Fix a small typo [#2552](https://github.com/docker-mailserver/docker-mailserver/pull/2552)
|
||||
- **[feature]** Add ban feature to fail2ban script [#2538](https://github.com/docker-mailserver/docker-mailserver/pull/2538)
|
||||
- **[fix]** Fix changedetector restart loop [#2548](https://github.com/docker-mailserver/docker-mailserver/pull/2548)
|
||||
- **[improvement]** chore: Drop `setup.sh` DATABASE fallback ENV [#2556](https://github.com/docker-mailserver/docker-mailserver/pull/2556)
|
||||
|
||||
## `v10.5.0`
|
||||
|
||||
### Critical Changes
|
||||
|
||||
1. This release fixes a critical issue for LDAP users, installing a needed package on Debian 11
|
||||
on build-time. Moreover, a race-condition was eliminated ([#2341](https://github.com/docker-mailserver/docker-mailserver/pull/2341)).
|
||||
1. This release fixes a critical issue for LDAP users, installing a needed package on Debian 11 on build-time. Moreover, a race-condition was eliminated ([#2341](https://github.com/docker-mailserver/docker-mailserver/pull/2341)).
|
||||
2. A resource leak in `check-for-changes.sh` was fixed ([#2401](https://github.com/docker-mailserver/docker-mailserver/pull/2401))
|
||||
|
||||
### Other Minor Changes
|
||||
|
@ -337,9 +862,9 @@ In this release the relay-host support saw [significant internal refactoring](ht
|
|||
- **[fix]** Fixed non-number-argument in `listmailuser` in [#2382](https://github.com/docker-mailserver/docker-mailserver/pull/2382)
|
||||
- **[fix]** docs: Fail2Ban - Fix links for rootless podman in [#2384](https://github.com/docker-mailserver/docker-mailserver/pull/2384)
|
||||
- **[fix]** docs(kubernetes): fix image name in example in [#2385](https://github.com/docker-mailserver/docker-mailserver/pull/2385)
|
||||
- **[fix]** SSL documentation contains a small bug #2381 by @Twist235 in [#2383](https://github.com/docker-mailserver/docker-mailserver/pull/2383)
|
||||
- **[fix]** SSL documentation contains a small bug #2381 [#2383](https://github.com/docker-mailserver/docker-mailserver/pull/2383)
|
||||
- **[fix]** get rid of subshell + `exec` in `helper-functions.sh` in [#2401](https://github.com/docker-mailserver/docker-mailserver/pull/2401)
|
||||
- **[docs]** Rootless Podman security update by @p-fruck in [#2393](https://github.com/docker-mailserver/docker-mailserver/pull/2393)
|
||||
- **[docs]** Rootless Podman security update [#2393](https://github.com/docker-mailserver/docker-mailserver/pull/2393)
|
||||
- **[fix]** fix: double occurrence of `/etc/postfix/regexp` in [#2397](https://github.com/docker-mailserver/docker-mailserver/pull/2397)
|
||||
- **[improvement]** consistently make 1 the default value for `SPAMASSASSIN_SPAM_TO_INBOX` in [#2361](https://github.com/docker-mailserver/docker-mailserver/pull/2361)
|
||||
- **[docs]** added sieve example for subaddress sorting in [#2410](https://github.com/docker-mailserver/docker-mailserver/pull/2410)
|
||||
|
|
1905
CONTRIBUTORS.md
1905
CONTRIBUTORS.md
File diff suppressed because it is too large
Load Diff
125
Dockerfile
125
Dockerfile
|
@ -1,18 +1,18 @@
|
|||
# syntax=docker.io/docker/dockerfile:1
|
||||
|
||||
# This Dockerfile provides two stages: stage-base and stage-final
|
||||
# This Dockerfile provides four stages: stage-base, stage-compile, stage-main and stage-final
|
||||
# This is in preparation for more granular stages (eg ClamAV and Fail2Ban split into their own)
|
||||
|
||||
#
|
||||
# Base stage provides all packages, config, and adds scripts
|
||||
#
|
||||
|
||||
FROM docker.io/debian:11-slim AS stage-base
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG DOVECOT_COMMUNITY_REPO=1
|
||||
ARG DOVECOT_COMMUNITY_REPO=0
|
||||
ARG LOG_LEVEL=trace
|
||||
|
||||
FROM docker.io/debian:12-slim AS stage-base
|
||||
|
||||
ARG DEBIAN_FRONTEND
|
||||
ARG DOVECOT_COMMUNITY_REPO
|
||||
ARG LOG_LEVEL
|
||||
|
||||
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
|
||||
|
||||
# -----------------------------------------------
|
||||
|
@ -25,10 +25,34 @@ RUN <<EOF
|
|||
adduser --quiet --system --group --disabled-password --home /var/lib/clamav --no-create-home --uid 200 clamav
|
||||
EOF
|
||||
|
||||
COPY target/scripts/build/* /build/
|
||||
COPY target/scripts/build/packages.sh /build/
|
||||
COPY target/scripts/helpers/log.sh /usr/local/bin/helpers/log.sh
|
||||
|
||||
RUN /bin/bash /build/packages.sh
|
||||
RUN /bin/bash /build/packages.sh && rm -r /build
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- Compile deb packages ----------------------
|
||||
# -----------------------------------------------
|
||||
|
||||
FROM stage-base AS stage-compile
|
||||
|
||||
ARG LOG_LEVEL
|
||||
ARG DEBIAN_FRONTEND
|
||||
|
||||
COPY target/scripts/build/compile.sh /build/
|
||||
RUN /bin/bash /build/compile.sh
|
||||
|
||||
#
|
||||
# main stage provides all packages, config, and adds scripts
|
||||
#
|
||||
|
||||
FROM stage-base AS stage-main
|
||||
|
||||
ARG DEBIAN_FRONTEND
|
||||
ARG LOG_LEVEL
|
||||
|
||||
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
|
||||
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- ClamAV & FeshClam -------------------------
|
||||
|
@ -38,9 +62,12 @@ RUN /bin/bash /build/packages.sh
|
|||
# which would require an extra memory of 500MB+ during an image build.
|
||||
# When using `COPY --link`, the `--chown` option is only compatible with numeric ID values.
|
||||
# hadolint ignore=DL3021
|
||||
COPY --link --chown=200 --from=docker.io/clamav/clamav:latest /var/lib/clamav /var/lib/clamav
|
||||
COPY --link --chown=200 --from=docker.io/clamav/clamav-debian:latest /var/lib/clamav /var/lib/clamav
|
||||
|
||||
RUN <<EOF
|
||||
# `COPY --link --chown=200` has a bug when built by the buildx docker-container driver.
|
||||
# Restore ownership of parent dirs (Bug: https://github.com/moby/buildkit/issues/3912)
|
||||
chown root:root /var /var/lib
|
||||
echo '0 */6 * * * clamav /usr/bin/freshclam --quiet' >/etc/cron.d/clamav-freshclam
|
||||
chmod 644 /etc/clamav/freshclam.conf
|
||||
sedfile -i 's/Foreground false/Foreground true/g' /etc/clamav/clamd.conf
|
||||
|
@ -53,19 +80,14 @@ EOF
|
|||
# --- Dovecot -----------------------------------
|
||||
# -----------------------------------------------
|
||||
|
||||
# install fts_xapian plugin
|
||||
|
||||
COPY --from=stage-compile dovecot-fts-xapian-*.deb /
|
||||
RUN dpkg -i /dovecot-fts-xapian-*.deb && rm /dovecot-fts-xapian-*.deb
|
||||
|
||||
COPY target/dovecot/*.inc target/dovecot/*.conf /etc/dovecot/conf.d/
|
||||
COPY target/dovecot/dovecot-purge.cron /etc/cron.d/dovecot-purge.disabled
|
||||
RUN chmod 0 /etc/cron.d/dovecot-purge.disabled
|
||||
WORKDIR /usr/share/dovecot
|
||||
|
||||
# hadolint ignore=SC2016,SC2086,SC2069
|
||||
RUN <<EOF
|
||||
sedfile -i -e 's/include_try \/usr\/share\/dovecot\/protocols\.d/include_try \/etc\/dovecot\/protocols\.d/g' /etc/dovecot/dovecot.conf
|
||||
sedfile -i -e 's/#mail_plugins = \$mail_plugins/mail_plugins = \$mail_plugins sieve/g' /etc/dovecot/conf.d/15-lda.conf
|
||||
sedfile -i -e 's/^.*lda_mailbox_autocreate.*/lda_mailbox_autocreate = yes/g' /etc/dovecot/conf.d/15-lda.conf
|
||||
sedfile -i -e 's/^.*lda_mailbox_autosubscribe.*/lda_mailbox_autosubscribe = yes/g' /etc/dovecot/conf.d/15-lda.conf
|
||||
sedfile -i -e 's/^.*postmaster_address.*/postmaster_address = '${POSTMASTER_ADDRESS:="postmaster@domain.com"}'/g' /etc/dovecot/conf.d/15-lda.conf
|
||||
EOF
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- Rspamd ------------------------------------
|
||||
|
@ -73,11 +95,19 @@ EOF
|
|||
|
||||
COPY target/rspamd/local.d/ /etc/rspamd/local.d/
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- OAUTH2 ------------------------------------
|
||||
# -----------------------------------------------
|
||||
|
||||
COPY target/dovecot/dovecot-oauth2.conf.ext /etc/dovecot
|
||||
COPY target/dovecot/auth-oauth2.conf.ext /etc/dovecot/conf.d
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- LDAP & SpamAssassin's Cron ----------------
|
||||
# -----------------------------------------------
|
||||
|
||||
COPY target/dovecot/dovecot-ldap.conf.ext /etc/dovecot
|
||||
COPY target/dovecot/auth-ldap.conf.ext /etc/dovecot/conf.d
|
||||
COPY \
|
||||
target/postfix/ldap-users.cf \
|
||||
target/postfix/ldap-groups.cf \
|
||||
|
@ -88,9 +118,10 @@ COPY \
|
|||
|
||||
# hadolint ignore=SC2016
|
||||
RUN <<EOF
|
||||
sedfile -i -r 's/^(CRON)=0/\1=1/g' /etc/default/spamassassin
|
||||
# ref: https://github.com/docker-mailserver/docker-mailserver/pull/3403#discussion_r1306282387
|
||||
echo 'CRON=1' >/etc/default/spamassassin
|
||||
sedfile -i -r 's/^\$INIT restart/supervisorctl restart amavis/g' /etc/spamassassin/sa-update-hooks.d/amavisd-new
|
||||
mkdir -p /etc/spamassassin/kam/
|
||||
mkdir /etc/spamassassin/kam/
|
||||
curl -sSfLo /etc/spamassassin/kam/kam.sa-channels.mcgrail.com.key https://mcgrail.com/downloads/kam.sa-channels.mcgrail.com.key
|
||||
EOF
|
||||
|
||||
|
@ -100,12 +131,10 @@ EOF
|
|||
|
||||
COPY target/postsrsd/postsrsd /etc/default/postsrsd
|
||||
COPY target/postgrey/postgrey /etc/default/postgrey
|
||||
COPY target/postgrey/postgrey.init /etc/init.d/postgrey
|
||||
RUN <<EOF
|
||||
chmod 755 /etc/init.d/postgrey
|
||||
mkdir /var/run/postgrey
|
||||
chown postgrey:postgrey /var/run/postgrey
|
||||
curl -Lsfo /etc/postgrey/whitelist_clients https://postgrey.schweikert.ch/pub/postgrey_whitelist_clients
|
||||
curl -Lsfo /etc/postgrey/whitelist_clients https://raw.githubusercontent.com/schweikert/postgrey/master/postgrey_whitelist_clients
|
||||
EOF
|
||||
|
||||
COPY target/amavis/conf.d/* /etc/amavis/conf.d/
|
||||
|
@ -123,6 +152,7 @@ RUN <<EOF
|
|||
EOF
|
||||
|
||||
# overcomplication necessary for CI
|
||||
# hadolint ignore=SC2086
|
||||
RUN <<EOF
|
||||
for _ in {1..10}; do
|
||||
su - amavis -c "razor-admin -create"
|
||||
|
@ -144,10 +174,8 @@ EOF
|
|||
COPY target/fail2ban/jail.local /etc/fail2ban/jail.local
|
||||
COPY target/fail2ban/fail2ban.d/fixes.local /etc/fail2ban/fail2ban.d/fixes.local
|
||||
RUN <<EOF
|
||||
ln -s /var/log/mail/mail.log /var/log/mail.log
|
||||
# disable sshd jail
|
||||
rm /etc/fail2ban/jail.d/defaults-debian.conf
|
||||
mkdir /var/run/fail2ban
|
||||
ln -s /var/log/mail/mail.log /var/log/mail.log
|
||||
ln -sf /var/log/mail/fail2ban.log /var/log/fail2ban.log
|
||||
EOF
|
||||
|
||||
COPY target/opendkim/opendkim.conf /etc/opendkim.conf
|
||||
|
@ -157,15 +185,26 @@ COPY target/opendmarc/opendmarc.conf /etc/opendmarc.conf
|
|||
COPY target/opendmarc/default-opendmarc /etc/default/opendmarc
|
||||
COPY target/opendmarc/ignore.hosts /etc/opendmarc/ignore.hosts
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- Fetchmail, Postfix & Let'sEncrypt ---------
|
||||
# -----------------------------------------------
|
||||
# --------------------------------------------------
|
||||
# --- postfix-mta-sts-daemon -----------------------
|
||||
# --------------------------------------------------
|
||||
COPY target/mta-sts-daemon/mta-sts-daemon.yml /etc/mta-sts-daemon.yml
|
||||
RUN <<EOF
|
||||
mkdir /var/run/mta-sts
|
||||
chown -R _mta-sts:root /var/run/mta-sts
|
||||
EOF
|
||||
|
||||
# --------------------------------------------------
|
||||
# --- Fetchmail, Getmail, Postfix & Let'sEncrypt ---
|
||||
# --------------------------------------------------
|
||||
|
||||
# Remove invalid URL from SPF message
|
||||
# https://bugs.launchpad.net/spf-engine/+bug/1896912
|
||||
RUN echo 'Reason_Message = Message {rejectdefer} due to: {spf}.' >>/etc/postfix-policyd-spf-python/policyd-spf.conf
|
||||
|
||||
COPY target/fetchmail/fetchmailrc /etc/fetchmailrc_general
|
||||
COPY target/getmail/getmailrc_general /etc/getmailrc_general
|
||||
COPY target/getmail/getmail-service.sh /usr/local/bin/
|
||||
COPY target/postfix/main.cf target/postfix/master.cf /etc/postfix/
|
||||
|
||||
# DH parameters for DHE cipher suites, ffdhe4096 is the official standard 4096-bit DH params now part of TLS 1.3
|
||||
|
@ -192,7 +231,7 @@ EOF
|
|||
|
||||
RUN <<EOF
|
||||
sedfile -i -r "/^#?compress/c\compress\ncopytruncate" /etc/logrotate.conf
|
||||
mkdir -p /var/log/mail
|
||||
mkdir /var/log/mail
|
||||
chown syslog:root /var/log/mail
|
||||
touch /var/log/mail/clamav.log
|
||||
chown -R clamav:root /var/log/mail/clamav.log
|
||||
|
@ -208,13 +247,15 @@ RUN <<EOF
|
|||
sedfile -i -r '/postrotate/,/endscript/d' /etc/logrotate.d/clamav-freshclam
|
||||
sedfile -i -r 's|/var/log/mail|/var/log/mail/mail|g' /etc/logrotate.d/rsyslog
|
||||
sedfile -i -r '/\/var\/log\/mail\/mail.log/d' /etc/logrotate.d/rsyslog
|
||||
sedfile -i 's|^/var/log/fail2ban.log {$|/var/log/mail/fail2ban.log {|' /etc/logrotate.d/fail2ban
|
||||
# prevent syslog logrotate warnings
|
||||
sedfile -i -e 's/\(printerror "could not determine current runlevel"\)/#\1/' /usr/sbin/invoke-rc.d
|
||||
sedfile -i -e 's/^\(POLICYHELPER=\).*/\1/' /usr/sbin/invoke-rc.d
|
||||
# prevent syslog warning about imklog permissions
|
||||
sedfile -i -e 's/^module(load=\"imklog\")/#module(load=\"imklog\")/' /etc/rsyslog.conf
|
||||
# prevent email when /sbin/init or init system is not existing
|
||||
sedfile -i -e 's|invoke-rc.d rsyslog rotate > /dev/null|/usr/bin/supervisorctl signal hup rsyslog >/dev/null|g' /usr/lib/rsyslog/rsyslog-rotate
|
||||
# this change is for our alternative process manager rather than part of
|
||||
# a fix related to the change preceding it.
|
||||
echo -e '\n/usr/bin/supervisorctl signal hup rsyslog >/dev/null' >>/usr/lib/rsyslog/rsyslog-rotate
|
||||
EOF
|
||||
|
||||
# -----------------------------------------------
|
||||
|
@ -222,6 +263,7 @@ EOF
|
|||
# -----------------------------------------------
|
||||
|
||||
COPY target/logwatch/maillog.conf /etc/logwatch/conf/logfiles/maillog.conf
|
||||
COPY target/logwatch/ignore.conf /etc/logwatch/conf/ignore.conf
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- Supervisord & Start -----------------------
|
||||
|
@ -241,8 +283,6 @@ RUN <<EOF
|
|||
update-locale
|
||||
EOF
|
||||
|
||||
COPY VERSION /
|
||||
|
||||
COPY \
|
||||
target/bin/* \
|
||||
target/scripts/*.sh \
|
||||
|
@ -258,9 +298,9 @@ COPY target/scripts/startup/setup.d /usr/local/bin/setup.d
|
|||
# Final stage focuses only on image config
|
||||
#
|
||||
|
||||
FROM stage-base AS stage-final
|
||||
FROM stage-main AS stage-final
|
||||
ARG DMS_RELEASE=edge
|
||||
ARG VCS_REVISION=unknown
|
||||
ARG VCS_VERSION=edge
|
||||
|
||||
WORKDIR /
|
||||
EXPOSE 25 587 143 465 993 110 995 4190
|
||||
|
@ -284,11 +324,12 @@ LABEL org.opencontainers.image.title="docker-mailserver"
|
|||
LABEL org.opencontainers.image.vendor="The Docker Mailserver Organization"
|
||||
LABEL org.opencontainers.image.authors="The Docker Mailserver Organization on GitHub"
|
||||
LABEL org.opencontainers.image.licenses="MIT"
|
||||
LABEL org.opencontainers.image.description="A fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.). Only configuration files, no SQL database."
|
||||
LABEL org.opencontainers.image.description="A fullstack but simple mail server (SMTP, IMAP, LDAP, Anti-spam, Anti-virus, etc.). Only configuration files, no SQL database."
|
||||
LABEL org.opencontainers.image.url="https://github.com/docker-mailserver"
|
||||
LABEL org.opencontainers.image.documentation="https://github.com/docker-mailserver/docker-mailserver/blob/master/README.md"
|
||||
LABEL org.opencontainers.image.source="https://github.com/docker-mailserver/docker-mailserver"
|
||||
# ARG invalidates cache when it is used by a layer (implicitly affects RUN)
|
||||
# Thus to maximize cache, keep these lines last:
|
||||
LABEL org.opencontainers.image.revision=${VCS_REVISION}
|
||||
LABEL org.opencontainers.image.version=${VCS_VERSION}
|
||||
LABEL org.opencontainers.image.version=${DMS_RELEASE}
|
||||
ENV DMS_RELEASE=${DMS_RELEASE}
|
||||
|
|
27
Makefile
27
Makefile
|
@ -18,11 +18,7 @@ BATS_PARALLEL_JOBS ?= 2
|
|||
all: lint build generate-accounts tests clean
|
||||
|
||||
build: ALWAYS_RUN
|
||||
@ DOCKER_BUILDKIT=1 docker build \
|
||||
--tag $(IMAGE_NAME) \
|
||||
--build-arg VCS_VERSION=$(shell git rev-parse --short HEAD) \
|
||||
--build-arg VCS_REVISION=$(shell cat VERSION) \
|
||||
.
|
||||
@ docker build --tag $(IMAGE_NAME) .
|
||||
|
||||
generate-accounts: ALWAYS_RUN
|
||||
@ cp test/config/templates/postfix-accounts.cf test/config/postfix-accounts.cf
|
||||
|
@ -36,6 +32,22 @@ clean: ALWAYS_RUN
|
|||
-@ while read -r LINE; do [[ $${LINE} =~ test/.+ ]] && FILES+=("/mnt$${LINE#test}"); done < .gitignore ; \
|
||||
docker run --rm -v "$(REPOSITORY_ROOT)/test/:/mnt" alpine ash -c "rm -rf $${FILES[@]}"
|
||||
|
||||
run-local-instance: ALWAYS_RUN
|
||||
bash -c 'sleep 8 ; ./setup.sh email add postmaster@example.test 123' &
|
||||
docker run --rm --interactive --tty --name dms-test_example \
|
||||
--env OVERRIDE_HOSTNAME=mail.example.test \
|
||||
--env POSTFIX_INET_PROTOCOLS=ipv4 \
|
||||
--env DOVECOT_INET_PROTOCOLS=ipv4 \
|
||||
--env ENABLE_CLAMAV=0 \
|
||||
--env ENABLE_AMAVIS=0 \
|
||||
--env ENABLE_RSPAMD=0 \
|
||||
--env ENABLE_OPENDKIM=0 \
|
||||
--env ENABLE_OPENDMARC=0 \
|
||||
--env ENABLE_POLICYD_SPF=0 \
|
||||
--env ENABLE_SPAMASSASSIN=0 \
|
||||
--env LOG_LEVEL=trace \
|
||||
$(IMAGE_NAME)
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- Tests ------------------------------------
|
||||
# -----------------------------------------------
|
||||
|
@ -61,11 +73,14 @@ test/%: ALWAYS_RUN
|
|||
# --- Lints -------------------------------------
|
||||
# -----------------------------------------------
|
||||
|
||||
lint: ALWAYS_RUN eclint hadolint shellcheck
|
||||
lint: ALWAYS_RUN eclint hadolint bashcheck shellcheck
|
||||
|
||||
hadolint: ALWAYS_RUN
|
||||
@ ./test/linting/lint.sh hadolint
|
||||
|
||||
bashcheck: ALWAYS_RUN
|
||||
@ ./test/linting/lint.sh bashcheck
|
||||
|
||||
shellcheck: ALWAYS_RUN
|
||||
@ ./test/linting/lint.sh shellcheck
|
||||
|
||||
|
|
27
README.md
27
README.md
|
@ -4,22 +4,27 @@
|
|||
|
||||
[ci::status]: https://img.shields.io/github/actions/workflow/status/docker-mailserver/docker-mailserver/default_on_push.yml?branch=master&color=blue&label=CI&logo=github&logoColor=white&style=for-the-badge
|
||||
[ci::github]: https://github.com/docker-mailserver/docker-mailserver/actions
|
||||
[docker::pulls]: https://img.shields.io/docker/pulls/mailserver/docker-mailserver.svg?style=for-the-badge&logo=docker&logoColor=white
|
||||
[docker::pulls]: https://img.shields.io/docker/pulls/mailserver/docker-mailserver.svg?style=for-the-badge&logo=docker&logoColor=white&color=blue
|
||||
[docker::hub]: https://hub.docker.com/r/mailserver/docker-mailserver/
|
||||
[documentation::badge]: https://img.shields.io/badge/DOCUMENTATION-GH%20PAGES-0078D4?style=for-the-badge&logo=git&logoColor=white
|
||||
[documentation::badge]: https://img.shields.io/badge/DOCUMENTATION-GH%20PAGES-0078D4?style=for-the-badge&logo=googledocs&logoColor=white
|
||||
[documentation::web]: https://docker-mailserver.github.io/docker-mailserver/latest/
|
||||
|
||||
## :page_with_curl: About
|
||||
|
||||
A production-ready fullstack but simple containerized mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.). Only configuration files, no SQL database. Keep it simple and versioned. Easy to deploy and upgrade. Originally created by @tomav, this project is now maintained by volunteers since January 2021.
|
||||
A production-ready fullstack but simple containerized mail server (SMTP, IMAP, LDAP, Anti-spam, Anti-virus, etc.).
|
||||
- Only configuration files, no SQL database. Keep it simple and versioned. Easy to deploy and upgrade.
|
||||
- Originally created by [@tomav](https://github.com/tomav), this project is now maintained by volunteers since January 2021.
|
||||
|
||||
## :bulb: Documentation
|
||||
## <!-- Adds a thin line break separator style -->
|
||||
|
||||
We provide a [dedicated documentation][documentation::web] hosted on GitHub Pages. Make sure to read it as it contains all the information necessary to set up and configure your mail server. The documentation is crafted with Markdown & [MkDocs Material](https://squidfunk.github.io/mkdocs-material/).
|
||||
> [!TIP]
|
||||
> Be sure to read [our documentation][documentation::web]. It provides guidance on initial setup of your mail server.
|
||||
|
||||
## :boom: Issues
|
||||
|
||||
If you have issues, please search through [the documentation][documentation::web] **for your version** before opening an issue. The issue tracker is for issues, not for personal support. Make sure the version of the documentation matches the image version you're using!
|
||||
> [!IMPORTANT]
|
||||
> If you have issues, please search through [the documentation][documentation::web] **for your version** before opening an issue.
|
||||
>
|
||||
> The issue tracker is for issues, not for personal support.
|
||||
> Make sure the version of the documentation matches the image version you're using!
|
||||
|
||||
## :link: Links to Useful Resources
|
||||
|
||||
|
@ -33,8 +38,8 @@ If you have issues, please search through [the documentation][documentation::web
|
|||
|
||||
## :package: Included Services
|
||||
|
||||
- [Postfix](http://www.postfix.org) with SMTP or LDAP authentication and support for [extension delimiters](https://docker-mailserver.github.io/docker-mailserver/latest/config/user-management/aliases/#address-tags-extension-delimiters-an-alternative-to-aliases)
|
||||
- [Dovecot](https://www.dovecot.org) with SASL, IMAP, POP3, LDAP, [basic Sieve support](https://docker-mailserver.github.io/docker-mailserver/latest/config/advanced/mail-sieve) and [quotas](https://docker-mailserver.github.io/docker-mailserver/latest/config/user-management/accounts#notes)
|
||||
- [Postfix](http://www.postfix.org) with SMTP or LDAP authentication and support for [extension delimiters](https://docker-mailserver.github.io/docker-mailserver/latest/config/account-management/overview/#aliases)
|
||||
- [Dovecot](https://www.dovecot.org) with SASL, IMAP, POP3, LDAP, [basic Sieve support](https://docker-mailserver.github.io/docker-mailserver/latest/config/advanced/mail-sieve) and [quotas](https://docker-mailserver.github.io/docker-mailserver/latest/config/account-management/overview/#quotas)
|
||||
- [Rspamd](https://rspamd.com/)
|
||||
- [Amavis](https://www.amavis.org/)
|
||||
- [SpamAssassin](http://spamassassin.apache.org/) supporting custom rules
|
||||
|
@ -42,8 +47,10 @@ If you have issues, please search through [the documentation][documentation::web
|
|||
- [OpenDKIM](http://www.opendkim.org) & [OpenDMARC](https://github.com/trusteddomainproject/OpenDMARC)
|
||||
- [Fail2ban](https://www.fail2ban.org/wiki/index.php/Main_Page)
|
||||
- [Fetchmail](http://www.fetchmail.info/fetchmail-man.html)
|
||||
- [Getmail6](https://getmail6.org/documentation.html)
|
||||
- [Postscreen](http://www.postfix.org/POSTSCREEN_README.html)
|
||||
- [Postgrey](https://postgrey.schweikert.ch/)
|
||||
- Support for [LetsEncrypt](https://letsencrypt.org/), manual and self-signed certificates
|
||||
- A [setup script](https://docker-mailserver.github.io/docker-mailserver/latest/config/setup.sh) for easy configuration and maintenance
|
||||
- SASLauthd with LDAP authentication
|
||||
- OAuth2 authentication (_via `XOAUTH2` or `OAUTHBEARER` SASL mechanisms_)
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
services:
|
||||
mailserver:
|
||||
image: docker.io/mailserver/docker-mailserver:latest
|
||||
image: ghcr.io/docker-mailserver/docker-mailserver:latest
|
||||
container_name: mailserver
|
||||
# Provide the FQDN of your mail server here (Your DNS MX record should point to this value)
|
||||
hostname: mail.example.com
|
||||
env_file: mailserver.env
|
||||
# More information about the mail-server ports:
|
||||
# https://docker-mailserver.github.io/docker-mailserver/latest/config/security/understanding-the-ports/
|
||||
# To avoid conflicts with yaml base-60 float, DO NOT remove the quotation marks.
|
||||
ports:
|
||||
- "25:25" # SMTP (explicit TLS => STARTTLS)
|
||||
- "25:25" # SMTP (explicit TLS => STARTTLS, Authentication is DISABLED => use port 465/587 instead)
|
||||
- "143:143" # IMAP4 (explicit TLS => STARTTLS)
|
||||
- "465:465" # ESMTP (implicit TLS)
|
||||
- "587:587" # ESMTP (explicit TLS => STARTTLS)
|
|
@ -1,4 +1,4 @@
|
|||
# File for additional dovecot configurations.
|
||||
# For more informations read https://doc.dovecot.org/configuration_manual/quick_configuration/
|
||||
# For more information read https://doc.dovecot.org/configuration_manual/quick_configuration/
|
||||
|
||||
#mail_max_userip_connections = 50
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
# Changes: in most of the cases you should not modify this
|
||||
# file, but provide customizations in fail2ban.local file, e.g.:
|
||||
#
|
||||
# [Definition]
|
||||
# [DEFAULT]
|
||||
# loglevel = DEBUG
|
||||
#
|
||||
|
||||
[Definition]
|
||||
[DEFAULT]
|
||||
|
||||
# Option: loglevel
|
||||
# Notes.: Set the log level output.
|
||||
|
@ -19,26 +19,26 @@
|
|||
# NOTICE
|
||||
# INFO
|
||||
# DEBUG
|
||||
# Values: [ LEVEL ] Default: ERROR
|
||||
# Values: [ LEVEL ] Default: INFO
|
||||
#
|
||||
#loglevel = INFO
|
||||
loglevel = INFO
|
||||
|
||||
# Option: logtarget
|
||||
# Notes.: Set the log target. This could be a file, SYSLOG, STDERR or STDOUT.
|
||||
# Notes.: Set the log target. This could be a file, SYSTEMD-JOURNAL, SYSLOG, STDERR or STDOUT.
|
||||
# Only one log target can be specified.
|
||||
# If you change logtarget from the default value and you are
|
||||
# using logrotate -- also adjust or disable rotation in the
|
||||
# corresponding configuration file
|
||||
# (e.g. /etc/logrotate.d/fail2ban on Debian systems)
|
||||
# Values: [ STDOUT | STDERR | SYSLOG | SYSOUT | FILE ] Default: STDERR
|
||||
# Values: [ STDOUT | STDERR | SYSLOG | SYSOUT | SYSTEMD-JOURNAL | FILE ] Default: STDERR
|
||||
#
|
||||
#logtarget = /var/log/fail2ban.log
|
||||
logtarget = /var/log/fail2ban.log
|
||||
|
||||
# Option: syslogsocket
|
||||
# Notes: Set the syslog socket file. Only used when logtarget is SYSLOG
|
||||
# auto uses platform.system() to determine predefined paths
|
||||
# Values: [ auto | FILE ] Default: auto
|
||||
#syslogsocket = auto
|
||||
syslogsocket = auto
|
||||
|
||||
# Option: socket
|
||||
# Notes.: Set the socket file. This is used to communicate with the daemon. Do
|
||||
|
@ -46,24 +46,47 @@
|
|||
# communicate with the server afterwards.
|
||||
# Values: [ FILE ] Default: /var/run/fail2ban/fail2ban.sock
|
||||
#
|
||||
#socket = /var/run/fail2ban/fail2ban.sock
|
||||
socket = /var/run/fail2ban/fail2ban.sock
|
||||
|
||||
# Option: pidfile
|
||||
# Notes.: Set the PID file. This is used to store the process ID of the
|
||||
# fail2ban server.
|
||||
# Values: [ FILE ] Default: /var/run/fail2ban/fail2ban.pid
|
||||
#
|
||||
#pidfile = /var/run/fail2ban/fail2ban.pid
|
||||
pidfile = /var/run/fail2ban/fail2ban.pid
|
||||
|
||||
# Option: allowipv6
|
||||
# Notes.: Allows IPv6 interface:
|
||||
# Default: auto
|
||||
# Values: [ auto yes (on, true, 1) no (off, false, 0) ] Default: auto
|
||||
#allowipv6 = auto
|
||||
|
||||
# Options: dbfile
|
||||
# Notes.: Set the file for the fail2ban persistent data to be stored.
|
||||
# A value of ":memory:" means database is only stored in memory
|
||||
# A value of ":memory:" means database is only stored in memory
|
||||
# and data is lost when fail2ban is stopped.
|
||||
# A value of "None" disables the database.
|
||||
# Values: [ None :memory: FILE ] Default: /var/lib/fail2ban/fail2ban.sqlite3
|
||||
#dbfile = /var/lib/fail2ban/fail2ban.sqlite3
|
||||
dbfile = /var/lib/fail2ban/fail2ban.sqlite3
|
||||
|
||||
# Options: dbpurgeage
|
||||
# Notes.: Sets age at which bans should be purged from the database
|
||||
# Values: [ SECONDS ] Default: 86400 (24hours)
|
||||
#dbpurgeage = 1d
|
||||
dbpurgeage = 1d
|
||||
|
||||
# Options: dbmaxmatches
|
||||
# Notes.: Number of matches stored in database per ticket (resolvable via
|
||||
# tags <ipmatches>/<ipjailmatches> in actions)
|
||||
# Values: [ INT ] Default: 10
|
||||
dbmaxmatches = 10
|
||||
|
||||
[Definition]
|
||||
|
||||
|
||||
[Thread]
|
||||
|
||||
# Options: stacksize
|
||||
# Notes.: Specifies the stack size (in KiB) to be used for subsequently created threads,
|
||||
# and must be 0 or a positive integer value of at least 32.
|
||||
# Values: [ SIZE ] Default: 0 (use platform or configured default)
|
||||
#stacksize = 0
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
[DEFAULT]
|
||||
|
||||
# "bantime" is the number of seconds that a host is banned.
|
||||
bantime = 3h
|
||||
bantime = 1w
|
||||
|
||||
# A host is banned if it has generated "maxretry" during the last "findtime"
|
||||
# seconds.
|
||||
findtime = 10m
|
||||
findtime = 1w
|
||||
|
||||
# "maxretry" is the number of failures before a host get banned.
|
||||
maxretry = 3
|
||||
maxretry = 6
|
||||
|
||||
# "ignoreip" can be a list of IP addresses, CIDR masks or DNS hosts. Fail2ban
|
||||
# will not ban a host which matches an address in this list. Several addresses
|
||||
|
@ -25,6 +25,9 @@ enabled = true
|
|||
|
||||
[postfix]
|
||||
enabled = true
|
||||
# For a reference on why this mode was chose, see
|
||||
# https://github.com/docker-mailserver/docker-mailserver/issues/3256#issuecomment-1511188760
|
||||
mode = extra
|
||||
|
||||
[postfix-sasl]
|
||||
enabled = true
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# https://getmail6.org/configuration.html#conf-options
|
||||
|
||||
[options]
|
||||
verbose = 0
|
||||
read_all = false
|
||||
delete = false
|
||||
max_messages_per_session = 500
|
||||
received = false
|
||||
delivered_to = false
|
||||
message_log_syslog = true
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# https://getmail6.org/configuration.html
|
||||
|
||||
[retriever]
|
||||
type = SimpleIMAPSSLRetriever
|
||||
server = imap.gmail.com
|
||||
username = alice
|
||||
password = notsecure
|
||||
|
||||
[destination]
|
||||
type = MDA_external
|
||||
path = /usr/lib/dovecot/deliver
|
||||
allow_root_commands = true
|
||||
arguments =("-d","user1@example.com")
|
|
@ -0,0 +1,13 @@
|
|||
# https://getmail6.org/configuration.html
|
||||
|
||||
[retriever]
|
||||
type = SimplePOP3SSLRetriever
|
||||
server = pop3.gmail.com
|
||||
username = alice
|
||||
password = notsecure
|
||||
|
||||
[destination]
|
||||
type = MDA_external
|
||||
path = /usr/lib/dovecot/deliver
|
||||
allow_root_commands = true
|
||||
arguments =("-d","user1@example.com")
|
|
@ -0,0 +1,60 @@
|
|||
# Docs: https://docker-mailserver.github.io/docker-mailserver/v15.0/config/advanced/mail-fetchmail
|
||||
# Additional context, with CLI commands for verification:
|
||||
# https://github.com/orgs/docker-mailserver/discussions/3994#discussioncomment-9290570
|
||||
|
||||
services:
|
||||
dms-fetch:
|
||||
image: ghcr.io/docker-mailserver/docker-mailserver:latest # :15.0
|
||||
hostname: mail.example.test
|
||||
environment:
|
||||
ENABLE_FETCHMAIL: 1
|
||||
# We change this setting to 10 for quicker testing:
|
||||
FETCHMAIL_POLL: 10
|
||||
# Link the DNS lookup `remote.test` to resolve to the `dms-remote` container IP (for `@remote.test` address):
|
||||
# This is only for this example, since no real DNS service is configured, this is a Docker internal DNS feature:
|
||||
links:
|
||||
- "dms-remote:remote.test"
|
||||
# NOTE: Optional, You only need to publish ports if you want to verify via your own mail client.
|
||||
#ports:
|
||||
# - "465:465" # ESMTP (implicit TLS)
|
||||
# - "993:993" # IMAP4 (implicit TLS)
|
||||
# You'd normally use `volumes` here but for simplicity of the example, all config is contained within `compose.yaml`:
|
||||
configs:
|
||||
- source: dms-accounts-fetch
|
||||
target: /tmp/docker-mailserver/postfix-accounts.cf
|
||||
- source: fetchmail
|
||||
target: /tmp/docker-mailserver/fetchmail.cf
|
||||
|
||||
dms-remote:
|
||||
image: ghcr.io/docker-mailserver/docker-mailserver:latest # :15.0
|
||||
hostname: mail.remote.test
|
||||
environment:
|
||||
# Allows for us send a test mail easily by trusting any mail client run within this container (`swaks`):
|
||||
PERMIT_DOCKER: container
|
||||
# Alternatively, trust and accept any mail received from clients in same subnet of dms-fetch:
|
||||
#PERMIT_DOCKER: connected-networks
|
||||
configs:
|
||||
- source: dms-accounts-remote
|
||||
target: /tmp/docker-mailserver/postfix-accounts.cf
|
||||
|
||||
# Using the Docker Compose `configs.content` feature instead of volume mounting separate files.
|
||||
# NOTE: This feature requires Docker Compose v2.23.1 (Nov 2023) or newer:
|
||||
# https://github.com/compose-spec/compose-spec/pull/446
|
||||
configs:
|
||||
fetchmail:
|
||||
content: |
|
||||
poll 'mail.remote.test' proto imap
|
||||
user 'jane.doe@remote.test'
|
||||
pass 'secret'
|
||||
is 'john.doe@example.test'
|
||||
no sslcertck
|
||||
|
||||
# DMS requires an account to complete setup, configure one for each instance:
|
||||
# NOTE: Both accounts are configured with the same password (SHA512-CRYPT hashed), `secret`.
|
||||
dms-accounts-fetch:
|
||||
content: |
|
||||
john.doe@example.test|{SHA512-CRYPT}$$6$$sbgFRCmQ.KWS5ryb$$EsWrlYosiadgdUOxCBHY0DQ3qFbeudDhNMqHs6jZt.8gmxUwiLVy738knqkHD4zj4amkb296HFqQ3yDq4UXt8.
|
||||
|
||||
dms-accounts-remote:
|
||||
content: |
|
||||
jane.doe@remote.test|{SHA512-CRYPT}$$6$$sbgFRCmQ.KWS5ryb$$EsWrlYosiadgdUOxCBHY0DQ3qFbeudDhNMqHs6jZt.8gmxUwiLVy738knqkHD4zj4amkb296HFqQ3yDq4UXt8.
|
|
@ -0,0 +1,147 @@
|
|||
# Docs: https://docker-mailserver.github.io/docker-mailserver/v15.0/config/advanced/mail-forwarding/relay-hosts/
|
||||
# Additional context, with CLI commands for verification:
|
||||
# https://github.com/docker-mailserver/docker-mailserver/issues/4136#issuecomment-2253693490
|
||||
|
||||
services:
|
||||
# This would represent your actual DMS container:
|
||||
dms-sender:
|
||||
image: mailserver/docker-mailserver:latest # :15.0
|
||||
hostname: mail.example.test
|
||||
environment:
|
||||
# All outbound mail will be relayed through this host
|
||||
# (change the port to 587 if you do not want the postfix-main.cf override)
|
||||
- DEFAULT_RELAY_HOST=[smtp.relay-service.test]:465
|
||||
# Your relay host credentials.
|
||||
# (since the relay in the example is DMS, the relay account username is a full email address)
|
||||
- RELAY_USER=relay-user@relay-service.test
|
||||
- RELAY_PASSWORD=secret
|
||||
# The mail client (swaks) needs to connect with TLS:
|
||||
- SSL_TYPE=manual
|
||||
- SSL_KEY_PATH=/tmp/tls/key.pem
|
||||
- SSL_CERT_PATH=/tmp/tls/cert.pem
|
||||
# You would usually have `volumes` instead of this `configs`:
|
||||
configs:
|
||||
- source: dms-main
|
||||
target: /tmp/docker-mailserver/postfix-main.cf
|
||||
- source: dms-accounts
|
||||
target: /tmp/docker-mailserver/postfix-accounts.cf
|
||||
# Authenticating on port 587 or 465 enforces TLS requirement:
|
||||
- source: tls-cert
|
||||
target: /tmp/tls/cert.pem
|
||||
- source: tls-key
|
||||
target: /tmp/tls/key.pem
|
||||
# This is only needed if you want to verify the TLS cert chain with swaks
|
||||
# (normally with public CA providers like LetsEncrypt this file is already available to a mail client)
|
||||
- source: tls-ca-cert
|
||||
target: /tmp/tls/ca-cert.pem
|
||||
|
||||
# Pretend this is your third-party relay service:
|
||||
dms-relay:
|
||||
image: mailserver/docker-mailserver:latest # :15.0
|
||||
hostname: smtp.relay-service.test
|
||||
environment:
|
||||
# WORKAROUND: Bypass security checks from the mail-client (dms-sender container)
|
||||
# (avoids needing expected DNS records to run this example)
|
||||
- PERMIT_DOCKER=connected-networks
|
||||
# TLS is required when relaying to dms-relay via ports 587 / 465
|
||||
# (dms-relay will then relay the mail to dms-destination over port 25)
|
||||
- SSL_TYPE=manual
|
||||
- SSL_KEY_PATH=/tmp/tls/key.pem
|
||||
- SSL_CERT_PATH=/tmp/tls/cert.pem
|
||||
configs:
|
||||
- source: dms-accounts-relay
|
||||
target: /tmp/docker-mailserver/postfix-accounts.cf
|
||||
- source: tls-cert
|
||||
target: /tmp/tls/cert.pem
|
||||
- source: tls-key
|
||||
target: /tmp/tls/key.pem
|
||||
|
||||
# Pretend this is another mail server that your target recipient belongs to (like Gmail):
|
||||
dms-destination:
|
||||
image: mailserver/docker-mailserver:latest # :15.0
|
||||
hostname: mail.destination.test
|
||||
# WORKAROUND: dms-relay must be able to resolve DNS for `@destination.test` to the IP of this container:
|
||||
# Normally a MX record would direct mail to the MTA (eg: `mail.destination.test`)
|
||||
networks:
|
||||
default:
|
||||
aliases:
|
||||
- destination.test
|
||||
environment:
|
||||
# WORKAROUND: Same workaround as needed for dms-relay
|
||||
- PERMIT_DOCKER=connected-networks
|
||||
configs:
|
||||
- source: dms-accounts-destination
|
||||
target: /tmp/docker-mailserver/postfix-accounts.cf
|
||||
|
||||
# Using the Docker Compose `configs.content` feature instead of volume mounting separate files.
|
||||
# NOTE: This feature requires Docker Compose v2.23.1 (Nov 2023) or newer:
|
||||
# https://github.com/compose-spec/compose-spec/pull/446
|
||||
configs:
|
||||
# `postfix-main.cf`, a single line change to make all outbound SMTP connections over implicit TLS instead of the default explicit TLS (StartTLS).
|
||||
# NOTE: If you need to only selectively relay mail, you would need to instead adjust this on the relay service in `/etc/postfix/master.cf`,
|
||||
# However DMS presently modifies this when using the DMS Relay Host feature support, which may override `postfix-master.cf` or `user-patches.sh` due to `check-for-changes.sh`.
|
||||
dms-main:
|
||||
content: |
|
||||
smtp_tls_wrappermode=yes
|
||||
|
||||
# DMS expects an account to be configured to run, this example provides accounts already created.
|
||||
# Login credentials:
|
||||
# user: "john.doe@example.test" password: "secret"
|
||||
# user: "relay-user@relay-service.test" password: "secret"
|
||||
# user: "jane.doe@destination.test" password: "secret"
|
||||
dms-accounts:
|
||||
# NOTE: `$` needed to be repeated to escape it,
|
||||
# which opts out of the `compose.yaml` variable interpolation feature.
|
||||
content: |
|
||||
john.doe@example.test|{SHA512-CRYPT}$$6$$sbgFRCmQ.KWS5ryb$$EsWrlYosiadgdUOxCBHY0DQ3qFbeudDhNMqHs6jZt.8gmxUwiLVy738knqkHD4zj4amkb296HFqQ3yDq4UXt8.
|
||||
|
||||
dms-accounts-relay:
|
||||
content: |
|
||||
relay-user@relay-service.test|{SHA512-CRYPT}$$6$$o65y1ZXC4ooOPLwZ$$7TF1nYowEtNJpH6BwJBgdj2pPAxaCvhIKQA6ww5zdHm/AA7aemY9eoHC91DOgYNaKj1HLxSeWNDdvrp6mbtUY.
|
||||
|
||||
dms-accounts-destination:
|
||||
content: |
|
||||
jane.doe@destination.test|{SHA512-CRYPT}$$6$$o65y1ZXC4ooOPLwZ$$7TF1nYowEtNJpH6BwJBgdj2pPAxaCvhIKQA6ww5zdHm/AA7aemY9eoHC91DOgYNaKj1HLxSeWNDdvrp6mbtUY.
|
||||
|
||||
# TLS files:
|
||||
# - Use an ECDSA cert that's been signed by a self-signed CA for TLS cert verification.
|
||||
# - This cert is only valid for mail.example.test, mail.destination.test, smtp.relay-service.test
|
||||
|
||||
# `swaks` run in the container will need to reference this CA cert file for successful verficiation (optional).
|
||||
tls-ca-cert:
|
||||
content: |
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIBfTCCASKgAwIBAgIRAMAZttlRlkcuSun0yV0z4RwwCgYIKoZIzj0EAwIwHDEa
|
||||
MBgGA1UEAxMRU21hbGxzdGVwIFJvb3QgQ0EwHhcNMjEwMTAxMDAwMDAwWhcNMzEw
|
||||
MTAxMDAwMDAwWjAcMRowGAYDVQQDExFTbWFsbHN0ZXAgUm9vdCBDQTBZMBMGByqG
|
||||
SM49AgEGCCqGSM49AwEHA0IABJX2hCtoK3+bM5I3rmyApXLJ1gOcVhtoSSwM8XXR
|
||||
SEl25Kkc0n6mINuMK8UrBkiBUgexf6CYayx3xVr9TmMkg4KjRTBDMA4GA1UdDwEB
|
||||
/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMB0GA1UdDgQWBBQD8sBrApbyYyqU
|
||||
y+/TlwGynx2V5jAKBggqhkjOPQQDAgNJADBGAiEAi8N2eOETI+6hY3+G+kzNMd3K
|
||||
Sd3Ke8b++/nlwr5Fb/sCIQDYAjpKp/MpTDWICeHC2tcB5ptxoTdWkTBuG4rKcktA
|
||||
0w==
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
tls-key:
|
||||
content: |
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIOc6wqZmSDmT336K4O26dMk1RCVc0+cmnsO2eK4P5K5yoAoGCCqGSM49
|
||||
AwEHoUQDQgAEFOWNgekKKvUZE89vJ7henUYxODYIvCiHitRc2ylwttjqt1KUY1cp
|
||||
q3jof2fhURHfBUH3dHPXLHig5V9Jw5gqeg==
|
||||
-----END EC PRIVATE KEY-----
|
||||
|
||||
tls-cert:
|
||||
content: |
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIB9DCCAZqgAwIBAgIQE53a/y2c//YXRsz2kLm6gDAKBggqhkjOPQQDAjAcMRow
|
||||
GAYDVQQDExFTbWFsbHN0ZXAgUm9vdCBDQTAeFw0yMTAxMDEwMDAwMDBaFw0zMTAx
|
||||
MDEwMDAwMDBaMBkxFzAVBgNVBAMTDlNtYWxsc3RlcCBMZWFmMFkwEwYHKoZIzj0C
|
||||
AQYIKoZIzj0DAQcDQgAEFOWNgekKKvUZE89vJ7henUYxODYIvCiHitRc2ylwttjq
|
||||
t1KUY1cpq3jof2fhURHfBUH3dHPXLHig5V9Jw5gqeqOBwDCBvTAOBgNVHQ8BAf8E
|
||||
BAMCB4AwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBSz
|
||||
w74g+O6dcBbwienD70D8A9ESmDAfBgNVHSMEGDAWgBQD8sBrApbyYyqUy+/TlwGy
|
||||
nx2V5jBMBgNVHREERTBDghFtYWlsLmV4YW1wbGUudGVzdIIVbWFpbC5kZXN0aW5h
|
||||
dGlvbi50ZXN0ghdzbXRwLnJlbGF5LXNlcnZpY2UudGVzdDAKBggqhkjOPQQDAgNI
|
||||
ADBFAiEAoety5oClZtuBMkvlUIWRmWlyg1VIOZ544LSEbplsIhcCIHb6awMwNdXP
|
||||
m/xHjFkuwH1+UjDDRW53Ih7KZoLrQ6Cp
|
||||
-----END CERTIFICATE-----
|
|
@ -16,12 +16,16 @@ If you want to append instead, switch `::before` to `::after`.
|
|||
src: url('../fonts/external-link.woff') format('woff');
|
||||
}
|
||||
|
||||
/* Matches the two nav link classes that start with `http` `href` values, regular docs pages use relative URLs instead. */
|
||||
.md-tabs__link[href^="http"]::before, .md-nav__link[href^="http"]::before {
|
||||
/*
|
||||
Since mkdocs-material 9.5.5 broke support in our docs from DMS v13.3.1, we now use our own class name,
|
||||
which has been included for the two external nav links in mkdocs.yml via workaround (insert HTML).
|
||||
*/
|
||||
.icon-external-link::before {
|
||||
display: inline-block; /* treat similar to text */
|
||||
font-family: 'external-link';
|
||||
content:'\0041'; /* represents "A" which our font renders as an icon instead of the "A" glyph */
|
||||
font-size: 80%; /* icon is a little too big by default, scale it down */
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
/* ============================================================================================================= */
|
||||
|
@ -98,3 +102,42 @@ div.md-content article.md-content__inner a.toclink code {
|
|||
.highlight.no-copy .md-clipboard { display: none; }
|
||||
|
||||
/* ============================================================================================================= */
|
||||
|
||||
/* Make the left-sidebar nav categories better distinguished from page links (bold text) */
|
||||
.md-nav__item--nested > .md-nav__link {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* ============================================================================================================= */
|
||||
|
||||
/*
|
||||
TaskList style for a pro/con list. Presently only used for this type of list in the kubernetes docs.
|
||||
Uses a custom icon for the unchecked (con) state: :octicons-x-circle-fill-24:
|
||||
https://github.com/squidfunk/mkdocs-material/discussions/6811#discussioncomment-8700795
|
||||
|
||||
TODO: Can better scope the style under a class name when migrating to block extension syntax:
|
||||
https://github.com/facelessuser/pymdown-extensions/discussions/1973
|
||||
*/
|
||||
|
||||
:root {
|
||||
--md-tasklist-icon--failed: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M1 12C1 5.925 5.925 1 12 1s11 4.925 11 11-4.925 11-11 11S1 18.075 1 12Zm8.036-4.024a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042L10.939 12l-2.963 2.963a.749.749 0 0 0 .326 1.275.749.749 0 0 0 .734-.215L12 13.06l2.963 2.964a.75.75 0 0 0 1.061-1.06L13.061 12l2.963-2.964a.749.749 0 0 0-.326-1.275.749.749 0 0 0-.734.215L12 10.939Z"/></svg>');
|
||||
}
|
||||
|
||||
.md-typeset [type="checkbox"] + .task-list-indicator::before {
|
||||
background-color: rgb(216, 87, 48);
|
||||
-webkit-mask-image: var(--md-tasklist-icon--failed);
|
||||
mask-image: var(--md-tasklist-icon--failed);
|
||||
}
|
||||
|
||||
/* More suitable shade of green */
|
||||
.md-typeset [type=checkbox]:checked+.task-list-indicator:before {
|
||||
background-color: rgb(97, 216, 42);
|
||||
}
|
||||
|
||||
/* Tiny layout shift */
|
||||
[dir=ltr] .md-typeset .task-list-indicator:before {
|
||||
left: -1.6em;
|
||||
top: 1px;
|
||||
}
|
||||
|
||||
/* ============================================================================================================= */
|
||||
|
|
|
@ -0,0 +1,252 @@
|
|||
# Account Management - Overview
|
||||
|
||||
This page provides a technical reference for account management in DMS.
|
||||
|
||||
!!! note "Account provisioners and alternative authentication support"
|
||||
|
||||
Each [`ACCOUNT_PROVISIONER`][docs::env::account-provisioner] has a separate page for configuration guidance and caveats:
|
||||
|
||||
- [`FILE` provisioner docs][docs::account-provisioner::file]
|
||||
- [`LDAP` provisioner docs][docs::account-provisioner::ldap]
|
||||
|
||||
Authentication from the provisioner can be supplemented with additional methods:
|
||||
|
||||
- [OAuth2 / OIDC][docs::account-auth::oauth2] (_allow login from an external authentication service_)
|
||||
- [Master Accounts][docs::account-auth::master-accounts] (_access the mailbox of any DMS account_)
|
||||
|
||||
---
|
||||
|
||||
For custom authentication requirements, you could [implement this with Lua][docs::examples::auth-lua].
|
||||
|
||||
## Accounts
|
||||
|
||||
!!! info
|
||||
|
||||
To receive or send mail, you'll need to provision user accounts into DMS (_as each provisioner page documents_).
|
||||
|
||||
---
|
||||
|
||||
A DMS account represents a user with their _login username_ + password, and optional config like aliases and quota.
|
||||
|
||||
- Sending mail from different addresses **does not require** aliases or separate accounts.
|
||||
- Each account is configured with a _primary email address_ that a mailbox is associated to.
|
||||
|
||||
??? info "Primary email address"
|
||||
|
||||
The email address associated to an account creates a mailbox. This address is relevant:
|
||||
|
||||
- When DMS **receives mail** for that address as the recipient (_or an alias that resolves to it_), to identify which mailbox to deliver into.
|
||||
- With **mail submission**:
|
||||
- `SPOOF_PROTECTION=1` **restricts the sender address** to the DMS account email address (_unless additional sender addresses have been permitted via supported config_).
|
||||
- `SPOOF_PROTECTION=0` allows DMS accounts to **use any sender address** (_only a single DMS account is necessary to send mail with different sender addresses_).
|
||||
|
||||
---
|
||||
|
||||
For more details, see the [Technical Overview](#technical-overview) section.
|
||||
|
||||
??? note "Support for multiple mail domains"
|
||||
|
||||
No extra configuration in DMS is required after provisioning an account with an email address.
|
||||
|
||||
- The DNS records for a domain should direct mail to DMS and allow DMS to send mail on behalf of that domain.
|
||||
- DMS does not need TLS certificates for your mail domains, only for the DMS FQDN (_the `hostname` setting_).
|
||||
|
||||
??? warning "Choosing a compatible email address"
|
||||
|
||||
An email address should conform to the standard [permitted charset and format][email-syntax::valid-charset-format] (`local-part@domain-part`).
|
||||
|
||||
---
|
||||
|
||||
DMS has features that need to reserve special characters to work correctly. Ensure those characters are not present in email addresses you configure for DMS, otherwise disable / opt-out of the feature.
|
||||
|
||||
- [Sub-addressing](#sub-addressing) is enabled by default with `+` as the _tag delimiter_. The tag can be changed, feature opt-out when the tag is explicitly unset.
|
||||
|
||||
### Aliases
|
||||
|
||||
!!! info
|
||||
|
||||
Aliases allow receiving mail:
|
||||
|
||||
- As an alternative delivery address for a DMS account mailbox.
|
||||
- To redirect / forward to an external address outside of DMS like `@gmail.com`.
|
||||
|
||||
??? abstract "Technical Details (_Local vs Virtual aliases_)"
|
||||
|
||||
Aliases are managed through Postfix which supports _local_ and _virtual_ aliases:
|
||||
|
||||
- **Local aliases** are for mail routed to the [`local` delivery agent][postfix::delivery-agent::local] (see [associated alias config format][postfix::config-table::local-alias])
|
||||
- You rarely need to configure this. It is used internally for system unix accounts belonging to the services running in DMS (_including `root`_).
|
||||
- `postmaster` may be a local alias to `root`, and `root` to a virtual alias or real email address.
|
||||
- Any mail sent through the `local` delivery agent will not be delivered to an inbox managed by Dovecot (_unless you have configured a local alias to redirect mail to a valid address or alias_).
|
||||
- The domain-part of an these aliases belongs to your DMS FQDN (_`hostname: mail.example.com`, thus `user@mail.example.com`_). Technically there is no domain-part at this point, that context is used when routing delivery, the local delivery agent only knows of the local-part (_an alias or unix account_).
|
||||
- [**Virtual aliases**][postfix-docs::virtual-alias] are for mail routed to the [`virtual` delivery agent][postfix::delivery-agent::virtual] (see [associated alias config format][postfix::config-table::virtual-alias])
|
||||
- When alias support in DMS is discussed without the context of being a local or virtual alias, it's likely the virtual kind (_but could also be agnostic_).
|
||||
- The domain-part of an these aliases belongs to a mail domain managed by DMS (_like `user@example.com`_).
|
||||
|
||||
!!! tip "Verify alias resolves correctly"
|
||||
|
||||
You can run `postmap -q <alias> <table>` in the container to verify an alias resolves to the expected target. If the target is also an alias, the command will not expand that alias to resolve the actual recipient(s).
|
||||
|
||||
For the `FILE` provisioner, an example would be: `postmap -q alias1@example.com /etc/postfix/virtual`. For the `LDAP` provisioner you'd need to adjust the table path.
|
||||
|
||||
!!! info "Side effect - Dovecot Quotas (`ENABLE_QUOTAS=1`)"
|
||||
|
||||
As a side effect of the alias workaround for the `FILE` provisioner with this feature, aliases can be used for account login. This is not intentional.
|
||||
|
||||
### Quotas
|
||||
|
||||
!!! info
|
||||
|
||||
Enables mail clients with the capability to query a mailbox for disk-space used and capacity limit.
|
||||
|
||||
- This feature is enabled by default, opt-out via [`ENABLE_QUOTAS=0`][docs::env::enable-quotas]
|
||||
- **Not implemented** for the LDAP provisioner (_PR welcome! View the [feature request for implementation advice][gh-issue::dms-feature-request::dovecot-quotas-ldap]_)
|
||||
|
||||
??? tip "How are quotas useful?"
|
||||
|
||||
Without quota limits for disk storage, a mailbox could fill up the available storage which would cause delivery failures to all mailboxes.
|
||||
|
||||
Quotas help by preventing that abuse, so that only a mailbox exceeding the assigned quota experiences a delivery failure instead of negatively impacting others (_provided disk space is available_).
|
||||
|
||||
??? abstract "Technical Details"
|
||||
|
||||
The [Dovecot Quotas feature][gh-pr::dms-feature::dovecot-quotas] is configured by enabling the [Dovecot `imap-quota` plugin][dovecot-docs::plugin::imap-quota] and using the [`count` quota backend][dovecot-docs::config::quota-backend-count].
|
||||
|
||||
---
|
||||
|
||||
**Dovecot workaround for Postfix aliases**
|
||||
|
||||
When mail is delivered to DMS, Postfix will query Dovecot with the recipient(s) to verify quota has not been exceeded.
|
||||
|
||||
This allows early rejection of mail arriving to DMS, preventing a spammer from taking advantage of a [backscatter][wikipedia::backscatter] source if the mail was accepted by Postfix, only to later be rejected by Dovecot for storage when the quota limit was already reached.
|
||||
|
||||
However, Postfix does not resolve aliases until after the incoming mail is accepted.
|
||||
|
||||
1. Postfix queries Dovecot (_a [`check_policy_service` restriction tied to the Dovecot `quota-status` service][dms::workaround::dovecot-quotas::notes-1]_) with the recipient (_the alias_).
|
||||
2. `dovecot: auth: passwd-file(alias@example.com): unknown user` is logged, Postfix is then informed that the recipient mailbox is not full even if it actually was (_since no such user exists in the Dovecot UserDB_).
|
||||
3. However, when the real mailbox address that the alias would later resolve into does have a quota that exceeded the configured limit, Dovecot will refuse the mail delivery from Postfix which introduces a backscatter source for spammers.
|
||||
|
||||
As a [workaround to this problem with the `ENABLE_QUOTAS=1` feature][dms::workaround::dovecot-quotas::summary], DMS will add aliases as fake users into Dovecot UserDB (_that are configured with the same data as the real address the alias would resolve to, thus sharing the same mailbox location and quota limit_). This allows Postfix to properly be aware of an aliased mailbox having exceeded the allowed quota.
|
||||
|
||||
**NOTE:** This workaround **only supports** aliases to a single target recipient of a real account address / mailbox.
|
||||
|
||||
- Additionally, aliases that resolve to another alias or to an external address would both fail the UserDB lookup, unable to determine if enough storage is available.
|
||||
- A proper fix would [implement a Postfix policy service][dms::workaround::dovecot-quotas::notes-2] that could correctly resolve aliases to valid entries in the Dovecot UserDB, querying the `quota-status` service and returning that response to Postfix.
|
||||
|
||||
## Sub-addressing
|
||||
|
||||
!!! info
|
||||
|
||||
[Subaddressing][wikipedia::subaddressing] (_aka **Plus Addressing** or **Address Tags**_) is a feature that allows you to receive mail to an address which includes a tag appended to the `local-part` of a valid account address.
|
||||
|
||||
- A subaddress has a tag delimiter (_default: `+`_), followed by the tag: `<local-part>+<tag>@<domain-part>`
|
||||
- The subaddress `user+github@example.com` would deliver mail to the same mailbox as `user@example.com`.
|
||||
- Tags are dynamic. Anything between the `+` and `@` is understood as the tag, no additional configuration required.
|
||||
- Only the first occurence of the tag delimiter is recognized. Any additional occurences become part of the tag value itself.
|
||||
|
||||
??? tip "When is subaddressing useful?"
|
||||
|
||||
A common use-case is to use a unique tag for each service you register your email address with.
|
||||
|
||||
- Routing delivery to different folders in your mailbox based on the tag (_via a [Sieve filter][docs::sieve::subaddressing]_).
|
||||
- Data leaks or bulk sales of email addresses.
|
||||
- If spam / phishing mail you receive has not removed the tag, you will have better insight into where your address was compromised from.
|
||||
- When the expected tag is missing, this additionally helps identify bad actors. Especially when mail delivery is routed to subfolders by tag.
|
||||
- For more use-cases, view the end of [this article][web::subaddress-use-cases].
|
||||
|
||||
??? tip "Changing the tag delimiter"
|
||||
|
||||
Add `recipient_delimiter = +` to these config override files (_replacing `+` with your preferred delimiter_):
|
||||
|
||||
- Postfix: `docker-data/dms/config/postfix-main.cf`
|
||||
- Dovecot: `docker-data/dms/config/dovecot.cf`
|
||||
|
||||
??? tip "Opt-out of subaddressing"
|
||||
|
||||
Follow the advice to change the tag delimiter, but instead set an empty value (`recipient_delimiter =`).
|
||||
|
||||
??? warning "Only for receiving, not sending"
|
||||
|
||||
Do not attempt to send mail from these tagged addresses, they are not equivalent to aliases.
|
||||
|
||||
This feature is only intended to be used when a mail client sends to a DMS managed recipient address. While DMS does not restrict the sender address you choose to send mail from (_provided `SPOOF_PROTECTION` has not been enabled_), it is often [forbidden by mail services][ms-exchange-docs::limitations].
|
||||
|
||||
??? abstract "Technical Details"
|
||||
|
||||
The configured tag delimiter (`+`) allows both Postfix and Dovecot to recognize subaddresses. Without this feature configured, the subaddresses would be considered as separate mail accounts rather than routed to a common account address.
|
||||
|
||||
---
|
||||
|
||||
Internally DMS has the tag delimiter configured by:
|
||||
|
||||
- Applying the Postfix `main.cf` setting: [`recipient_delimiter = +`][postfix-docs::recipient-delimiter]
|
||||
- Dovecot has the equivalent setting set as `+` by default: [`recipient_delimiter = +`][dovecot-docs::config::recipient-delimiter]
|
||||
|
||||
## Technical Overview
|
||||
|
||||
!!! info
|
||||
|
||||
This section provides insight for understanding how Postfix and Dovecot services are involved. It is intended as a reference for maintainers and contributors.
|
||||
|
||||
- **Postfix** - Handles when mail is delivered (inbound) to DMS, or sent (outbound) from DMS.
|
||||
- **Dovecot** - Manages access and storage for mail delivered to the DMS account mailboxes of your users.
|
||||
|
||||
??? abstract "Technical Details - Postfix (Inbound vs Outbound)"
|
||||
|
||||
Postfix needs to know how to handle inbound and outbound mail by asking these queries:
|
||||
|
||||
=== "Inbound"
|
||||
|
||||
- What mail domains is DMS responsible for handling? (_for accepting mail delivered_)
|
||||
- What are valid mail addresses for those mail domains? (_reject delivery for users that don't exist_)
|
||||
- Are there any aliases to redirect mail to 1 or more users, or forward to externally?
|
||||
|
||||
=== "Outbound"
|
||||
|
||||
- When `SPOOF_PROTECTION=1`, how should DMS restrict the sender address? (_eg: Users may only send mail from their associated mailbox address_)
|
||||
|
||||
??? abstract "Technical Details - Dovecot (Authentication)"
|
||||
|
||||
Dovecot additionally handles authenticating user accounts for sending and retrieving mail:
|
||||
|
||||
- Over the ports for IMAP and POP3 connections (_110, 143, 993, 995_).
|
||||
- As the default configured SASL provider, which Postfix delegates user authentication through (_for the submission(s) ports 465 & 587_). Saslauthd can be configured as an alternative SASL provider.
|
||||
|
||||
Dovecot splits all authentication lookups into two categories:
|
||||
|
||||
- A [PassDB][dovecot::docs::passdb] lookup most importantly authenticates the user. It may also provide any other necessary pre-login information.
|
||||
- A [UserDB][dovecot::docs::userdb] lookup retrieves post-login information specific to a user.
|
||||
|
||||
[docs::env::account-provisioner]: ../environment.md#account_provisioner
|
||||
[docs::account-provisioner::file]: ./provisioner/file.md
|
||||
[docs::account-provisioner::ldap]: ./provisioner/ldap.md
|
||||
[docs::account-auth::oauth2]: ./supplementary/oauth2.md
|
||||
[docs::account-auth::master-accounts]: ./supplementary/master-accounts.md
|
||||
[docs::examples::auth-lua]: ../../examples/use-cases/auth-lua.md
|
||||
[email-syntax::valid-charset-format]: https://stackoverflow.com/questions/2049502/what-characters-are-allowed-in-an-email-address/2049510#2049510
|
||||
|
||||
[postfix-docs::virtual-alias]: http://www.postfix.org/VIRTUAL_README.html#virtual_alias
|
||||
[postfix-docs::recipient-delimiter]: http://www.postfix.org/postconf.5.html#recipient_delimiter
|
||||
[dovecot-docs::config::recipient-delimiter]: https://doc.dovecot.org/settings/core/#core_setting-recipient_delimiter
|
||||
[postfix::delivery-agent::local]: https://www.postfix.org/local.8.html
|
||||
[postfix::delivery-agent::virtual]: https://www.postfix.org/virtual.8.html
|
||||
[postfix::config-table::local-alias]: https://www.postfix.org/aliases.5.html
|
||||
[postfix::config-table::virtual-alias]: https://www.postfix.org/virtual.5.html
|
||||
|
||||
[docs::env::enable-quotas]: ../environment.md#enable_quotas
|
||||
[gh-issue::dms-feature-request::dovecot-quotas-ldap]: https://github.com/docker-mailserver/docker-mailserver/issues/2957
|
||||
[dovecot-docs::config::quota-backend-count]: https://doc.dovecot.org/configuration_manual/quota/quota_count/#quota-backend-count
|
||||
[dovecot-docs::plugin::imap-quota]: https://doc.dovecot.org/settings/plugin/imap-quota-plugin/
|
||||
[gh-pr::dms-feature::dovecot-quotas]: https://github.com/docker-mailserver/docker-mailserver/pull/1469
|
||||
[wikipedia::backscatter]: https://en.wikipedia.org/wiki/Backscatter_%28email%29
|
||||
[dms::workaround::dovecot-quotas::notes-1]: https://github.com/docker-mailserver/docker-mailserver/issues/2091#issuecomment-954298788
|
||||
[dms::workaround::dovecot-quotas::notes-2]: https://github.com/docker-mailserver/docker-mailserver/pull/2248#issuecomment-953754532
|
||||
[dms::workaround::dovecot-quotas::summary]: https://github.com/docker-mailserver/docker-mailserver/pull/2248#issuecomment-955088677
|
||||
|
||||
[docs::sieve::subaddressing]: ../advanced/mail-sieve.md#subaddress-mailbox-routing
|
||||
[web::subaddress-use-cases]: https://www.codetwo.com/admins-blog/plus-addressing
|
||||
[wikipedia::subaddressing]: https://en.wikipedia.org/wiki/Email_address#Sub-addressing
|
||||
[ms-exchange-docs::limitations]: https://learn.microsoft.com/en-us/exchange/recipients-in-exchange-online/plus-addressing-in-exchange-online#using-plus-addresses
|
||||
|
||||
[dovecot::docs::passdb]: https://doc.dovecot.org/configuration_manual/authentication/password_databases_passdb
|
||||
[dovecot::docs::userdb]: https://doc.dovecot.org/configuration_manual/authentication/user_databases_userdb
|
|
@ -0,0 +1,206 @@
|
|||
---
|
||||
title: 'Account Management | Provisioner (File)'
|
||||
---
|
||||
|
||||
# Provisioner - File
|
||||
|
||||
## Management via the `setup` CLI
|
||||
|
||||
The best way to manage DMS accounts and related config files is through our `setup` CLI provided within the container.
|
||||
|
||||
!!! example "Using the `setup` CLI"
|
||||
|
||||
Try the following within the DMS container (`docker exec -it <CONTAINER NAME> bash`):
|
||||
|
||||
- Add an account: `setup email add <EMAIL ADDRESS>`
|
||||
- Add an alias: `setup alias add <FROM ALIAS> <TO TARGET ADDRESS>`
|
||||
- Learn more about the available subcommands via: `setup help`
|
||||
|
||||
```bash
|
||||
# Starts a basic DMS instance and then shells into the container to use the `setup` CLI:
|
||||
docker run --rm -itd --name dms --hostname mail.example.com mailserver/docker-mailserver
|
||||
docker exec -it dms bash
|
||||
|
||||
# Create an account:
|
||||
setup email add hello@example.com your-password-here
|
||||
|
||||
# Create an alias:
|
||||
setup alias add your-alias-here@example.com hello@example.com
|
||||
|
||||
# Limit the mailbox capacity to 10 MiB:
|
||||
setup quota set hello@example.com 10M
|
||||
```
|
||||
|
||||
??? tip "Secure password input"
|
||||
|
||||
When you don't provide a password to the command, you will be prompted for one. This avoids the password being captured in your shell history.
|
||||
|
||||
```bash
|
||||
# As you input your password it will not update.
|
||||
# Press the ENTER key to apply the hidden password input.
|
||||
$ setup email add hello@example.com
|
||||
Enter Password:
|
||||
Confirm Password:
|
||||
```
|
||||
|
||||
!!! note "Account removal via `setup email del`"
|
||||
|
||||
When you remove a DMS account with this command, it will also remove any associated aliases and quota.
|
||||
|
||||
The command will also prompt for deleting the account mailbox from disk, or can be forced with the `-y` flag.
|
||||
|
||||
## Config Reference
|
||||
|
||||
These config files belong to the [Config Volume][docs::volumes::config].
|
||||
|
||||
### Accounts
|
||||
|
||||
!!! info
|
||||
|
||||
**Config file:** `docker-data/dms/config/postfix-accounts.cf`
|
||||
|
||||
---
|
||||
|
||||
The config format is line-based with two fields separated by the delimiter `|`:
|
||||
|
||||
- **User:** The primary email address for the account mailbox to use.
|
||||
- **Password:** A SHA512-CRYPT hash of the account password (_in this example it is `secret`_).
|
||||
|
||||
??? tip "Password hash without the `setup email add` command"
|
||||
|
||||
A compatible password hash can be generated with:
|
||||
|
||||
```bash
|
||||
doveadm pw -s SHA512-CRYPT -u hello@example.com -p secret
|
||||
```
|
||||
|
||||
!!! example "`postfix-accounts.cf` config file"
|
||||
|
||||
In this example DMS manages mail for the domain `example.com`:
|
||||
|
||||
```cf title="postfix-accounts.cf"
|
||||
hello@example.com|{SHA512-CRYPT}$6$W4rxRQwI6HNMt9n3$riCi5/OqUxnU8eZsOlZwoCnrNgu1gBGPkJc.ER.LhJCu7sOg9i1kBrRIistlBIp938GdBgMlYuoXYUU5A4Qiv0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Dovecot "extra fields"**
|
||||
|
||||
[Appending a third column will customize "extra fields"][gh-issue::provisioner-file::accounts-extra-fields] when converting account data into a Dovecot UserDB entry.
|
||||
|
||||
DMS is not aware of these customizations beyond carrying them over, expect potential for bugs when this feature breaks any assumed conventions used in the scripts (_such as changing the mailbox path or type_).
|
||||
|
||||
!!! note
|
||||
|
||||
Account creation will normalize the provided email address to lowercase, as DMS does not support multiple case-sensitive address variants.
|
||||
|
||||
The email address chosen will also represent the _login username_ credential for mail clients to authenticate with.
|
||||
|
||||
### Aliases
|
||||
|
||||
!!! info
|
||||
|
||||
**Config file:** `docker-data/dms/config/postfix-virtual.cf`
|
||||
|
||||
---
|
||||
|
||||
The config format is line-based with key value pairs (**alias** --> **target address**), with white-space as a delimiter.
|
||||
|
||||
!!! example "`postfix-virtual.cf` config file"
|
||||
|
||||
In this example DMS manages mail for the domain `example.com`:
|
||||
|
||||
```cf-extra title="postfix-virtual.cf"
|
||||
# Alias delivers to an existing account:
|
||||
alias1@example.com hello@example.com
|
||||
|
||||
# Alias forwards to an external email address:
|
||||
alias2@example.com external-account@gmail.com
|
||||
```
|
||||
|
||||
??? warning "Known Issues"
|
||||
|
||||
**`setup` CLI prevents an alias and account sharing an address:**
|
||||
|
||||
You cannot presently add a new account (`setup email add`) or alias (`setup alias add`) with an address which already exists as an alias or account in DMS.
|
||||
|
||||
This [restriction was enforced][gh-issue::bugs::account-alias-overlap] due to [problems it could cause][gh-issue::bugs::account-alias-overlap-problem], although there are [use-cases where you may legitimately require this functionality][gh-issue::feature-request::allow-account-alias-overlap].
|
||||
|
||||
For now you must manually edit the `postfix-virtual.cf` file as a workaround. There are no run-time checks outside of the `setup` CLI related to this restriction.
|
||||
|
||||
---
|
||||
|
||||
**Wildcard catch-all support (`@example.com`):**
|
||||
|
||||
While this type of alias without a local-part is supported, you must keep in mind that aliases in Postfix have a higher precedence than a real address associated to a DMS account.
|
||||
|
||||
As a result, the wildcard is matched first and will direct mail for that entire domain to the alias target address. To work around this, [you will need an alias for each non-alias address of that domain][gh-issue::bugs::wildcard-catchall].
|
||||
|
||||
Additionally, Postfix will read the alias config and choose the alias value that matches the recipient address first. Ensure your more specific aliases for the domain are declared above the wildcard alias in the config file.
|
||||
|
||||
---
|
||||
|
||||
**Aliasing to another alias or multiple recipients:**
|
||||
|
||||
[While aliasing to multiple recipients is possible][gh-discussions::no-support::alias-multiple-targets], DMS does not officially support that.
|
||||
|
||||
- You may experience issues when our feature integrations don't expect more than one target per alias.
|
||||
- These concerns also apply to the usage of nested aliases (_where the recipient target provided is to an alias instead of a real address_). An example is the [incompatibility with `setup alias add`][gh-issue::bugs::alias-nested].
|
||||
|
||||
#### Configuring RegEx aliases
|
||||
|
||||
!!! info
|
||||
|
||||
**Config file:** `docker-data/dms/config/postfix-regexp.cf`
|
||||
|
||||
---
|
||||
|
||||
This config file is similar to the above `postfix-virtual.cf`, but the alias value is instead configured with a regex pattern.
|
||||
|
||||
There is **no `setup` CLI support** for this feature, it is config only.
|
||||
|
||||
!!! example "`postfix-regexp.cf` config file"
|
||||
|
||||
Deliver all mail for `test` users to `qa@example.com` instead:
|
||||
|
||||
```cf-extra title="postfix-regexp.cf"
|
||||
# Remember to escape regex tokens like `.` => `\.`, otherwise
|
||||
# your alias pattern may be more permissive than you intended:
|
||||
/^test[0-9][0-9]*@example\.com/ qa@example.com
|
||||
```
|
||||
|
||||
??? abstract "Technical Details"
|
||||
|
||||
`postfix-virtual.cf` has precedence, `postfix-regexp.cf` will only be checked if no alias match was found in `postfix-virtual.cf`.
|
||||
|
||||
These files are both copied internally to `/etc/postfix/` and configured in `main.cf` for the `virtual_alias_maps` setting. As `postfix-virtual.cf` is declared first for that setting, it will be processed before using `postfix-regexp.cf` as a fallback.
|
||||
|
||||
### Quotas
|
||||
|
||||
!!! info
|
||||
|
||||
**Config file:** `docker-data/dms/config/dovecot-quotas.cf`
|
||||
|
||||
----
|
||||
|
||||
The config format is line-based with two fields separated by the delimiter `:`:
|
||||
|
||||
- **Dovecot UserDB account:** The user DMS account. It should have a matching field in `postfix-accounts.cf`.
|
||||
- **Quota limit:** Expressed in bytes (_binary unit suffix is supported: `M` => `MiB`, `G` => `GiB`_).
|
||||
|
||||
!!! example "`dovecot-quotas.cf` config file"
|
||||
|
||||
For the account with the mailbox address of `hello@example.com`, it may not exceed 5 GiB in storage:
|
||||
|
||||
```cf-extra title="dovecot-quotas.cf"
|
||||
hello@example.com:5G
|
||||
```
|
||||
|
||||
[docs::volumes::config]: ../../advanced/optional-config.md#volumes-config
|
||||
[gh-issue::provisioner-file::accounts-extra-fields]: https://github.com/docker-mailserver/docker-mailserver/issues/4117
|
||||
[gh-issue::feature-request::allow-account-alias-overlap]: https://github.com/docker-mailserver/docker-mailserver/issues/3528
|
||||
[gh-issue::bugs::account-alias-overlap-problem]: https://github.com/docker-mailserver/docker-mailserver/issues/3350#issuecomment-1550528898
|
||||
[gh-issue::bugs::account-alias-overlap]: https://github.com/docker-mailserver/docker-mailserver/issues/3022#issuecomment-1807816689
|
||||
[gh-issue::bugs::wildcard-catchall]: https://github.com/docker-mailserver/docker-mailserver/issues/3022#issuecomment-1610452561
|
||||
[gh-issue::bugs::alias-nested]: https://github.com/docker-mailserver/docker-mailserver/issues/3622#issuecomment-1794504849
|
||||
[gh-discussions::no-support::alias-multiple-targets]: https://github.com/orgs/docker-mailserver/discussions/3805#discussioncomment-8215417
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
title: 'Advanced | LDAP Authentication'
|
||||
title: 'Account Management | Provisioner (LDAP)'
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
Getting started with ldap and `docker-mailserver` we need to take 3 parts in account:
|
||||
Getting started with ldap and DMS we need to take 3 parts in account:
|
||||
|
||||
- `postfix` for incoming & outgoing email
|
||||
- `dovecot` for accessing mailboxes
|
||||
|
@ -26,7 +26,7 @@ Those variables contain the LDAP lookup filters for postfix, using `%s` as the p
|
|||
- Technically, there is no difference between `ALIAS` and `GROUP`, but ideally you should use `ALIAS` for personal aliases for a singular person (like `ceo@example.org`) and `GROUP` for multiple people (like `hr@example.org`).
|
||||
- ...for outgoing email, the sender address is put through the `SENDERS` filter, and only if the authenticated user is one of the returned entries, the email can be sent.
|
||||
- This only applies if `SPOOF_PROTECTION=1`.
|
||||
- If the `SENDERS` filter is missing, the `USER`, `ALIAS` and `GROUP` filters will be used in in a disjunction (OR).
|
||||
- If the `SENDERS` filter is missing, the `USER`, `ALIAS` and `GROUP` filters will be used in a disjunction (OR).
|
||||
- To for example allow users from the `admin` group to spoof any sender email address, and to force everyone else to only use their personal mailbox address for outgoing email, you can use something like this: `(|(memberOf=cn=admin,*)(mail=%s))`
|
||||
|
||||
???+ example
|
||||
|
@ -34,7 +34,6 @@ Those variables contain the LDAP lookup filters for postfix, using `%s` as the p
|
|||
A really simple `LDAP_QUERY_FILTER` configuration, using only the _user filter_ and allowing only `admin@*` to spoof any sender addresses.
|
||||
|
||||
```yaml
|
||||
- ENABLE_LDAP=1 # with the :edge tag, use ACCOUNT_PROVISIONER
|
||||
- LDAP_START_TLS=yes
|
||||
- ACCOUNT_PROVISIONER=LDAP
|
||||
- LDAP_SERVER_HOST=ldap.example.org
|
||||
|
@ -57,7 +56,7 @@ These variables specify the LDAP filters that dovecot uses to determine if a use
|
|||
This is split into the following two lookups, both using `%u` as the placeholder for the full login name ([see dovecot documentation for a full list of placeholders](https://doc.dovecot.org/configuration_manual/config_file/config_variables/)). Usually you only need to set `DOVECOT_USER_FILTER`, in which case it will be used for both filters.
|
||||
|
||||
- `DOVECOT_USER_FILTER` is used to get the account details (uid, gid, home directory, quota, ...) of a user.
|
||||
- `DOVECOT_PASS_FILTER` is used to get the password information of the user, and is in pretty much all cases identical to `DOVECOT_USER_FILTER` (which is the default behaviour if left away).
|
||||
- `DOVECOT_PASS_FILTER` is used to get the password information of the user, and is in pretty much all cases identical to `DOVECOT_USER_FILTER` (which is the default behavior if left away).
|
||||
|
||||
If your directory doesn't have the [postfix-book schema](https://github.com/variablenix/ldap-mail-schema/blob/master/postfix-book.schema) installed, then you must change the internal attribute handling for dovecot. For this you have to change the `pass_attr` and the `user_attr` mapping, as shown in the example below:
|
||||
|
||||
|
@ -215,7 +214,6 @@ The changes on the configurations necessary to work with Active Directory (**onl
|
|||
- ENABLE_POSTGREY=1
|
||||
|
||||
# >>> Postfix LDAP Integration
|
||||
- ENABLE_LDAP=1 # with the :edge tag, use ACCOUNT_PROVISIONER
|
||||
- ACCOUNT_PROVISIONER=LDAP
|
||||
- LDAP_SERVER_HOST=ldap.example.org
|
||||
- LDAP_BIND_DN=cn=admin,ou=users,dc=example,dc=org
|
||||
|
@ -284,7 +282,6 @@ The changes on the configurations necessary to work with Active Directory (**onl
|
|||
# <<< SASL Authentication
|
||||
|
||||
# >>> Postfix Ldap Integration
|
||||
- ENABLE_LDAP=1 # with the :edge tag, use ACCOUNT_PROVISIONER
|
||||
- ACCOUNT_PROVISIONER=LDAP
|
||||
- LDAP_SERVER_HOST=<yourLdapContainer/yourLdapServer>
|
||||
- LDAP_SEARCH_BASE=dc=mydomain,dc=loc
|
||||
|
@ -307,5 +304,5 @@ The changes on the configurations necessary to work with Active Directory (**onl
|
|||
- NET_ADMIN
|
||||
```
|
||||
|
||||
[docs-environment]: ../environment.md
|
||||
[docs-userpatches]: ./override-defaults/user-patches.md
|
||||
[docs-environment]: ../../environment.md
|
||||
[docs-userpatches]: ../../advanced/override-defaults/user-patches.md
|
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
title: 'Account Management | Master Accounts (Dovecot)'
|
||||
hide:
|
||||
- toc # Hide Table of Contents for this page
|
||||
---
|
||||
|
||||
This feature is useful for administrative tasks like hot backups.
|
||||
|
||||
!!! note
|
||||
|
||||
This feature is presently [not supported with `ACCOUNT_PROVISIONER=LDAP`][dms::feature::dovecot-master-accounts::caveat-ldap].
|
||||
|
||||
!!! info
|
||||
|
||||
A _Master Account_:
|
||||
|
||||
- Can login as any user (DMS account) and access their mailbox.
|
||||
- Is not associated to a separate DMS account, nor is it a DMS account itself.
|
||||
|
||||
---
|
||||
|
||||
**`setup` CLI support**
|
||||
|
||||
Use the `setup dovecot-master <add|update|del|list>` commands. These are roughly equivalent to the `setup email` subcommands.
|
||||
|
||||
---
|
||||
|
||||
**Config file:** `docker-data/dms/config/dovecot-masters.cf`
|
||||
|
||||
The config format is the same as [`postfix-accounts.cf` for `ACCOUNT_PROVISIONER=FILE`][docs::account-management::file::accounts].
|
||||
|
||||
The only difference is the account field has no `@domain-part` suffix, it is only a username.
|
||||
|
||||
??? abstract "Technical Details"
|
||||
|
||||
[The _Master Accounts_ feature][dms::feature::dovecot-master-accounts] in DMS configures the [Dovecot Master Users][dovecot-docs::auth::master-users] feature with the Dovecot setting [`auth_master_user_separator`][dovecot-docs::config::auth-master-user-separator] (_where the default value is `*`_).
|
||||
|
||||
## Login via Master Account
|
||||
|
||||
!!! info
|
||||
|
||||
To login as another DMS account (`user@example.com`) with POP3 or IMAP, use the following credentials format:
|
||||
|
||||
- Username: `<LOGIN USERNAME>*<MASTER USER>` (`user@example.com*admin`)
|
||||
- Password: `<MASTER PASSWORD>`
|
||||
|
||||
!!! example "Verify login functionality"
|
||||
|
||||
In the DMS container, you can verify with the `testsaslauthd` command:
|
||||
|
||||
```bash
|
||||
# Prerequisites:
|
||||
# A regular DMS account to test login through a Master Account:
|
||||
setup email add user@example.com secret
|
||||
# Add a new Master Account:
|
||||
setup dovecot-master add admin top-secret
|
||||
```
|
||||
|
||||
```bash
|
||||
# Login with credentials format as described earlier:
|
||||
testsaslauthd -u 'user@example.com*admin' -p 'top-secret'
|
||||
```
|
||||
|
||||
Alternatively, any mail client should be able to login the equivalent credentials.
|
||||
|
||||
[dms::feature::dovecot-master-accounts]: https://github.com/docker-mailserver/docker-mailserver/pull/2535
|
||||
[dms::feature::dovecot-master-accounts::caveat-ldap]: https://github.com/docker-mailserver/docker-mailserver/pull/2535#issuecomment-1118056745
|
||||
[dovecot-docs::auth::master-users]: https://doc.dovecot.org/configuration_manual/authentication/master_users/
|
||||
[dovecot-docs::config::auth-master-user-separator]: https://doc.dovecot.org/settings/core/#core_setting-auth_master_user_separator
|
||||
[docs::account-management::file::accounts]: ../provisioner/file.md#accounts
|
|
@ -0,0 +1,145 @@
|
|||
---
|
||||
title: 'Account Management | OAuth2 Support'
|
||||
hide:
|
||||
- toc # Hide Table of Contents for this page
|
||||
---
|
||||
|
||||
# Authentication - OAuth2 / OIDC
|
||||
|
||||
This feature enables support for delegating DMS account authentication through to an external _Identity Provider_ (IdP).
|
||||
|
||||
!!! warning "Receiving mail requires a DMS account to exist"
|
||||
|
||||
If you expect DMS to receive mail, you must provision an account into DMS in advance. Otherwise DMS has no awareness of your externally manmaged users and will reject delivery.
|
||||
|
||||
There are [plans to implement support to provision users through a SCIM 2.0 API][dms-feature-request::scim-api]. An IdP that can operate as a SCIM Client (eg: Authentik) would then integrate with DMS for user provisioning. Until then you must keep your user accounts in sync manually via your configured [`ACCOUNT_PROVISIONER`][docs::env::account-provisioner].
|
||||
|
||||
??? info "How the feature works"
|
||||
|
||||
1. A **mail client must have support** to acquire an OAuth2 token from your IdP (_however many clients lack generic OAuth2 / OIDC provider support_).
|
||||
2. The mail client then provides that token as the user password via the login mechanism `XOAUTH2` or `OAUTHBEARER`.
|
||||
3. DMS (Dovecot) will then check the validity of that token against the Authentication Service it was configured with.
|
||||
4. If the response returned is valid for the user account, authentication is successful.
|
||||
|
||||
[**XOAUTH2**][google::xoauth2-docs] (_Googles widely adopted implementation_) and **OAUTHBEARER** (_the newer variant standardized by [RFC 7628][rfc::7628] in 2015_) are supported as standards for verifying that a OAuth Bearer Token (_[RFC 6750][rfc::6750] from 2012_) is valid at the identity provider that created the token. The token itself in both cases is expected to be can an opaque _Access Token_, but it is possible to use a JWT _ID Token_ (_which encodes additional information into the token itself_).
|
||||
|
||||
A mail client like Thunderbird has limited OAuth2 / OIDC support. The software maintains a hard-coded list of providers supported. Roundcube is a webmail client that does have support for generic providers, allowing you to integrate with a broader range of IdP services.
|
||||
|
||||
---
|
||||
|
||||
**Documentation for this feature is WIP**
|
||||
|
||||
See the [initial feature support][dms-feature::oauth2-pr] and [existing issues][dms-feature::oidc-issues] for guidance that has not yet been documented officially.
|
||||
|
||||
??? tip "Verify authentication works"
|
||||
|
||||
If you have a compatible mail client you can verify login through that.
|
||||
|
||||
---
|
||||
|
||||
??? example "CLI - Verify with `curl`"
|
||||
|
||||
```bash
|
||||
# Shell into your DMS container:
|
||||
docker exec -it dms bash
|
||||
|
||||
# Adjust these variables for the methods below to use:
|
||||
export AUTH_METHOD='OAUTHBEARER' USER_ACCOUNT='hello@example.com' ACCESS_TOKEN='DMS_YWNjZXNzX3Rva2Vu'
|
||||
|
||||
# Authenticate via IMAP (Dovecot):
|
||||
curl --silent --url 'imap://localhost:143' \
|
||||
--login-options "AUTH=${AUTH_METHOD}" --user "${USER_ACCOUNT}" --oauth2-bearer "${ACCESS_TOKEN}" \
|
||||
--request 'LOGOUT' \
|
||||
&& grep "dovecot: imap-login: Login: user=<${USER_ACCOUNT}>, method=${AUTH_METHOD}" /var/log/mail/mail.log
|
||||
|
||||
# Authenticate via SMTP (Postfix), sending a mail with the same sender(from) and recipient(to) address:
|
||||
# NOTE: `curl` seems to require `--upload-file` with some mail content provided to test SMTP auth.
|
||||
curl --silent --url 'smtp://localhost:587' \
|
||||
--login-options "AUTH=${AUTH_METHOD}" --user "${USER_ACCOUNT}" --oauth2-bearer "${ACCESS_TOKEN}" \
|
||||
--mail-from "${USER_ACCOUNT}" --mail-rcpt "${USER_ACCOUNT}" --upload-file - <<< 'RFC 5322 content - not important' \
|
||||
&& grep "postfix/submission/smtpd.*, sasl_method=${AUTH_METHOD}, sasl_username=${USER_ACCOUNT}" /var/log/mail/mail.log
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Troubleshooting:**
|
||||
|
||||
- Add `--verbose` to the curl options. This will output the protocol exchange which includes if authentication was successful or failed.
|
||||
- The above example chains the `curl` commands with `grep` on DMS logs (_for Dovecot and Postfix services_). When not running `curl` from the DMS container, ensure you check the logs correctly, or inspect the `--verbose` output instead.
|
||||
|
||||
!!! warning "`curl` bug with `XOAUTH2`"
|
||||
|
||||
[Older releases of `curl` have a bug with `XOAUTH2` support][gh-issue::curl::xoauth2-bug] since `7.80.0` (Nov 2021) but fixed from `8.6.0` (Jan 2024). It treats `XOAUTH2` as `OAUTHBEARER`.
|
||||
|
||||
If you use `docker exec` to run `curl` from within DMS, the current DMS v14 release (_Debian 12 with curl `7.88.1`_) is affected by this bug.
|
||||
|
||||
## Config Examples
|
||||
|
||||
### Authentik with Roundcube
|
||||
|
||||
This example assumes you have already set up:
|
||||
|
||||
- A working DMS server
|
||||
- An Authentik server ([documentation][authentik::docs::install])
|
||||
- A Roundcube server ([docker image][roundcube::dockerhub-image] or [bare metal install][roundcube::docs::install])
|
||||
|
||||
!!! example "Setup Instructions"
|
||||
|
||||
=== "1. Docker Mailserver"
|
||||
|
||||
Update your Docker Compose ENV config to include:
|
||||
|
||||
```env title="compose.yaml"
|
||||
services:
|
||||
mailserver:
|
||||
env:
|
||||
# Enable the feature:
|
||||
- ENABLE_OAUTH2=1
|
||||
# Specify the user info endpoint URL of the oauth2 server for token inspection:
|
||||
- OAUTH2_INTROSPECTION_URL=https://authentik.example.com/application/o/userinfo/
|
||||
```
|
||||
|
||||
=== "2. Authentik"
|
||||
|
||||
1. Create a new OAuth2 provider.
|
||||
2. Note the client id and client secret. Roundcube will need this.
|
||||
3. Set the allowed redirect url to the equivalent of `https://roundcube.example.com/index.php/login/oauth` for your RoundCube instance.
|
||||
|
||||
=== "3. Roundcube"
|
||||
|
||||
Add the following to `oauth2.inc.php` ([documentation][roundcube::docs::config]):
|
||||
|
||||
```php
|
||||
$config['oauth_provider'] = 'generic';
|
||||
$config['oauth_provider_name'] = 'Authentik';
|
||||
$config['oauth_client_id'] = '<insert client id here>';
|
||||
$config['oauth_client_secret'] = '<insert client secret here>';
|
||||
$config['oauth_auth_uri'] = 'https://authentik.example.com/application/o/authorize/';
|
||||
$config['oauth_token_uri'] = 'https://authentik.example.com/application/o/token/';
|
||||
$config['oauth_identity_uri'] = 'https://authentik.example.com/application/o/userinfo/';
|
||||
|
||||
// Optional: disable SSL certificate check on HTTP requests to OAuth server. For possible values, see:
|
||||
// http://docs.guzzlephp.org/en/stable/request-options.html#verify
|
||||
$config['oauth_verify_peer'] = false;
|
||||
|
||||
$config['oauth_scope'] = 'email openid profile';
|
||||
$config['oauth_identity_fields'] = ['email'];
|
||||
|
||||
// Boolean: automatically redirect to OAuth login when opening Roundcube without a valid session
|
||||
$config['oauth_login_redirect'] = false;
|
||||
```
|
||||
|
||||
[dms-feature::oauth2-pr]: https://github.com/docker-mailserver/docker-mailserver/pull/3480
|
||||
[dms-feature::oidc-issues]: https://github.com/docker-mailserver/docker-mailserver/issues?q=label%3Afeature%2Fauth-oidc
|
||||
[docs::env::account-provisioner]: ../../environment.md#account_provisioner
|
||||
[dms-feature-request::scim-api]: https://github.com/docker-mailserver/docker-mailserver/issues/4090
|
||||
|
||||
[google::xoauth2-docs]: https://developers.google.com/gmail/imap/xoauth2-protocol#the_sasl_xoauth2_mechanism
|
||||
[rfc::6750]: https://datatracker.ietf.org/doc/html/rfc6750
|
||||
[rfc::7628]: https://datatracker.ietf.org/doc/html/rfc7628
|
||||
[gh-issue::curl::xoauth2-bug]: https://github.com/curl/curl/issues/10259#issuecomment-1907192556
|
||||
|
||||
[authentik::docs::install]: https://goauthentik.io/docs/installation/
|
||||
[roundcube::dockerhub-image]: https://hub.docker.com/r/roundcube/roundcubemail
|
||||
[roundcube::docs::install]: https://github.com/roundcube/roundcubemail/wiki/Installation
|
||||
[roundcube::docs::config]: https://github.com/roundcube/roundcubemail/wiki/Configuration
|
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
title: 'Advanced | Dovecot master accounts'
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
A dovecot master account is able to login as any configured user. This is useful for administrative tasks like hot backups.
|
||||
|
||||
## Configuration
|
||||
|
||||
It is possible to create, update, delete and list dovecot master accounts using `setup.sh`. See `setup.sh help` for usage.
|
||||
|
||||
This feature is presently [not supported with LDAP](https://github.com/docker-mailserver/docker-mailserver/pull/2535).
|
||||
|
||||
## Logging in
|
||||
|
||||
Once a master account is configured, it is possible to connect to any users mailbox using this account. Log in over POP3/IMAP using the following credential scheme:
|
||||
|
||||
Username: `<EMAIL ADDRESS>*<MASTER ACCOUNT NAME>`
|
||||
|
||||
Password: `<MASTER ACCOUNT PASSWORD>`
|
|
@ -6,7 +6,7 @@ title: 'Advanced | Full-Text Search'
|
|||
|
||||
Full-text search allows all messages to be indexed, so that mail clients can quickly and efficiently search messages by their full text content. Dovecot supports a variety of community supported [FTS indexing backends](https://doc.dovecot.org/configuration_manual/fts/).
|
||||
|
||||
`docker-mailserver` comes pre-installed with two plugins that can be enabled with a dovecot config file.
|
||||
DMS comes pre-installed with two plugins that can be enabled with a dovecot config file.
|
||||
|
||||
Please be aware that indexing consumes memory and takes up additional disk space.
|
||||
|
||||
|
@ -16,7 +16,7 @@ The [dovecot-fts-xapian](https://github.com/grosjo/fts-xapian) plugin makes use
|
|||
|
||||
The indexes will be stored as a subfolder named `xapian-indexes` inside your local `mail-data` folder (_`/var/mail` internally_). With the default settings, 10GB of email data may generate around 4GB of indexed data.
|
||||
|
||||
While indexing is memory intensive, you can configure the plugin to limit the amount of memory consumed by the index workers. With Xapian being small and fast, this plugin is a good choice for low memory environments (2GB) as compared to Solr.
|
||||
While indexing is memory intensive, you can configure the plugin to limit the amount of memory consumed by the index workers. With Xapian being small and fast, this plugin is a good choice for low memory environments (2GB).
|
||||
|
||||
#### Setup
|
||||
|
||||
|
@ -55,7 +55,7 @@ While indexing is memory intensive, you can configure the plugin to limit the am
|
|||
|
||||
adjust the settings to tune for your desired memory limits, exclude folders and enable searching text inside of attachments
|
||||
|
||||
2. Update `docker-compose.yml` to load the previously created dovecot plugin config file:
|
||||
2. Update `compose.yaml` to load the previously created dovecot plugin config file:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
@ -86,29 +86,29 @@ While indexing is memory intensive, you can configure the plugin to limit the am
|
|||
3. Recreate containers:
|
||||
|
||||
```
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
docker compose down
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
4. Initialize indexing on all users for all mail:
|
||||
|
||||
```
|
||||
docker-compose exec mailserver doveadm index -A -q \*
|
||||
docker compose exec mailserver doveadm index -A -q \*
|
||||
```
|
||||
|
||||
5. Run the following command in a daily cron job:
|
||||
|
||||
```
|
||||
docker-compose exec mailserver doveadm fts optimize -A
|
||||
docker compose exec mailserver doveadm fts optimize -A
|
||||
```
|
||||
Or like the [Spamassassin example][docs-faq-sa-learn-cron] shows, you can instead use `cron` from within `docker-mailserver` to avoid potential errors if the mail-server is not running:
|
||||
Or like the [Spamassassin example][docs-faq-sa-learn-cron] shows, you can instead use `cron` from within DMS to avoid potential errors if the mail server is not running:
|
||||
|
||||
??? example
|
||||
|
||||
Create a _system_ cron file:
|
||||
|
||||
```sh
|
||||
# in the docker-compose.yml root directory
|
||||
# in the compose.yaml root directory
|
||||
mkdir -p ./docker-data/dms/cron # if you didn't have this folder before
|
||||
touch ./docker-data/dms/cron/fts_xapian
|
||||
chown root:root ./docker-data/dms/cron/fts_xapian
|
||||
|
@ -127,7 +127,7 @@ While indexing is memory intensive, you can configure the plugin to limit the am
|
|||
0 4 * * * root doveadm fts optimize -A
|
||||
```
|
||||
|
||||
Then with `docker-compose.yml`:
|
||||
Then with `compose.yaml`:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
@ -137,53 +137,6 @@ While indexing is memory intensive, you can configure the plugin to limit the am
|
|||
- ./docker-data/dms/cron/fts_xapian:/etc/cron.d/fts_xapian
|
||||
```
|
||||
|
||||
|
||||
### Solr
|
||||
|
||||
The [dovecot-solr Plugin](https://wiki2.dovecot.org/Plugins/FTS/Solr) is used in conjunction with [Apache Solr](https://lucene.apache.org/solr/) running in a separate container. This is quite straightforward to setup using the following instructions.
|
||||
|
||||
Solr is a mature and fast indexing backend that runs on the JVM. The indexes are relatively compact compared to the size of your total email.
|
||||
|
||||
However, Solr also requires a fair bit of RAM. While Solr is [highly tuneable](https://solr.apache.org/guide/7_0/query-settings-in-solrconfig.html), it may require a bit of testing to get it right.
|
||||
|
||||
#### Setup
|
||||
|
||||
1. `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
solr:
|
||||
image: lmmdock/dovecot-solr:latest
|
||||
volumes:
|
||||
- ./docker-data/dms/config/dovecot/solr-dovecot:/opt/solr/server/solr/dovecot
|
||||
restart: always
|
||||
|
||||
mailserver:
|
||||
depends_on:
|
||||
- solr
|
||||
image: ghcr.io/docker-mailserver/docker-mailserver:latest
|
||||
...
|
||||
volumes:
|
||||
...
|
||||
- ./docker-data/dms/config/dovecot/10-plugin.conf:/etc/dovecot/conf.d/10-plugin.conf:ro
|
||||
...
|
||||
```
|
||||
|
||||
2. `./docker-data/dms/config/dovecot/10-plugin.conf`:
|
||||
|
||||
```conf
|
||||
mail_plugins = $mail_plugins fts fts_solr
|
||||
|
||||
plugin {
|
||||
fts = solr
|
||||
fts_autoindex = yes
|
||||
fts_solr = url=http://solr:8983/solr/dovecot/
|
||||
}
|
||||
```
|
||||
|
||||
3. Recreate containers: `docker-compose down ; docker-compose up -d`
|
||||
|
||||
4. Flag all user mailbox FTS indexes as invalid, so they are rescanned on demand when they are next searched: `docker-compose exec mailserver doveadm fts rescan -A`
|
||||
|
||||
#### Further Discussion
|
||||
|
||||
See [#905](https://github.com/docker-mailserver/docker-mailserver/issues/905)
|
||||
|
|
|
@ -2,43 +2,216 @@
|
|||
title: 'Advanced | IPv6'
|
||||
---
|
||||
|
||||
## Background
|
||||
!!! bug "Ample Opportunities for Issues"
|
||||
|
||||
If your container host supports IPv6, then `docker-mailserver` will automatically accept IPv6 connections by way of the docker host's IPv6. However, incoming mail will fail SPF checks because they will appear to come from the IPv4 gateway that docker is using to proxy the IPv6 connection (`172.20.0.1` is the gateway).
|
||||
Numerous bug reports have been raised in the past about IPv6. Please make sure your setup around DMS is correct when using IPv6!
|
||||
|
||||
This can be solved by supporting IPv6 connections all the way to the `docker-mailserver` container.
|
||||
## IPv6 networking problems with Docker defaults
|
||||
|
||||
## Setup steps
|
||||
### What can go wrong?
|
||||
|
||||
```diff
|
||||
+++ b/serv/docker-compose.yml
|
||||
@@ ... @@ services:
|
||||
If your host system supports IPv6 and an `AAAA` DNS record exists to direct IPv6 traffic to DMS, you may experience issues when an IPv6 connection is made:
|
||||
|
||||
+ ipv6nat:
|
||||
+ image: robbertkl/ipv6nat
|
||||
+ restart: always
|
||||
+ network_mode: "host"
|
||||
+ cap_add:
|
||||
+ - NET_ADMIN
|
||||
+ - SYS_MODULE
|
||||
+ volumes:
|
||||
+ - /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
+ - /lib/modules:/lib/modules:ro
|
||||
- The original client IP is replaced with the gateway IP of a docker network.
|
||||
- Connections fail or hang.
|
||||
|
||||
@@ ... @@ networks:
|
||||
The impact of losing the real IP of the client connection can negatively affect DMS:
|
||||
|
||||
+ default:
|
||||
+ driver: bridge
|
||||
+ enable_ipv6: true
|
||||
+ ipam:
|
||||
+ driver: default
|
||||
+ config:
|
||||
+ - subnet: fd00:0123:4567::/48
|
||||
+ gateway: fd00:0123:4567::1
|
||||
- Users unable to login (_Fail2Ban action triggered by repeated login failures all seen as from the same internal Gateway IP_)
|
||||
- Mail inbound to DMS is rejected (_[SPF verification failure][gh-issue-1438-spf], IP mismatch_)
|
||||
- Delivery failures from [sender reputation][sender-score] being reduced (_due to [bouncing inbound mail][gh-issue-3057-bounce] from rejected IPv6 clients_)
|
||||
- Some services may be configured to trust connecting clients within the containers subnet, which includes the Gateway IP. This can risk bypassing or relaxing security measures, such as exposing an [open relay][wikipedia-openrelay].
|
||||
|
||||
### Why does this happen?
|
||||
|
||||
When the host network receives a connection to a containers published port, it is routed to the containers internal network managed by Docker (_typically a bridge network_).
|
||||
|
||||
By default, the Docker daemon only assigns IPv4 addresses to containers, thus it will only accept IPv4 connections (_unless a `docker-proxy` process is listening, which the default daemon setting `userland-proxy: true` enables_). With the daemon setting `userland-proxy: true` (default), IPv6 connections from the host can also be accepted and routed to containers (_even when they only have IPv4 addresses assigned_). `userland-proxy: false` will require the container to have atleast an IPv6 address assigned.
|
||||
|
||||
This can be problematic for IPv6 host connections when internally the container is no longer aware of the original client IPv6 address, as it has been proxied through the IPv4 or IPv6 gateway address of it's connected network (_eg: `172.17.0.1` - Docker allocates networks from a set of [default subnets][docker-subnets]_).
|
||||
|
||||
This can be fixed by enabling a Docker network to assign IPv6 addresses to containers, along with some additional configuration. Alternatively you could configure the opposite to prevent IPv6 connections being made.
|
||||
|
||||
## Prevent IPv6 connections
|
||||
|
||||
- Avoiding an `AAAA` DNS record for your DMS FQDN would prevent resolving an IPv6 address to connect to.
|
||||
- You can also use `userland-proxy: false`, which will fail to establish a remote connection to DMS (_provided no IPv6 address was assigned_).
|
||||
|
||||
!!! tip "With UFW or Firewalld"
|
||||
|
||||
When one of these firewall frontends are active, remote clients should fail to connect instead of being masqueraded as the docker network gateway IP. Keep in mind that this only affects remote clients, it does not affect local IPv6 connections originating within the same host.
|
||||
|
||||
## Enable proper IPv6 support
|
||||
|
||||
You can enable IPv6 support in Docker for container networks, however [compatibility concerns][docs-compat] may affect your success.
|
||||
|
||||
The [official Docker documentation on enabling IPv6][docker-docs-enable-ipv6] has been improving and is a good resource to reference.
|
||||
|
||||
Enable `ip6tables` support so that Docker will manage IPv6 networking rules as well. This will allow for IPv6 NAT to work like the existing IPv4 NAT already does for your containers, avoiding the above issue with external connections having their IP address seen as the container network gateway IP (_provided an IPv6 address is also assigned to the container_).
|
||||
|
||||
!!! example "Configure the following in `/etc/docker/daemon.json`"
|
||||
|
||||
```json
|
||||
{
|
||||
"ip6tables": true,
|
||||
"experimental" : true,
|
||||
"userland-proxy": true
|
||||
}
|
||||
```
|
||||
|
||||
- `experimental: true` is currently required for `ip6tables: true` to work.
|
||||
- `userland-proxy` setting [can potentially affect connection behavior][gh-pull-3244-proxy] for local connections.
|
||||
|
||||
Now restart the daemon if it's running: `systemctl restart docker`.
|
||||
|
||||
Next, configure a network with an IPv6 subnet for your container with any of these examples:
|
||||
|
||||
???+ example "Create an IPv6 ULA subnet"
|
||||
|
||||
??? info "About these examples"
|
||||
|
||||
These examples are focused on a [IPv6 ULA subnet][wikipedia-ipv6-ula] which is suitable for most users as described in the next section.
|
||||
|
||||
- You may prefer a subnet size smaller than `/64` (eg: `/112`, which still provides over 65k IPv6 addresses), especially if instead configuring for an IPv6 GUA subnet.
|
||||
- The network will also implicitly be assigned an IPv4 subnet (_from the Docker daemon config `default-address-pools`_).
|
||||
|
||||
=== "User-defined Network"
|
||||
|
||||
The preferred approach is with [user-defined networks][docker-docs-ipv6-create-custom] via `compose.yaml` (recommended) or CLI with `docker network create`:
|
||||
|
||||
=== "Compose"
|
||||
|
||||
Create the network in `compose.yaml` and attach a service to it:
|
||||
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
mailserver:
|
||||
networks:
|
||||
- dms-ipv6
|
||||
|
||||
networks:
|
||||
dms-ipv6:
|
||||
enable_ipv6: true
|
||||
ipam:
|
||||
config:
|
||||
- subnet: fd00:cafe:face:feed::/64
|
||||
```
|
||||
|
||||
??? tip "Override the implicit `default` network"
|
||||
|
||||
You can optionally avoid the service assignment by [overriding the `default` user-defined network that Docker Compose generates][docker-docs-network-compose-default]. Just replace `dms-ipv6` with `default`.
|
||||
|
||||
The Docker Compose `default` bridge is not affected by settings for the default `bridge` (aka `docker0`) in `/etc/docker/daemon.json`.
|
||||
|
||||
??? tip "Using the network outside of this `compose.yaml`"
|
||||
|
||||
To reference this network externally (_from other compose files or `docker run`_), assign the [networks `name` key in `compose.yaml`][docker-docs-network-external].
|
||||
|
||||
=== "CLI"
|
||||
|
||||
Create the network via a CLI command (_which can then be used with `docker run --network dms-ipv6`_):
|
||||
|
||||
```bash
|
||||
docker network create --ipv6 --subnet fd00:cafe:face:feed::/64 dms-ipv6
|
||||
```
|
||||
|
||||
Optionally reference it from one or more `compose.yaml` files:
|
||||
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
mailserver:
|
||||
networks:
|
||||
- dms-ipv6
|
||||
|
||||
networks:
|
||||
dms-ipv6:
|
||||
external: true
|
||||
```
|
||||
|
||||
=== "Default Bridge (daemon)"
|
||||
|
||||
!!! warning "This approach is discouraged"
|
||||
|
||||
The [`bridge` network is considered legacy][docker-docs-network-bridge-legacy].
|
||||
|
||||
Add these two extra IPv6 settings to your daemon config. They only apply to the [default `bridge` docker network][docker-docs-ipv6-create-default] aka `docker0` (_which containers are attached to by default when using `docker run`_).
|
||||
|
||||
```json title="/etc/docker/daemon.json"
|
||||
{
|
||||
"ipv6": true,
|
||||
"fixed-cidr-v6": "fd00:cafe:face:feed::/64",
|
||||
}
|
||||
```
|
||||
|
||||
Compose projects can also use this network via `network_mode`:
|
||||
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
mailserver:
|
||||
network_mode: bridge
|
||||
```
|
||||
|
||||
!!! danger "Do not use `2001:db8:1::/64` for your private subnet"
|
||||
|
||||
The `2001:db8` address prefix is [reserved for documentation][wikipedia-ipv6-reserved]. Avoid creating a subnet with this prefix.
|
||||
|
||||
Presently this is used in examples for Dockers IPv6 docs as a placeholder, while mixed in with private IPv4 addresses which can be misleading.
|
||||
|
||||
### Configuring an IPv6 subnet
|
||||
|
||||
If you've [configured IPv6 address pools in `/etc/docker/daemon.json`][docker-docs-ipv6-supernets], you do not need to specify a subnet explicitly. Otherwise if you're unsure what value to provide, here's a quick guide (_Tip: Prefer IPv6 ULA, it's the least hassle_):
|
||||
|
||||
- `fd00:cafe:face:feed::/64` is an example of a [IPv6 ULA subnet][wikipedia-ipv6-ula]. ULA addresses are akin to the [private IPv4 subnets][wikipedia-ipv4-private] you may already be familiar with. You can use that example, or choose your own ULA address. This is a good choice for getting Docker containers to their have networks support IPv6 via NAT like they already do by default with IPv4.
|
||||
- IPv6 without NAT, using public address space like your server is assigned belongs to an [IPv6 GUA subnet][wikipedia-ipv6-gua].
|
||||
- Typically these will be a `/64` block assigned to your host, but this varies by provider.
|
||||
- These addresses do not need to publish ports of a container to another IP to be publicly reached (_thus `ip6tables: true` is not required_), you will want a firewall configured to manage which ports are accessible instead as no NAT is involved. Note that this may not be desired if the container should also be reachable via the host IPv4 public address.
|
||||
- You may want to subdivide the `/64` into smaller subnets for Docker to use only portions of the `/64`. This can reduce some routing features, and [require additional setup / management via a NDP Proxy][gh-pull-3244-gua] for your public interface to know of IPv6 assignments managed by Docker and accept external traffic.
|
||||
|
||||
### Verify remote IP is correct
|
||||
|
||||
With Docker CLI or Docker Compose, run a `traefik/whoami` container with your IPv6 docker network and port 80 published. You can then send a curl request (or via address in the browser) from another host (as your remote client) with an IPv6 network, the `RemoteAddr` value returned should match your client IPv6 address.
|
||||
|
||||
```bash
|
||||
docker run --rm -d --network dms-ipv6 -p 80:80 traefik/whoami
|
||||
# On a different host, replace `2001:db8::1` with your DMS host IPv6 address
|
||||
curl --max-time 5 http://[2001:db8::1]:80
|
||||
```
|
||||
|
||||
## Further Discussion
|
||||
!!! warning "IPv6 gateway IP"
|
||||
|
||||
See [#1438][github-issue-1438]
|
||||
If instead of the remote IPv6 address, you may notice the gateway IP for the IPv6 subnet your DMS container belongs to.
|
||||
|
||||
[github-issue-1438]: https://github.com/docker-mailserver/docker-mailserver/issues/1438
|
||||
This will happen when DMS has an IPv6 IP address assigned, for the same reason as with IPv4, `userland-proxy: true`. It indicates that your `daemon.json` has not been configured correctly or had the updated config applied for `ip6tables :true` + `experimental: true`. Make sure you used `systemctl restart docker` after updating `daemon.json`.
|
||||
|
||||
!!! info "IPv6 ULA address priority"
|
||||
|
||||
DNS lookups that have records for both IPv4 and IPv6 addresses (_eg: `localhost`_) may prefer IPv4 over IPv6 (ULA) for private addresses, whereas for public addresses IPv6 has priority. This shouldn't be anything to worry about, but can come across as a surprise when testing your IPv6 setup on the same host instead of from a remote client.
|
||||
|
||||
The preference can be controlled with [`/etc/gai.conf`][networking-gai], and appears was configured this way based on [the assumption that IPv6 ULA would never be used with NAT][networking-gai-blog]. It should only affect the destination resolved for outgoing connections, which for IPv6 ULA should only really affect connections between your containers / host. In future [IPv6 ULA may also be prioritized][networking-gai-rfc].
|
||||
|
||||
[docker-subnets]: https://straz.to/2021-09-08-docker-address-pools/#what-are-the-default-address-pools-when-no-configuration-is-given-vanilla-pools
|
||||
[sender-score]: https://senderscore.org/assess/get-your-score/
|
||||
[gh-issue-1438-spf]: https://github.com/docker-mailserver/docker-mailserver/issues/1438
|
||||
[gh-issue-3057-bounce]: https://github.com/docker-mailserver/docker-mailserver/pull/3057#issuecomment-1416700046
|
||||
[wikipedia-openrelay]: https://en.wikipedia.org/wiki/Open_mail_relay
|
||||
|
||||
[docs-compat]: ../debugging.md#compatibility
|
||||
|
||||
[gh-pull-3244-proxy]: https://github.com/docker-mailserver/docker-mailserver/pull/3244#issuecomment-1603436809
|
||||
[docker-docs-enable-ipv6]: https://docs.docker.com/config/daemon/ipv6/
|
||||
[docker-docs-ipv6-create-custom]: https://docs.docker.com/config/daemon/ipv6/#create-an-ipv6-network
|
||||
[docker-docs-ipv6-create-default]: https://docs.docker.com/config/daemon/ipv6/#use-ipv6-for-the-default-bridge-network
|
||||
[docker-docs-ipv6-supernets]: https://docs.docker.com/config/daemon/ipv6/#dynamic-ipv6-subnet-allocation
|
||||
[docker-docs-network-external]: https://docs.docker.com/compose/compose-file/06-networks/#name
|
||||
[docker-docs-network-compose-default]: https://docs.docker.com/compose/networking/#configure-the-default-network
|
||||
[docker-docs-network-bridge-legacy]: https://docs.docker.com/network/drivers/bridge/#use-the-default-bridge-network
|
||||
|
||||
[wikipedia-ipv6-reserved]: https://en.wikipedia.org/wiki/IPv6_address#Documentation
|
||||
[wikipedia-ipv4-private]: https://en.wikipedia.org/wiki/Private_network#Private_IPv4_addresses
|
||||
[wikipedia-ipv6-ula]: https://en.wikipedia.org/wiki/Unique_local_address
|
||||
[wikipedia-ipv6-gua]: https://en.wikipedia.org/wiki/IPv6#Global_addressing
|
||||
[gh-pull-3244-gua]: https://github.com/docker-mailserver/docker-mailserver/pull/3244#issuecomment-1528984894
|
||||
|
||||
[networking-gai]: https://linux.die.net/man/5/gai.conf
|
||||
[networking-gai-blog]: https://thomas-leister.de/en/lxd-prefer-ipv6-outgoing/
|
||||
[networking-gai-rfc]:https://datatracker.ietf.org/doc/html/draft-ietf-v6ops-ula
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
title: 'Advanced | Email Gathering with Fetchmail'
|
||||
---
|
||||
|
||||
To enable the [fetchmail][fetchmail-website] service to retrieve e-mails set the environment variable `ENABLE_FETCHMAIL` to `1`. Your `docker-compose.yml` file should look like following snippet:
|
||||
To enable the [fetchmail][fetchmail-website] service to retrieve e-mails, set the environment variable `ENABLE_FETCHMAIL` to `1`. Your `compose.yaml` file should look like following snippet:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
|
@ -10,7 +10,7 @@ environment:
|
|||
- FETCHMAIL_POLL=300
|
||||
```
|
||||
|
||||
Generate a file called `fetchmail.cf` and place it in the `docker-data/dms/config/` folder. Your `docker-mailserver` folder should look like this example:
|
||||
Generate a file called `fetchmail.cf` and place it in the `docker-data/dms/config/` folder. Your DMS folder should look like this example:
|
||||
|
||||
```txt
|
||||
├── docker-data/dms/config
|
||||
|
@ -18,108 +18,135 @@ Generate a file called `fetchmail.cf` and place it in the `docker-data/dms/confi
|
|||
│ ├── fetchmail.cf
|
||||
│ ├── postfix-accounts.cf
|
||||
│ └── postfix-virtual.cf
|
||||
├── docker-compose.yml
|
||||
└── README.md
|
||||
└── compose.yaml
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
A detailed description of the configuration options can be found in the [online version of the manual page][fetchmail-docs].
|
||||
Configuration options for `fetchmail.cf` are covered at the [official fetchmail docs][fetchmail-docs-config] (_see the section "The run control file" and the table with "keyword" column for all settings_).
|
||||
|
||||
### IMAP Configuration
|
||||
!!! example "Basic `fetchmail.cf` configuration"
|
||||
|
||||
!!! example
|
||||
Retrieve mail from `remote-user@somewhere.com` and deliver it to `dms-user@example.com`:
|
||||
|
||||
```fetchmailrc
|
||||
poll 'imap.gmail.com' proto imap
|
||||
user 'username'
|
||||
pass 'secret'
|
||||
is 'user1@example.com'
|
||||
ssl
|
||||
poll 'mail.somewhere.com'
|
||||
proto imap
|
||||
user 'remote-user'
|
||||
pass 'secret'
|
||||
is 'dms-user@example.com'
|
||||
```
|
||||
|
||||
### POP3 Configuration
|
||||
- `poll` sets the remote mail server to connect to retrieve mail from.
|
||||
- `proto` lets you connect via IMAP or POP3.
|
||||
- `user` and `pass` provide the login credentials for the remote mail service account to access.
|
||||
- `is` configures where the fetched mail will be sent to (_eg: your local DMS account in `docker-data/dms/config/postfix-accounts.cf`_).
|
||||
|
||||
!!! example
|
||||
---
|
||||
|
||||
```fetchmailrc
|
||||
poll 'pop3.gmail.com' proto pop3
|
||||
user 'username'
|
||||
pass 'secret'
|
||||
is 'user2@example.com'
|
||||
ssl
|
||||
??? warning "`proto imap` will still delete remote mail once fetched"
|
||||
|
||||
This is due to a separate default setting `no keep`. Adding the setting `keep` to your config on a new line will prevent deleting the remote copy.
|
||||
|
||||
??? example "Multiple users or remote servers"
|
||||
|
||||
The official docs [config examples][fetchmail-config-examples] show a common convention to indent settings on subsequent lines for visually grouping per server.
|
||||
|
||||
=== "Minimal syntax"
|
||||
|
||||
```fetchmailrc
|
||||
poll 'mail.somewhere.com' proto imap
|
||||
user 'john.doe' pass 'secret' is 'johnny@example.com'
|
||||
user 'jane.doe' pass 'secret' is 'jane@example.com'
|
||||
|
||||
poll 'mail.somewhere-else.com' proto pop3
|
||||
user 'john.doe@somewhere-else.com' pass 'secret' is 'johnny@example.com'
|
||||
```
|
||||
|
||||
=== "With optional syntax"
|
||||
|
||||
- `#` for adding comments.
|
||||
- The config file may include "noise" keywords to improve readability.
|
||||
|
||||
```fetchmailrc
|
||||
# Retrieve mail for users `john.doe` and `jane.doe` via IMAP at this remote mail server:
|
||||
poll 'mail.somewhere.com' with proto imap wants:
|
||||
user 'john.doe' with pass 'secret', is 'johnny@example.com' here
|
||||
user 'jane.doe' with pass 'secret', is 'jane@example.com' here
|
||||
|
||||
# Also retrieve mail from this mail server (but via POP3).
|
||||
# NOTE: This could also be all on a single line, or with each key + value as a separate line.
|
||||
# Notice how the remote username includes a full email address,
|
||||
# Some mail servers like DMS use the full email address as the username:
|
||||
poll 'mail.somewhere-else.com' with proto pop3 wants:
|
||||
user 'john.doe@somewhere-else.com' with pass 'secret', is 'johnny@example.com' here
|
||||
```
|
||||
|
||||
!!! tip "`FETCHMAIL_POLL` ENV: Override default polling interval"
|
||||
|
||||
By default the fetchmail service will check every 5 minutes for new mail at the configured mail accounts.
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
# The fetchmail polling interval in seconds:
|
||||
FETCHMAIL_POLL: 60
|
||||
```
|
||||
|
||||
!!! caution
|
||||
|
||||
Don’t forget the last line! (_eg: `is 'user1@example.com'`_). After `is`, you have to specify an email address from the configuration file: `docker-data/dms/config/postfix-accounts.cf`.
|
||||
|
||||
More details how to configure fetchmail can be found in the [fetchmail man page in the chapter “The run control file”][fetchmail-docs-run].
|
||||
|
||||
### Polling Interval
|
||||
|
||||
By default the fetchmail service searches every 5 minutes for new mails on your external mail accounts. You can override this default value by changing the ENV variable `FETCHMAIL_POLL`:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
- FETCHMAIL_POLL=60
|
||||
```
|
||||
|
||||
You must specify a numeric argument which is a polling interval in seconds. The example above polls every minute for new mails.
|
||||
|
||||
## Debugging
|
||||
|
||||
To debug your `fetchmail.cf` configuration run this command:
|
||||
To debug your `fetchmail.cf` configuration run this `setup debug` command:
|
||||
|
||||
```sh
|
||||
./setup.sh debug fetchmail
|
||||
docker exec -it dms-container-name setup debug fetchmail
|
||||
```
|
||||
|
||||
For more informations about the configuration script `setup.sh` [read the corresponding docs][docs-setup].
|
||||
??? example "Sample output of `setup debug fetchmail`"
|
||||
|
||||
Here a sample output of `./setup.sh debug fetchmail`:
|
||||
```log
|
||||
fetchmail: 6.3.26 querying outlook.office365.com (protocol POP3) at Mon Aug 29 22:11:09 2016: poll started
|
||||
Trying to connect to 132.245.48.18/995...connected.
|
||||
fetchmail: Server certificate:
|
||||
fetchmail: Issuer Organization: Microsoft Corporation
|
||||
fetchmail: Issuer CommonName: Microsoft IT SSL SHA2
|
||||
fetchmail: Subject CommonName: outlook.com
|
||||
fetchmail: Subject Alternative Name: outlook.com
|
||||
fetchmail: Subject Alternative Name: *.outlook.com
|
||||
fetchmail: Subject Alternative Name: office365.com
|
||||
fetchmail: Subject Alternative Name: *.office365.com
|
||||
fetchmail: Subject Alternative Name: *.live.com
|
||||
fetchmail: Subject Alternative Name: *.internal.outlook.com
|
||||
fetchmail: Subject Alternative Name: *.outlook.office365.com
|
||||
fetchmail: Subject Alternative Name: outlook.office.com
|
||||
fetchmail: Subject Alternative Name: attachment.outlook.office.net
|
||||
fetchmail: Subject Alternative Name: attachment.outlook.officeppe.net
|
||||
fetchmail: Subject Alternative Name: *.office.com
|
||||
fetchmail: outlook.office365.com key fingerprint: 3A:A4:58:42:56:CD:BD:11:19:5B:CF:1E:85:16:8E:4D
|
||||
fetchmail: POP3< +OK The Microsoft Exchange POP3 service is ready. [SABFADEAUABSADAAMQBDAEEAMAAwADAANwAuAGUAdQByAHAAcgBkADAAMQAuAHAAcgBvAGQALgBlAHgAYwBoAGEAbgBnAGUAbABhAGIAcwAuAGMAbwBtAA==]
|
||||
fetchmail: POP3> CAPA
|
||||
fetchmail: POP3< +OK
|
||||
fetchmail: POP3< TOP
|
||||
fetchmail: POP3< UIDL
|
||||
fetchmail: POP3< SASL PLAIN
|
||||
fetchmail: POP3< USER
|
||||
fetchmail: POP3< .
|
||||
fetchmail: POP3> USER user1@outlook.com
|
||||
fetchmail: POP3< +OK
|
||||
fetchmail: POP3> PASS *
|
||||
fetchmail: POP3< +OK User successfully logged on.
|
||||
fetchmail: POP3> STAT
|
||||
fetchmail: POP3< +OK 0 0
|
||||
fetchmail: No mail for user1@outlook.com at outlook.office365.com
|
||||
fetchmail: POP3> QUIT
|
||||
fetchmail: POP3< +OK Microsoft Exchange Server 2016 POP3 server signing off.
|
||||
fetchmail: 6.3.26 querying outlook.office365.com (protocol POP3) at Mon Aug 29 22:11:11 2016: poll completed
|
||||
fetchmail: normal termination, status 1
|
||||
```
|
||||
|
||||
```log
|
||||
fetchmail: 6.3.26 querying outlook.office365.com (protocol POP3) at Mon Aug 29 22:11:09 2016: poll started
|
||||
Trying to connect to 132.245.48.18/995...connected.
|
||||
fetchmail: Server certificate:
|
||||
fetchmail: Issuer Organization: Microsoft Corporation
|
||||
fetchmail: Issuer CommonName: Microsoft IT SSL SHA2
|
||||
fetchmail: Subject CommonName: outlook.com
|
||||
fetchmail: Subject Alternative Name: outlook.com
|
||||
fetchmail: Subject Alternative Name: *.outlook.com
|
||||
fetchmail: Subject Alternative Name: office365.com
|
||||
fetchmail: Subject Alternative Name: *.office365.com
|
||||
fetchmail: Subject Alternative Name: *.live.com
|
||||
fetchmail: Subject Alternative Name: *.internal.outlook.com
|
||||
fetchmail: Subject Alternative Name: *.outlook.office365.com
|
||||
fetchmail: Subject Alternative Name: outlook.office.com
|
||||
fetchmail: Subject Alternative Name: attachment.outlook.office.net
|
||||
fetchmail: Subject Alternative Name: attachment.outlook.officeppe.net
|
||||
fetchmail: Subject Alternative Name: *.office.com
|
||||
fetchmail: outlook.office365.com key fingerprint: 3A:A4:58:42:56:CD:BD:11:19:5B:CF:1E:85:16:8E:4D
|
||||
fetchmail: POP3< +OK The Microsoft Exchange POP3 service is ready. [SABFADEAUABSADAAMQBDAEEAMAAwADAANwAuAGUAdQByAHAAcgBkADAAMQAuAHAAcgBvAGQALgBlAHgAYwBoAGEAbgBnAGUAbABhAGIAcwAuAGMAbwBtAA==]
|
||||
fetchmail: POP3> CAPA
|
||||
fetchmail: POP3< +OK
|
||||
fetchmail: POP3< TOP
|
||||
fetchmail: POP3< UIDL
|
||||
fetchmail: POP3< SASL PLAIN
|
||||
fetchmail: POP3< USER
|
||||
fetchmail: POP3< .
|
||||
fetchmail: POP3> USER user1@outlook.com
|
||||
fetchmail: POP3< +OK
|
||||
fetchmail: POP3> PASS *
|
||||
fetchmail: POP3< +OK User successfully logged on.
|
||||
fetchmail: POP3> STAT
|
||||
fetchmail: POP3< +OK 0 0
|
||||
fetchmail: No mail for user1@outlook.com at outlook.office365.com
|
||||
fetchmail: POP3> QUIT
|
||||
fetchmail: POP3< +OK Microsoft Exchange Server 2016 POP3 server signing off.
|
||||
fetchmail: 6.3.26 querying outlook.office365.com (protocol POP3) at Mon Aug 29 22:11:11 2016: poll completed
|
||||
fetchmail: normal termination, status 1
|
||||
```
|
||||
!!! tip "Troubleshoot with this reference `compose.yaml`"
|
||||
|
||||
[A minimal `compose.yaml` example][fetchmail-compose-example] demonstrates how to run two instances of DMS locally, with one instance configured with `fetchmail.cf` and the other to simulate a remote mail server to fetch from.
|
||||
|
||||
[docs-setup]: ../../config/setup.sh.md
|
||||
[fetchmail-website]: https://www.fetchmail.info
|
||||
[fetchmail-docs]: https://www.fetchmail.info/fetchmail-man.html
|
||||
[fetchmail-docs-run]: https://www.fetchmail.info/fetchmail-man.html#31
|
||||
[fetchmail-docs-config]: https://www.fetchmail.info/fetchmail-man.html#the-run-control-file
|
||||
[fetchmail-config-examples]: https://www.fetchmail.info/fetchmail-man.html#configuration-examples
|
||||
[fetchmail-compose-example]: https://github.com/orgs/docker-mailserver/discussions/3994#discussioncomment-9290570
|
||||
|
|
|
@ -2,29 +2,46 @@
|
|||
title: 'Mail Forwarding | AWS SES'
|
||||
---
|
||||
|
||||
[Amazon SES (Simple Email Service)](https://aws.amazon.com/ses/) is intended to provide a simple way for cloud based applications to send email and receive email. For the purposes of this project only sending email via SES is supported. Older versions of docker-mailserver used `AWS_SES_HOST` and `AWS_SES_USERPASS` to configure sending, this has changed and the setup is mananged through [Configure Relay Hosts][docs-relay].
|
||||
[Amazon SES (Simple Email Service)][aws-ses] provides a simple way for cloud based applications to send and receive email.
|
||||
|
||||
You will need to create some [Amazon SES SMTP credentials](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html). The SMTP credentials you create will be used to populate the `RELAY_USER` and `RELAY_PASSWORD` environment variables.
|
||||
!!! example "Configuration via ENV"
|
||||
|
||||
The `RELAY_HOST` should match your [AWS SES region](https://docs.aws.amazon.com/general/latest/gr/ses.html), the `RELAY_PORT` will be 587.
|
||||
[Configure a relay host in DMS][docs::relay] to forward all your mail through AWS SES:
|
||||
|
||||
If all of your email is being forwarded through AWS SES, `DEFAULT_RELAY_HOST` should be set accordingly.
|
||||
- `RELAY_HOST` should match your [AWS SES region][aws-ses::region].
|
||||
- `RELAY_PORT` should be set to [one of the supported AWS SES SMTP ports][aws-ses::smtp-ports] (_eg: 587 for STARTTLS_).
|
||||
- `RELAY_USER` and `RELAY_PASSWORD` should be set to your [Amazon SES SMTP credentials][aws-ses::credentials].
|
||||
|
||||
Example:
|
||||
```
|
||||
DEFAULT_RELAY_HOST=[email-smtp.us-west-2.amazonaws.com]:587
|
||||
```
|
||||
```env
|
||||
RELAY_HOST=email-smtp.us-west-2.amazonaws.com
|
||||
RELAY_PORT=587
|
||||
# Alternative to RELAY_HOST + RELAY_PORT which is compatible with LDAP:
|
||||
DEFAULT_RELAY_HOST=[email-smtp.us-west-2.amazonaws.com]:587
|
||||
|
||||
!!! note
|
||||
If you set up [AWS Easy DKIM](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-authentication-dkim-easy.html) you can safely skip setting up DKIM as the AWS SES will take care of signing your outgoing email.
|
||||
RELAY_USER=aws-user
|
||||
RELAY_PASSWORD=secret
|
||||
```
|
||||
|
||||
To verify proper operation, send an email to some external account of yours and inspect the mail headers. You will also see the connection to SES in the mail logs. For example:
|
||||
!!! tip
|
||||
|
||||
```log
|
||||
May 23 07:09:36 mail postfix/smtp[692]: Trusted TLS connection established to email-smtp.us-east-1.amazonaws.com[107.20.142.169]:25:
|
||||
TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
|
||||
May 23 07:09:36 mail postfix/smtp[692]: 8C82A7E7: to=<someone@example.com>, relay=email-smtp.us-east-1.amazonaws.com[107.20.142.169]:25,
|
||||
delay=0.35, delays=0/0.02/0.13/0.2, dsn=2.0.0, status=sent (250 Ok 01000154dc729264-93fdd7ea-f039-43d6-91ed-653e8547867c-000000)
|
||||
```
|
||||
If you have set up [AWS Easy DKIM][aws-ses::easy-dkim], you can safely skip setting up DKIM as AWS SES will take care of signing your outbound mail.
|
||||
|
||||
[docs-relay]: ./relay-hosts.md
|
||||
!!! note "Verify the relay host is configured correctly"
|
||||
|
||||
To verify proper operation, send an email to some external account of yours and inspect the mail headers.
|
||||
|
||||
You will also see the connection to SES in the mail logs:
|
||||
|
||||
```log
|
||||
postfix/smtp[692]: Trusted TLS connection established to email-smtp.us-west-1.amazonaws.com[107.20.142.169]:25:
|
||||
TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
|
||||
postfix/smtp[692]: 8C82A7E7: to=<someone@example.com>, relay=email-smtp.us-west-1.amazonaws.com[107.20.142.169]:25,
|
||||
delay=0.35, delays=0/0.02/0.13/0.2, dsn=2.0.0, status=sent (250 Ok 01000154dc729264-93fdd7ea-f039-43d6-91ed-653e8547867c-000000)
|
||||
```
|
||||
|
||||
[docs::relay]: ./relay-hosts.md
|
||||
[aws-ses]: https://aws.amazon.com/ses/
|
||||
[aws-ses::credentials]: https://docs.aws.amazon.com/ses/latest/dg/smtp-credentials.html
|
||||
[aws-ses::smtp-ports]: https://docs.aws.amazon.com/ses/latest/dg/smtp-connect.html
|
||||
[aws-ses::region]: https://docs.aws.amazon.com/general/latest/gr/ses.html
|
||||
[aws-ses::easy-dkim]: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-authentication-dkim-easy.html
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
title: 'Mail Forwarding | Configure Gmail as a relay host'
|
||||
---
|
||||
|
||||
This page provides a guide for configuring DMS to use [GMAIL as an SMTP relay host][gmail-smtp].
|
||||
|
||||
!!! example "Configuration via ENV"
|
||||
|
||||
[Configure a relay host in DMS][docs::relay]. This example shows how the related ENV settings map to the Gmail service config:
|
||||
|
||||
- `RELAY_HOST` should be configured as [advised by Gmail][gmail-smtp::relay-host], there are two SMTP endpoints to choose:
|
||||
- `smtp.gmail.com` (_for a personal Gmail account_)
|
||||
- `smtp-relay.gmail.com` (_when using Google Workspace_)
|
||||
- `RELAY_PORT` should be set to [one of the supported Gmail SMTP ports][gmail-smtp::relay-port] (_eg: 587 for STARTTLS_).
|
||||
- `RELAY_USER` should be your gmail address (`user@gmail.com`).
|
||||
- `RELAY_PASSWORD` should be your [App Password][gmail-smtp::app-password], **not** your personal gmail account password.
|
||||
|
||||
```env
|
||||
RELAY_HOST=smtp.gmail.com
|
||||
RELAY_PORT=587
|
||||
# Alternative to RELAY_HOST + RELAY_PORT which is compatible with LDAP:
|
||||
DEFAULT_RELAY_HOST=[smtp.gmail.com]:587
|
||||
|
||||
RELAY_USER=username@gmail.com
|
||||
RELAY_PASSWORD=secret
|
||||
```
|
||||
|
||||
!!! tip
|
||||
|
||||
- As per our main [relay host docs page][docs::relay], you may prefer to configure your credentials via `setup relay add-auth` instead of the `RELAY_USER` + `RELAY_PASSWORD` ENV.
|
||||
- If you configure for `smtp-relay.gmail.com`, the `DEFAULT_RELAY_HOST` ENV should be all you need as shown in the above example. Credentials can be optional when using Google Workspace (`smtp-relay.gmail.com`), which supports restricting connections to trusted IP addresses.
|
||||
|
||||
!!! note "Verify the relay host is configured correctly"
|
||||
|
||||
To verify proper operation, send an email to an external account of yours and inspect the mail headers.
|
||||
|
||||
You will also see the connection to the Gmail relay host (`smtp.gmail.com`) in the mail logs:
|
||||
|
||||
```log
|
||||
postfix/smtp[910]: Trusted TLS connection established to smtp.gmail.com[64.233.188.109]:587:
|
||||
TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
|
||||
postfix/smtp[910]: 4BCB547D9D: to=<username@gmail.com>, relay=smtp.gmail.com[64.233.188.109]:587,
|
||||
delay=2.9, delays=0.01/0.02/1.7/1.2, dsn=2.0.0, status=sent (250 2.0.0 OK 17... - gsmtp)
|
||||
```
|
||||
|
||||
[docs::relay]: ./relay-hosts.md
|
||||
[gmail-smtp]: https://support.google.com/a/answer/2956491
|
||||
[gmail-smtp::relay-host]: https://support.google.com/a/answer/176600
|
||||
[gmail-smtp::relay-port]: https://support.google.com/a/answer/2956491
|
||||
[gmail-smtp::app-password]: https://support.google.com/accounts/answer/185833
|
|
@ -2,82 +2,155 @@
|
|||
title: 'Mail Forwarding | Relay Hosts'
|
||||
---
|
||||
|
||||
## Introduction
|
||||
## What is a Relay Host?
|
||||
|
||||
Rather than having Postfix deliver mail directly, you can configure Postfix to send mail via another mail relay (smarthost). Examples include [Mailgun](https://www.mailgun.com/), [Sendgrid](https://sendgrid.com/) and [AWS SES](https://aws.amazon.com/ses/).
|
||||
An SMTP relay service (_aka relay host / [smarthost][wikipedia::smarthost]_) is an MTA that relays (_forwards_) mail on behalf of third-parties (_it does not manage the mail domains_).
|
||||
|
||||
Depending on the domain of the sender, you may want to send via a different relay, or authenticate in a different way.
|
||||
- Instead of DMS handling SMTP delivery directly itself (_via Postfix_), it can be configured to delegate delivery by sending all outbound mail through a relay service.
|
||||
- Examples of popular mail relay services: [AWS SES][smarthost::aws-ses], [Mailgun][smarthost::mailgun], [Mailjet][smarthost::mailjet], [SendGrid][smarthost::sendgrid]
|
||||
|
||||
## Basic Configuration
|
||||
!!! info "When can a relay service can be helpful?"
|
||||
|
||||
Basic configuration is done via environment variables:
|
||||
- Your network provider has blocked outbound connections on port 25 (_required for direct delivery_).
|
||||
- To improve delivery success via better established reputation (trust) of a relay service.
|
||||
|
||||
- `RELAY_HOST`: _default host to relay mail through, `empty` (aka '', or no ENV set) will disable this feature_
|
||||
- `RELAY_PORT`: _port on default relay, defaults to port 25_
|
||||
- `RELAY_USER`: _username for the default relay_
|
||||
- `RELAY_PASSWORD`: _password for the default user_
|
||||
## Configuration
|
||||
|
||||
Setting these environment variables will cause mail for all sender domains to be routed via the specified host, authenticating with the user/password combination.
|
||||
All mail sent outbound from DMS (_where the sender address is a DMS account or a virtual alias_) will be relayed through the configured relay host.
|
||||
|
||||
!!! warning
|
||||
For users of the previous `AWS_SES_*` variables: please update your configuration to use these new variables, no other configuration is required.
|
||||
!!! info "Configuration via ENV"
|
||||
|
||||
## Advanced Configuration
|
||||
Configure the default relayhost with either of these ENV:
|
||||
|
||||
### Sender-dependent Authentication
|
||||
- Preferable (_LDAP compatible_): `DEFAULT_RELAY_HOST` (eg: `[mail.relay-service.com]:25`)
|
||||
- `RELAY_HOST` (eg: `mail.relay-service.com`) + `RELAY_PORT` (default: 25)
|
||||
|
||||
Sender dependent authentication is done in `docker-data/dms/config/postfix-sasl-password.cf`. You can create this file manually, or use:
|
||||
Most relay services also require authentication configured:
|
||||
|
||||
```sh
|
||||
setup.sh relay add-auth <domain> <username> [<password>]
|
||||
```
|
||||
- `RELAY_USER` + `RELAY_PASSWORD` provides credentials for authenticating with the default relayhost.
|
||||
|
||||
An example configuration file looks like this:
|
||||
!!! warning "Providing secrets via ENV"
|
||||
|
||||
```txt
|
||||
@domain1.com relay_user_1:password_1
|
||||
@domain2.com relay_user_2:password_2
|
||||
```
|
||||
While ENV is convenient, the risk of exposing secrets is higher.
|
||||
|
||||
If there is no other configuration, this will cause Postfix to deliver email through the relay specified in `RELAY_HOST` env variable, authenticating as `relay_user_1` when sent from `domain1.com` and authenticating as `relay_user_2` when sending from `domain2.com`.
|
||||
`setup relay add-auth` is a better alternative, which manages the credentials via a config file.
|
||||
|
||||
!!! note
|
||||
To activate the configuration you must either restart the container, or you can also trigger an update by modifying a mail account.
|
||||
??? tip "Excluding specific sender domains from relay"
|
||||
|
||||
### Sender-dependent Relay Host
|
||||
You can opt-out with: `setup relay exclude-domain <domain>`
|
||||
|
||||
Sender dependent relay hosts are configured in `docker-data/dms/config/postfix-relaymap.cf`. You can create this file manually, or use:
|
||||
Outbound mail from senders of that domain will be sent normally (_instead of through the configured `RELAY_HOST`_).
|
||||
|
||||
```sh
|
||||
setup.sh relay add-domain <domain> <host> [<port>]
|
||||
```
|
||||
!!! warning "When any relay host credentials are configured"
|
||||
|
||||
An example configuration file looks like this:
|
||||
It will still be expected that mail is sent over a secure connection with credentials provided.
|
||||
|
||||
```txt
|
||||
@domain1.com [relay1.org]:587
|
||||
@domain2.com [relay2.org]:2525
|
||||
```
|
||||
Thus this opt-out feature is rarely practical.
|
||||
|
||||
Combined with the previous configuration in `docker-data/dms/config/postfix-sasl-password.cf`, this will cause Postfix to deliver mail sent from `domain1.com` via `relay1.org:587`, authenticating as `relay_user_1`, and mail sent from `domain2.com` via `relay2.org:2525` authenticating as `relay_user_2`.
|
||||
### Advanced Configuration
|
||||
|
||||
!!! note
|
||||
You still have to define `RELAY_HOST` to activate the feature
|
||||
When mail is sent, there is support to change the relay service or the credentials configured based on the sender address domain used.
|
||||
|
||||
### Excluding Sender Domains
|
||||
We provide this support via two config files:
|
||||
|
||||
If you want mail sent from some domains to be delivered directly, you can exclude them from being delivered via the default relay by adding them to `docker-data/dms/config/postfix-relaymap.cf` with no destination. You can also do this via:
|
||||
- Sender-dependent Relay Host: `docker-data/dms/config/postfix-relaymap.cf`
|
||||
- Sender-dependent Authentication: `docker-data/dms/config/postfix-sasl-password.cf`
|
||||
|
||||
```sh
|
||||
setup.sh relay exclude-domain <domain>
|
||||
```
|
||||
!!! tip "Configure with our `setup relay` commands"
|
||||
|
||||
Extending the configuration file from above:
|
||||
While you can edit those configs directly, DMS provides these helpful config management commands:
|
||||
|
||||
```txt
|
||||
@domain1.com [relay1.org]:587
|
||||
@domain2.com [relay2.org]:2525
|
||||
@domain3.com
|
||||
```
|
||||
```cli-syntax
|
||||
# Configure a sender domain to use a specific relay host:
|
||||
setup relay add-domain <domain> <host> [<port>]
|
||||
|
||||
This will cause email sent from `domain3.com` to be delivered directly.
|
||||
# Configure relay host credentials for a sender domain to use:
|
||||
setup relay add-auth <domain> <username> [<password>]
|
||||
|
||||
# Optionally avoid relaying from senders of this domain:
|
||||
# NOTE: Only supported when configured with the `RELAY_HOST` ENV!
|
||||
setup relay exclude-domain <domain>
|
||||
```
|
||||
|
||||
!!! example "Config file: `postfix-sasl-password.cf`"
|
||||
|
||||
```cf-extra title="docker-data/dms/config/postfix-sasl-password.cf"
|
||||
@domain1.com mailgun-user:secret
|
||||
@domain2.com sendgrid-user:secret
|
||||
|
||||
# NOTE: This must have an exact match with the relay host in `postfix-relaymap.cf`,
|
||||
# `/etc/postfix/relayhost_map`, or the `DEFAULT_RELAY_HOST` ENV.
|
||||
# NOTE: Not supported via our setup CLI, but valid config for Postfix.
|
||||
[email-smtp.us-west-2.amazonaws.com]:2587 aws-user:secret
|
||||
```
|
||||
|
||||
When Postfix needs to lookup credentials for mail sent outbound, the above config will:
|
||||
|
||||
- Authenticate as `mailgun-user` for mail sent with a sender belonging to `@domain1.com`
|
||||
- Authenticate as `sendgrid-user` for mail sent with a sender belonging to `@domain2.com`
|
||||
- Authenticate as `aws-user` for mail sent through a configured AWS SES relay host (any sender domain).
|
||||
|
||||
!!! example "Config file: `postfix-relaymap.cf`"
|
||||
|
||||
```cf-extra title="docker-data/dms/config/postfix-relaymap.cf"
|
||||
@domain1.com [smtp.mailgun.org]:587
|
||||
@domain2.com [smtp.sendgrid.net]:2525
|
||||
|
||||
# Opt-out of relaying:
|
||||
@domain3.com
|
||||
```
|
||||
|
||||
When Postfix sends mail outbound from these sender domains, the above config will:
|
||||
|
||||
- Relay mail through `[smtp.mailgun.org]:587` when mail is sent from a sender of `@domain1.com`
|
||||
- Relay mail through `[smtp.sendgrid.net]:2525` when mail is sent from a sender of `@domain1.com`
|
||||
- Mail with a sender from `@domain3.com` is not sent through a relay (_**Only applicable** when using `RELAY_HOST`_)
|
||||
|
||||
### Technical Details
|
||||
|
||||
- Both the supported ENV and config files for this feature have additional details covered in our ENV docs [Relay Host section][docs::env-relay].
|
||||
- For troubleshooting, a [minimal `compose.yaml` config with several DMS instances][dms-gh::relay-example] demonstrates this feature for local testing.
|
||||
- [Subscribe to this tracking issue][dms-gh::pr-3607] for future improvements intended for this feature.
|
||||
|
||||
!!! abstract "Postfix Settings"
|
||||
|
||||
Internally this feature is implemented in DMS by [`relay.sh`][dms-repo::helpers-relay].
|
||||
|
||||
The `relay.sh` script manages configuring these Postfix settings:
|
||||
|
||||
```cf-extra
|
||||
# Send all outbound mail through this relay service:
|
||||
relayhost = [smtp.relay-service.com]:587
|
||||
|
||||
# Credentials to use:
|
||||
smtp_sasl_password_maps = texthash:/etc/postfix/sasl_passwd
|
||||
# Alternative table type examples which do not require a separate file:
|
||||
#smtp_sasl_password_maps = static:john.doe@relay-service.com:secret
|
||||
#smtp_sasl_password_maps = inline:{ [smtp.relay-service.com]:587=john.doe@relay-service.com:secret }
|
||||
|
||||
## Authentication support:
|
||||
# Required to provide credentials to the relay service:
|
||||
smtp_sasl_auth_enable = yes
|
||||
# Enforces requiring credentials when sending mail outbound:
|
||||
smtp_sasl_security_options = noanonymous
|
||||
# Enforces a secure connection (TLS required) to the relay service:
|
||||
smtp_tls_security_level = encrypt
|
||||
|
||||
## Support for advanced requirements:
|
||||
# Relay service(s) to use instead of direct delivery for specific sender domains:
|
||||
sender_dependent_relayhost_maps = texthash:/etc/postfix/relayhost_map
|
||||
# Support credentials to a relay service(s) that vary by relay host used or sender domain:
|
||||
smtp_sender_dependent_authentication = yes
|
||||
```
|
||||
|
||||
|
||||
[smarthost::mailgun]: https://www.mailgun.com/
|
||||
[smarthost::mailjet]: https://www.mailjet.com
|
||||
[smarthost::sendgrid]: https://sendgrid.com/
|
||||
[smarthost::aws-ses]: https://aws.amazon.com/ses/
|
||||
[wikipedia::smarthost]: https://en.wikipedia.org/wiki/Smart_host
|
||||
|
||||
[docs::env-relay]: ../../environment.md#relay-host
|
||||
[dms-repo::helpers-relay]: https://github.com/docker-mailserver/docker-mailserver/blob/v15.0.0/target/scripts/helpers/relay.sh
|
||||
[dms-gh::pr-3607]: https://github.com/docker-mailserver/docker-mailserver/issues/3607
|
||||
[dms-gh::relay-example]: https://github.com/docker-mailserver/docker-mailserver/issues/3842#issuecomment-1913380639
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
---
|
||||
title: 'Advanced | Email Gathering with Getmail'
|
||||
---
|
||||
|
||||
To enable the [getmail][getmail-website] service to retrieve e-mails set the environment variable `ENABLE_GETMAIL` to `1`. Your `compose.yaml` file should include the following:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
- ENABLE_GETMAIL=1
|
||||
- GETMAIL_POLL=5
|
||||
```
|
||||
|
||||
In your DMS config volume (eg: `docker-data/dms/config/`), add a subdirectory `getmail/` for including your getmail config files (eg: `imap-example.cf`) for each remote account that you want to retrieve mail from and deliver to the mailbox of a DMS account.
|
||||
|
||||
The content of these config files is documented in the next section with an IMAP and POP3 example to reference.
|
||||
|
||||
The directory structure should look similar to this:
|
||||
|
||||
```txt
|
||||
├── docker-data/dms/config
|
||||
│ ├── dovecot.cf
|
||||
│ ├── getmail
|
||||
│ │ ├── getmailrc_general.cf
|
||||
│ │ ├── remote-account1.cf
|
||||
│ │ ├── remote-account2.cf
|
||||
│ ├── postfix-accounts.cf
|
||||
│ └── postfix-virtual.cf
|
||||
├── docker-compose.yml
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
A detailed description of the configuration options can be found in the [online version of the manual page][getmail-docs].
|
||||
|
||||
### Common Options
|
||||
|
||||
The default options added to each `getmail` config are:
|
||||
|
||||
```getmailrc
|
||||
[options]
|
||||
verbose = 0
|
||||
read_all = false
|
||||
delete = false
|
||||
max_messages_per_session = 500
|
||||
received = false
|
||||
delivered_to = false
|
||||
```
|
||||
|
||||
The DMS integration for Getmail generates a `getmailrc` config that prepends the common options of the base config to each remote account config file (`*.cf`) found in the DMS Config Volume `getmail/` directory.
|
||||
|
||||
!!! tip "Change the base options"
|
||||
|
||||
Add your own base config as `getmail/getmailrc_general.cf` into the DMS Config Volume. It will replace the DMS defaults shown above.
|
||||
|
||||
??? example "IMAP Configuration"
|
||||
|
||||
This example will:
|
||||
|
||||
1. Connect to the remote IMAP server from Gmail.
|
||||
2. Retrieve mail from the gmail account `alice` with password `notsecure`.
|
||||
3. Store any mail retrieved from the remote mail-server into DMS for the `user1@example.com` account that DMS manages.
|
||||
|
||||
```getmailrc
|
||||
[retriever]
|
||||
type = SimpleIMAPSSLRetriever
|
||||
server = imap.gmail.com
|
||||
username = alice
|
||||
password = notsecure
|
||||
[destination]
|
||||
type = MDA_external
|
||||
path = /usr/lib/dovecot/deliver
|
||||
allow_root_commands = true
|
||||
arguments =("-d","user1@example.com")
|
||||
```
|
||||
|
||||
??? example "POP3 Configuration"
|
||||
|
||||
Just like the IMAP example above, but instead via POP3 protocol if you prefer that over IMAP.
|
||||
|
||||
```getmailrc
|
||||
[retriever]
|
||||
type = SimplePOP3SSLRetriever
|
||||
server = pop3.gmail.com
|
||||
username = alice
|
||||
password = notsecure
|
||||
[destination]
|
||||
type = MDA_external
|
||||
path = /usr/lib/dovecot/deliver
|
||||
allow_root_commands = true
|
||||
arguments =("-d","user1@example.com")
|
||||
```
|
||||
|
||||
### Polling Interval
|
||||
|
||||
By default the `getmail` service checks external mail accounts for new mail every 5 minutes. That polling interval is configurable via the `GETMAIL_POLL` ENV variable, with a value in minutes (_default: 5, min: 1_):
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
- GETMAIL_POLL=1
|
||||
```
|
||||
|
||||
### XOAUTH2 Authentication
|
||||
|
||||
It is possible to utilize the `getmail-gmail-xoauth-tokens` helper to provide authentication using `xoauth2` for [gmail (example 12)][getmail-docs-xoauth-12] or [Microsoft Office 365 (example 13)][getmail-docs-xoauth-13]
|
||||
|
||||
[getmail-website]: https://www.getmail6.org
|
||||
[getmail-docs]: https://getmail6.org/configuration.html
|
||||
[getmail-docs-xoauth-12]: https://github.com/getmail6/getmail6/blob/1f95606156231f1e074ba62a9baa64f892a92ef8/docs/getmailrc-examples#L286
|
||||
[getmail-docs-xoauth-13]: https://github.com/getmail6/getmail6/blob/1f95606156231f1e074ba62a9baa64f892a92ef8/docs/getmailrc-examples#L351
|
||||
|
||||
## Debugging
|
||||
|
||||
To debug your `getmail` configurations, run this `setup debug` command:
|
||||
|
||||
```sh
|
||||
docker exec -it dms-container-name setup debug getmail
|
||||
```
|
|
@ -4,16 +4,24 @@ title: 'Advanced | Email Filtering with Sieve'
|
|||
|
||||
## User-Defined Sieve Filters
|
||||
|
||||
[Sieve](http://sieve.info/) allows to specify filtering rules for incoming emails that allow for example sorting mails into different folders depending on the title of an email.
|
||||
There are global and user specific filters which are filtering the incoming emails in the following order:
|
||||
!!! warning "Advice may be outdated"
|
||||
|
||||
- Global-before -> User specific -> Global-after
|
||||
This section was contributed by the community some time ago and some configuration examples may be outdated.
|
||||
|
||||
[Sieve][sieve-info] allows to specify filtering rules for incoming emails that allow for example sorting mails into different folders depending on the title of an email.
|
||||
|
||||
!!! info "Global vs User order"
|
||||
|
||||
There are global and user specific filters which are filtering the incoming emails in the following order:
|
||||
|
||||
Global-before -> User specific -> Global-after
|
||||
|
||||
Global filters are applied to EVERY incoming mail for EVERY email address.
|
||||
To specify a global Sieve filter provide a `docker-data/dms/config/before.dovecot.sieve` or a `docker-data/dms/config/after.dovecot.sieve` file with your filter rules.
|
||||
If any filter in this filtering chain discards an incoming mail, the delivery process will stop as well and the mail will not reach any following filters(e.g. global-before stops an incoming spam mail: The mail will get discarded and a user-specific filter won't get applied.)
|
||||
|
||||
To specify a user-defined Sieve filter place a `.dovecot.sieve` file into a virtual user's mail folder e.g. `/var/mail/example.com/user1/.dovecot.sieve`. If this file exists dovecot will apply the filtering rules.
|
||||
- To specify a global Sieve filter provide a `docker-data/dms/config/before.dovecot.sieve` or a `docker-data/dms/config/after.dovecot.sieve` file with your filter rules.
|
||||
- If any filter in this filtering chain discards an incoming mail, the delivery process will stop as well and the mail will not reach any following filters (e.g. global-before stops an incoming spam mail: The mail will get discarded and a user-specific filter won't get applied.)
|
||||
|
||||
To specify a user-defined Sieve filter place a `.dovecot.sieve` file into a virtual user's mail folder (e.g. `/var/mail/example.com/user1/home/.dovecot.sieve`). If this file exists dovecot will apply the filtering rules.
|
||||
|
||||
It's even possible to install a user provided Sieve filter at startup during users setup: simply include a Sieve file in the `docker-data/dms/config/` path for each user login that needs a filter. The file name provided should be in the form `<user_login>.dovecot.sieve`, so for example for `user1@example.com` you should provide a Sieve file named `docker-data/dms/config/user1@example.com.dovecot.sieve`.
|
||||
|
||||
|
@ -32,6 +40,7 @@ An example of a sieve filter that moves mails to a folder `INBOX/spam` depending
|
|||
```
|
||||
|
||||
!!! warning
|
||||
|
||||
That folders have to exist beforehand if sieve should move them.
|
||||
|
||||
Another example of a sieve filter that forward mails to a different address:
|
||||
|
@ -52,31 +61,96 @@ Just forward all incoming emails and do not save them locally:
|
|||
redirect "user2@not-example.com";
|
||||
```
|
||||
|
||||
You can also use external programs to filter or pipe (process) messages by adding executable scripts in `docker-data/dms/config/sieve-pipe` or `docker-data/dms/config/sieve-filter`. This can be used in lieu of a local alias file, for instance to forward an email to a webservice. These programs can then be referenced by filename, by all users. Note that the process running the scripts run as a privileged user. For further information see [Dovecot's wiki](https://wiki.dovecot.org/Pigeonhole/Sieve/Plugins/Pipe).
|
||||
You can also use external programs to filter or pipe (process) messages by adding executable scripts in `docker-data/dms/config/sieve-pipe` or `docker-data/dms/config/sieve-filter`.
|
||||
|
||||
This can be used in lieu of a local alias file, for instance to forward an email to a webservice.
|
||||
|
||||
- These programs can then be referenced by filename, by all users.
|
||||
- Note that the process running the scripts run as a privileged user.
|
||||
- For further information see [Dovecot's docs][dovecot-docs::sieve-pipe].
|
||||
|
||||
```sieve
|
||||
require ["vnd.dovecot.pipe"];
|
||||
pipe "external-program";
|
||||
```
|
||||
|
||||
For more examples or a detailed description of the Sieve language have a look at [the official site](http://sieve.info/examplescripts). Other resources are available on the internet where you can find several [examples](https://support.tigertech.net/sieve#sieve-example-rules-jmp).
|
||||
For more examples or a detailed description of the Sieve language have a look at [the official site][sieve-info::examples]. Other resources are available on the internet where you can find several [examples][third-party::sieve-examples].
|
||||
|
||||
## Automatic Sorting Based on Subaddresses
|
||||
[dovecot-docs::sieve-pipe]: https://doc.dovecot.org/configuration_manual/sieve/plugins/extprograms/#pigeonhole-plugin-extprograms
|
||||
[sieve-info]: http://sieve.info/
|
||||
[sieve-info::examples]: http://sieve.info/examplescripts
|
||||
[third-party::sieve-examples]: https://support.tigertech.net/sieve#sieve-example-rules-jmp
|
||||
|
||||
It is possible to sort subaddresses such as `user+mailing-lists@example.com` into a corresponding folder (here: `INBOX/Mailing-lists`) automatically.
|
||||
## Automatic Sorting Based on Sub-addresses { #subaddress-mailbox-routing }
|
||||
|
||||
```sieve
|
||||
require ["envelope", "fileinto", "mailbox", "subaddress", "variables"];
|
||||
When mail is delivered to your account, it is possible to organize storing mail into folders by the [subaddress (tag)][docs::accounts-subaddressing] used.
|
||||
|
||||
if envelope :detail :matches "to" "*" {
|
||||
set :lower :upperfirst "tag" "${1}";
|
||||
if mailboxexists "INBOX.${1}" {
|
||||
fileinto "INBOX.${1}";
|
||||
} else {
|
||||
fileinto :create "INBOX.${tag}";
|
||||
}
|
||||
}
|
||||
```
|
||||
!!! example "Example: `user+<tag>@example.com` to `INBOX/<Tag>`"
|
||||
|
||||
This example sorts mail into inbox folders by their tag:
|
||||
|
||||
```sieve title="docker-data/dms/config/user@example.com.dovecot.sieve"
|
||||
require ["envelope", "fileinto", "mailbox", "subaddress", "variables"];
|
||||
|
||||
# Check if the mail recipient address has a tag (:detail)
|
||||
if envelope :detail :matches "to" "*" {
|
||||
# Create a variable `tag`, with the the captured `to` value normalized (SoCIAL => Social)
|
||||
set :lower :upperfirst "tag" "${1}";
|
||||
|
||||
# Store the mail into a folder with the tag name, nested under your inbox folder:
|
||||
if mailboxexists "INBOX.${tag}" {
|
||||
fileinto "INBOX.${tag}";
|
||||
} else {
|
||||
fileinto :create "INBOX.${tag}";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
When receiving mail for `user+social@example.com` it would be delivered into the `INBOX/Social` folder.
|
||||
|
||||
??? tip "Only redirect mail for specific tags"
|
||||
|
||||
If you want to only handle specific tags, you could replace the envelope condition and tag assignment from the prior example with:
|
||||
|
||||
```sieve title="docker-data/dms/config/user@example.com.dovecot.sieve"
|
||||
# Instead of `:matches`, use the default comparator `:is` (exact match)
|
||||
if envelope :detail "to" "social" {
|
||||
set "tag" "Social";
|
||||
```
|
||||
|
||||
```sieve title="docker-data/dms/config/user@example.com.dovecot.sieve"
|
||||
# Alternatively you can also provide a list of values to match:
|
||||
if envelope :detail "to" ["azure", "aws"] {
|
||||
set "tag" "Cloud";
|
||||
```
|
||||
|
||||
```sieve title="docker-data/dms/config/user@example.com.dovecot.sieve"
|
||||
# Similar to `:matches`, except `:regex` provides enhanced pattern matching.
|
||||
# NOTE: This example needs you to `require` the "regex" extension
|
||||
if envelope :detail :regex "to" "^cloud-(azure|aws)$" {
|
||||
# Normalize the captured azure/aws tag as the resolved value is no longer fixed:
|
||||
set :lower :upperfirst "vendor" "${1}";
|
||||
# If a `.` exists in the tag, it will create nested folders:
|
||||
set "tag" "Cloud.${vendor}";
|
||||
```
|
||||
|
||||
**NOTE:** There is no need to lowercase the tag in the conditional as the [`to` value is a case-insensitive check][sieve-docs::envelope].
|
||||
|
||||
??? abstract "Technical Details"
|
||||
|
||||
- Dovecot supports this feature via the _Sieve subaddress extension_ ([RFC 5233][rfc::5233::sieve-subaddress]).
|
||||
- Only a single tag per subaddress is supported. Any additional tag delimiters are part of the tag value itself.
|
||||
- The Dovecot setting [`recipient_delimiter`][dovecot-docs::config::recipient_delimiter] (default: `+`) configures the tag delimiter. This is where the `local-part` of the recipient address will split at, providing the `:detail` (tag) value for Sieve.
|
||||
|
||||
---
|
||||
|
||||
`INBOX` is the [default namespace configured by Dovecot][dovecot-docs::namespace].
|
||||
|
||||
- If you omit the `INBOX.` prefix from the sieve script above, the mailbox (folder) for that tag is created at the top-level alongside your Trash and Junk folders.
|
||||
- The `.` between `INBOX` and `${tag}` is important as a [separator to distinguish mailbox names][dovecot-docs::mailbox-names]. This can vary by mailbox format or configuration. DMS uses [`Maildir`][dovecot-docs::mailbox-formats::maildir] by default, which uses `.` as the separator.
|
||||
- [`lmtp_save_to_detail_mailbox = yes`][dovecot-docs::config::lmtp_save_to_detail_mailbox] can be set in `/etc/dovecot/conf.d/20-lmtp.conf`:
|
||||
- This implements the feature globally, except for the tag normalization and `INBOX.` prefix parts of the example script.
|
||||
- However, if the sieve script is also present, the script has precedence and will handle this task instead when the condition is successful, otherwise falling back to the global feature.
|
||||
|
||||
## Manage Sieve
|
||||
|
||||
|
@ -84,20 +158,31 @@ The [Manage Sieve](https://doc.dovecot.org/admin_manual/pigeonhole_managesieve_s
|
|||
|
||||
!!! example
|
||||
|
||||
```yaml
|
||||
# docker-compose.yml
|
||||
```yaml title="compose.yaml"
|
||||
ports:
|
||||
- "4190:4190"
|
||||
environment:
|
||||
- ENABLE_MANAGESIEVE=1
|
||||
```
|
||||
|
||||
All user defined sieve scripts that are managed by ManageSieve are stored in the user's home folder in `/var/mail/example.com/user1/sieve`. Just one sieve script might be active for a user and is sym-linked to `/var/mail/example.com/user1/.dovecot.sieve` automatically.
|
||||
All user defined sieve scripts that are managed by ManageSieve are stored in the user's home folder in `/var/mail/example.com/user1/home/sieve`. Just one Sieve script might be active for a user and is sym-linked to `/var/mail/example.com/user1/home/.dovecot.sieve` automatically.
|
||||
|
||||
!!! note
|
||||
ManageSieve makes sure to not overwrite an existing `.dovecot.sieve` file. If a user activates a new sieve script the old one is backuped and moved to the `sieve` folder.
|
||||
|
||||
ManageSieve makes sure to not overwrite an existing `.dovecot.sieve` file. If a user activates a new sieve script the old one is backed up and moved to the `sieve` folder.
|
||||
|
||||
The extension is known to work with the following ManageSieve clients:
|
||||
|
||||
- **[Sieve Editor](https://github.com/thsmi/sieve)** a portable standalone application based on the former Thunderbird plugin.
|
||||
- **[Kmail](https://kontact.kde.org/components/kmail/)** the mail client of [KDE](https://kde.org/)'s Kontact Suite.
|
||||
|
||||
[docs::accounts-subaddressing]: ../account-management/overview.md#sub-addressing
|
||||
|
||||
[dovecot-docs::namespace]: https://doc.dovecot.org/configuration_manual/namespace/
|
||||
[dovecot-docs::mailbox-names]: https://doc.dovecot.org/configuration_manual/sieve/usage/#mailbox-names
|
||||
[dovecot-docs::mailbox-formats::maildir]: https://doc.dovecot.org/admin_manual/mailbox_formats/maildir/#maildir-mbox-format
|
||||
[dovecot-docs::config::lmtp_save_to_detail_mailbox]: https://doc.dovecot.org/settings/core/#core_setting-lmtp_save_to_detail_mailbox
|
||||
[dovecot-docs::config::recipient_delimiter]: https://doc.dovecot.org/settings/core/#core_setting-recipient_delimiter
|
||||
|
||||
[rfc::5233::sieve-subaddress]: https://datatracker.ietf.org/doc/html/rfc5233
|
||||
[sieve-docs::envelope]: https://thsmi.github.io/sieve-reference/en/test/core/envelope.html
|
||||
|
|
|
@ -2,40 +2,52 @@
|
|||
title: 'Maintenance | Update and Cleanup'
|
||||
---
|
||||
|
||||
## Automatic Update
|
||||
[`containrrr/watchtower`][watchtower-dockerhub] is a service that monitors Docker images for updates, automatically applying them to running containers.
|
||||
|
||||
Docker images are handy but it can become a hassle to keep them updated. Also when a repository is automated you want to get these images when they get out.
|
||||
!!! example "Automatic image updates + cleanup"
|
||||
|
||||
One could setup a complex action/hook-based workflow using probes, but there is a nice, easy to use docker image that solves this issue and could prove useful: [`watchtower`](https://hub.docker.com/r/containrrr/watchtower).
|
||||
Run a `watchtower` container with access to `docker.sock`, enabling the service to manage Docker:
|
||||
|
||||
A docker-compose example:
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
watchtower:
|
||||
image: containrrr/watchtower:latest
|
||||
# Automatic cleanup (removes older image pulls from wasting disk space):
|
||||
environment:
|
||||
- WATCHTOWER_CLEANUP=true
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
```
|
||||
|
||||
```yaml
|
||||
services:
|
||||
watchtower:
|
||||
restart: always
|
||||
image: containrrr/watchtower:latest
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
```
|
||||
!!! tip "The image tag used for a container is monitored for updates (eg: `:latest`, `:edge`, `:13`)"
|
||||
|
||||
For more details, see the [manual](https://containrrr.github.io/watchtower/)
|
||||
The automatic update support is **only for updates to that specific image tag**.
|
||||
|
||||
## Automatic Cleanup
|
||||
- Your container will not update to a new major version tag (_unless using `:latest`_).
|
||||
- Omit the minor or patch portion of the semver tag to receive updates for the omitted portion (_eg: `13` will represent the latest minor + patch release of `v13`_).
|
||||
|
||||
When you are pulling new images in automatically, it would be nice to have them cleaned up as well. There is also a docker image for this: [`spotify/docker-gc`](https://hub.docker.com/r/spotify/docker-gc/).
|
||||
!!! tip "Updating only specific containers"
|
||||
|
||||
A docker-compose example:
|
||||
By default the `watchtower` service will check every 24 hours for new image updates to pull, based on currently running containers (_**not restricted** to only those running within your `compose.yaml`_).
|
||||
|
||||
```yaml
|
||||
services:
|
||||
docker-gc:
|
||||
restart: always
|
||||
image: spotify/docker-gc:latest
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
```
|
||||
Images eligible for updates can configured with a [custom `command`][docker-docs-compose-command] that provides a list of container names, or via other supported options (eg: labels). This configuration is detailed in the [`watchtower` docs][watchtower-docs].
|
||||
|
||||
For more details, see the [manual](https://github.com/spotify/docker-gc/blob/master/README.md)
|
||||
!!! info "Manual cleanup"
|
||||
|
||||
Or you can just use the [`--cleanup`](https://containrrr.github.io/watchtower/arguments/#cleanup) option provided by `containrrr/watchtower`.
|
||||
`watchtower` also supports running on-demand with `docker run` or `compose.yaml` via the `--run-once` option.
|
||||
|
||||
You can alternatively invoke cleanup of Docker storage directly with:
|
||||
|
||||
- [`docker image prune --all`][docker-docs-prune-image]
|
||||
- [`docker system prune --all`][docker-docs-prune-system] (_also removes unused containers, networks, build cache_).
|
||||
|
||||
If you omit the `--all` option, this will instead only remove ["dangling" content][docker-prune-dangling] (_eg: Orphaned images_).
|
||||
|
||||
[watchtower-dockerhub]: https://hub.docker.com/r/containrrr/watchtower
|
||||
[watchtower-cleanup]: https://containrrr.github.io/watchtower/arguments/#cleanup
|
||||
[watchtower-docs]: https://containrrr.dev/watchtower/
|
||||
|
||||
[docker-docs-compose-command]: https://docs.docker.com/compose/compose-file/05-services/#command
|
||||
[docker-docs-prune-image]: https://docs.docker.com/engine/reference/commandline/image_prune/
|
||||
[docker-docs-prune-system]: https://docs.docker.com/engine/reference/commandline/system_prune/
|
||||
[docker-prune-dangling]: https://stackoverflow.com/questions/45142528/what-is-a-dangling-image-and-what-is-an-unused-image/60756668#60756668
|
||||
|
|
|
@ -4,16 +4,69 @@ hide:
|
|||
- toc # Hide Table of Contents for this page
|
||||
---
|
||||
|
||||
This is a list of all configuration files and directories which are optional or automatically generated in your `docker-data/dms/config/` directory.
|
||||
## Volumes
|
||||
|
||||
## Directories
|
||||
DMS has several locations in the container which may be worth persisting externally via [Docker Volumes][docker-docs::volumes].
|
||||
|
||||
- Often you will want to prefer [bind mount volumes][docker-docs::volumes::bind-mount] for easy access to files at a local location on your filesystem.
|
||||
- As a convention for our docs and example configs, the local location has the common prefix `docker-data/dms/` for grouping these related volumes.
|
||||
|
||||
!!! info "Reference - Volmes for DMS"
|
||||
|
||||
Our docs may refer to these DMS specific volumes only by name, or the host/container path for brevity.
|
||||
|
||||
- [Config](#volumes-config): `docker-data/dms/config/` => `/tmp/docker-mailserver/`
|
||||
- [Mail Storage](#volumes-mail): `docker-data/dms/mail-data/` => `/var/mail/`
|
||||
- [State](#volumes-state): `docker-data/dms/mail-state/` => `/var/mail-state/`
|
||||
- [Logs](#volumes-log): `docker-data/dms/mail-logs/` => `/var/log/mail/`
|
||||
|
||||
### Mail Storage Volume { #volumes-mail }
|
||||
|
||||
This is the location where mail is delivered to your mailboxes.
|
||||
|
||||
### State Volume { #volumes-state }
|
||||
|
||||
Run-time specific state lives here, but so does some data you may want to keep if a failure event occurs (_crash, power loss_).
|
||||
|
||||
!!! example "Examples of relevant data"
|
||||
|
||||
- The Postfix queue (eg: mail pending delivery attempt)
|
||||
- Fail2Ban blocks.
|
||||
- ClamAV signature updates.
|
||||
- Redis storage for Rspamd.
|
||||
|
||||
!!! info "When a volume is mounted to `/var/mail-state/`"
|
||||
|
||||
- Service run-time data is [consolidated into the `/var/mail-state/` directory][mail-state-folders]. Otherwise the original locations vary and would need to be mounted individually.
|
||||
- The original locations are updated with symlinks to redirect to their new path in `/var/mail-state/` (_eg: `/var/lib/redis` => `/var/mail-state/lib-redis/`_).
|
||||
|
||||
Supported services: Postfix, Dovecot, Fail2Ban, Amavis, PostGrey, ClamAV, SpamAssassin, Rspamd & Redis, Fetchmail, Getmail, LogRotate, PostSRSd, MTA-STS.
|
||||
|
||||
!!! tip
|
||||
|
||||
Sometimes it is helpful to disable this volume when troubleshooting to verify if the data stored here is in a bad state (_eg: caused by a failure event_).
|
||||
|
||||
[mail-state-folders]: https://github.com/docker-mailserver/docker-mailserver/blob/v13.3.1/target/scripts/startup/setup.d/mail_state.sh#L13-L33
|
||||
|
||||
### Logs Volume { #volumes-log }
|
||||
|
||||
This can be a useful volume to persist for troubleshooting needs for the full set of log files.
|
||||
|
||||
### Config Volume { #volumes-config }
|
||||
|
||||
Most configuration files for Postfix, Dovecot, etc. are persisted here.
|
||||
|
||||
This is a list of all configuration files and directories which are optional, automatically generated / updated by our `setup` CLI, or other internal scripts.
|
||||
|
||||
#### Directories
|
||||
|
||||
- **sieve-filter:** directory for sieve filter scripts. (Docs: [Sieve][docs-sieve])
|
||||
- **sieve-pipe:** directory for sieve pipe scripts. (Docs: [Sieve][docs-sieve])
|
||||
- **opendkim:** DKIM directory. Auto-configurable via [`setup.sh config dkim`][docs-setupsh]. (Docs: [DKIM][docs-dkim])
|
||||
- **ssl:** SSL Certificate directory if `SSL_TYPE` is set to `self-signed` or `custom`. (Docs: [SSL][docs-ssl])
|
||||
- **rspamd:** Override directory for custom settings when using Rspamd (Docs: [Rspamd][docs-rspamd-override-d])
|
||||
|
||||
## Files
|
||||
#### Files
|
||||
|
||||
- **{user_email_address}.dovecot.sieve:** User specific Sieve filter file. (Docs: [Sieve][docs-sieve])
|
||||
- **before.dovecot.sieve:** Global Sieve filter file, applied prior to the `${login}.dovecot.sieve` filter. (Docs: [Sieve][docs-sieve])
|
||||
|
@ -24,35 +77,38 @@ This is a list of all configuration files and directories which are optional or
|
|||
- **postfix-send-access.cf:** List of users denied sending. Modify via [`setup.sh email restrict`][docs-setupsh].
|
||||
- **postfix-receive-access.cf:** List of users denied receiving. Modify via [`setup.sh email restrict`][docs-setupsh].
|
||||
- **postfix-virtual.cf:** Alias configuration file. Modify via [`setup.sh alias`][docs-setupsh].
|
||||
- **postfix-sasl-password.cf:** listing of relayed domains with their respective `<username>:<password>`. Modify via `setup.sh relay add-auth <domain> <username> [<password>]`. (Docs: [Relay-Hosts Auth][docs-relayhosts-senderauth])
|
||||
- **postfix-relaymap.cf:** domain-specific relays and exclusions. Modify via `setup.sh relay add-domain` and `setup.sh relay exclude-domain`. (Docs: [Relay-Hosts Senders][docs-relayhosts-senderhost])
|
||||
- **postfix-sasl-password.cf:** listing of relayed domains with their respective `<username>:<password>`. Modify via `setup.sh relay add-auth <domain> <username> [<password>]`. (Docs: [Relay-Hosts Auth][docs::relay-hosts::advanced])
|
||||
- **postfix-relaymap.cf:** domain-specific relays and exclusions. Modify via `setup.sh relay add-domain` and `setup.sh relay exclude-domain`. (Docs: [Relay-Hosts Senders][docs::relay-hosts::advanced])
|
||||
- **postfix-regexp.cf:** Regular expression alias file. (Docs: [Aliases][docs-aliases-regex])
|
||||
- **ldap-users.cf:** Configuration for the virtual user mapping `virtual_mailbox_maps`. See the [`setup-stack.sh`][github-commit-setup-stack.sh-L411] script.
|
||||
- **ldap-groups.cf:** Configuration for the virtual alias mapping `virtual_alias_maps`. See the [`setup-stack.sh`][github-commit-setup-stack.sh-L411] script.
|
||||
- **ldap-aliases.cf:** Configuration for the virtual alias mapping `virtual_alias_maps`. See the [`setup-stack.sh`][github-commit-setup-stack.sh-L411] script.
|
||||
- **ldap-domains.cf:** Configuration for the virtual domain mapping `virtual_mailbox_domains`. See the [`setup-stack.sh`][github-commit-setup-stack.sh-L411] script.
|
||||
- **whitelist_clients.local:** Whitelisted domains, not considered by postgrey. Enter one host or domain per line.
|
||||
- **spamassassin-rules.cf:** Antispam rules for Spamassassin. (Docs: [FAQ - SpamAssassin Rules][docs-faq-spamrules])
|
||||
- **spamassassin-rules.cf:** Anti-spam rules for Spamassassin. (Docs: [FAQ - SpamAssassin Rules][docs-faq-spamrules])
|
||||
- **fail2ban-fail2ban.cf:** Additional config options for `fail2ban.cf`. (Docs: [Fail2Ban][docs-fail2ban])
|
||||
- **fail2ban-jail.cf:** Additional config options for fail2ban's jail behaviour. (Docs: [Fail2Ban][docs-fail2ban])
|
||||
- **fail2ban-jail.cf:** Additional config options for fail2ban's jail behavior. (Docs: [Fail2Ban][docs-fail2ban])
|
||||
- **amavis.cf:** replaces the `/etc/amavis/conf.d/50-user` file
|
||||
- **dovecot.cf:** replaces `/etc/dovecot/local.conf`. (Docs: [Override Dovecot Defaults][docs-override-dovecot])
|
||||
- **dovecot-quotas.cf:** list of custom quotas per mailbox. (Docs: [Accounts][docs-accounts-quota])
|
||||
- **user-patches.sh:** this file will be run after all configuration files are set up, but before the postfix, amavis and other daemons are started. (Docs: [FAQ - How to adjust settings with the `user-patches.sh` script][docs-faq-userpatches])
|
||||
- **rspamd-commands:** list of simple commands to adjust Rspamd modules in an easy way (Docs: [Rspamd][docs-rspamd-commands])
|
||||
- **rspamd/custom-commands.conf:** list of simple commands to adjust Rspamd modules in an easy way (Docs: [Rspamd][docs-rspamd-commands])
|
||||
|
||||
[docs-accounts-quota]: ../../config/user-management.md#quotas
|
||||
[docs-aliases-regex]: ../../config/user-management.md#configuring-regexp-aliases
|
||||
[docs-dkim]: ../../config/best-practices/dkim.md
|
||||
[docker-docs::volumes]: https://docs.docker.com/storage/volumes/
|
||||
[docker-docs::volumes::bind-mount]: https://docs.docker.com/storage/bind-mounts/
|
||||
|
||||
[docs-accounts-quota]: ../../config/account-management/provisioner/file.md#quotas
|
||||
[docs-aliases-regex]: ../../config/account-management/provisioner/file.md#configuring-regex-aliases
|
||||
[docs-dkim]: ../../config/best-practices/dkim_dmarc_spf.md#dkim
|
||||
[docs-fail2ban]: ../../config/security/fail2ban.md
|
||||
[docs-faq-spamrules]: ../../faq.md#how-can-i-manage-my-custom-spamassassin-rules
|
||||
[docs-faq-userpatches]: ../../faq.md#how-to-adjust-settings-with-the-user-patchessh-script
|
||||
[docs-override-postfix]: ./override-defaults/postfix.md
|
||||
[docs-override-dovecot]: ./override-defaults/dovecot.md
|
||||
[docs-relayhosts-senderauth]: ./mail-forwarding/relay-hosts.md#sender-dependent-authentication
|
||||
[docs-relayhosts-senderhost]: ./mail-forwarding/relay-hosts.md#sender-dependent-relay-host
|
||||
[docs::relay-hosts::advanced]: ./mail-forwarding/relay-hosts.md#advanced-configuration
|
||||
[docs-sieve]: ./mail-sieve.md
|
||||
[docs-setupsh]: ../../config/setup.sh.md
|
||||
[docs-ssl]: ../../config/security/ssl.md
|
||||
[docs-rspamd-override-d]: ../security/rspamd.md#manually
|
||||
[docs-rspamd-commands]: ../security/rspamd.md#with-the-help-of-a-custom-file
|
||||
[github-commit-setup-stack.sh-L411]: https://github.com/docker-mailserver/docker-mailserver/blob/941e7acdaebe271eaf3d296b36d4d81df4c54b90/target/scripts/startup/setup-stack.sh#L411
|
||||
|
|
|
@ -7,14 +7,14 @@ title: 'Override the Default Configs | Dovecot'
|
|||
The Dovecot default configuration can easily be extended providing a `docker-data/dms/config/dovecot.cf` file.
|
||||
[Dovecot documentation](https://doc.dovecot.org/configuration_manual/) remains the best place to find configuration options.
|
||||
|
||||
Your `docker-mailserver` folder should look like this example:
|
||||
Your DMS folder structure should look like this example:
|
||||
|
||||
```txt
|
||||
├── docker-data/dms/config
|
||||
│ ├── dovecot.cf
|
||||
│ ├── postfix-accounts.cf
|
||||
│ └── postfix-virtual.cf
|
||||
├── docker-compose.yml
|
||||
├── compose.yaml
|
||||
└── README.md
|
||||
```
|
||||
|
||||
|
@ -26,7 +26,7 @@ mail_max_userip_connections = 100
|
|||
|
||||
Another important option is the `default_process_limit` (defaults to `100`). If high-security mode is enabled you'll need to make sure this count is higher than the maximum number of users that can be logged in simultaneously.
|
||||
|
||||
This limit is quickly reached if users connect to the `docker-mailserver` with multiple end devices.
|
||||
This limit is quickly reached if users connect to DMS with multiple end devices.
|
||||
|
||||
## Override Configuration
|
||||
|
||||
|
@ -55,7 +55,7 @@ To debug your dovecot configuration you can use:
|
|||
- Or: `docker exec -it mailserver doveconf | grep <some-keyword>`
|
||||
|
||||
!!! note
|
||||
[`setup.sh`][github-file-setupsh] is included in the `docker-mailserver` repository. Make sure to use the one matching your image version release.
|
||||
[`setup.sh`][github-file-setupsh] is included in the DMS repository. Make sure to use the one matching your image version release.
|
||||
|
||||
The file `docker-data/dms/config/dovecot.cf` is copied internally to `/etc/dovecot/local.conf`. To verify the file content, run:
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
title: 'Custom User Changes & Patches | Scripting'
|
||||
---
|
||||
|
||||
If you'd like to change, patch or alter files or behavior of `docker-mailserver`, you can use a script.
|
||||
If you'd like to change, patch or alter files or behavior of DMS, you can use a script.
|
||||
|
||||
In case you cloned this repository, you can copy the file [`user-patches.sh.dist` (_under `config/`_)][github-file-userpatches] with `#!sh cp config/user-patches.sh.dist docker-data/dms/config/user-patches.sh` in order to create the `user-patches.sh` script.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ Podman is a daemonless container engine for developing, managing, and running OC
|
|||
|
||||
!!! warning "About Support for Podman"
|
||||
|
||||
Please note that Podman **is not** officially supported as `docker-mailserver` is built and verified on top of the _Docker Engine_. This content is entirely community supported. If you find errors, please open an issue and provide a PR.
|
||||
Please note that Podman **is not** officially supported as DMS is built and verified on top of the _Docker Engine_. This content is entirely community supported. If you find errors, please open an issue and provide a PR.
|
||||
|
||||
!!! warning "About this Guide"
|
||||
|
||||
|
@ -23,7 +23,7 @@ Podman is a daemonless container engine for developing, managing, and running OC
|
|||
|
||||
While using Podman, you can just manage docker-mailserver as what you did with Docker. Your best friend `setup.sh` includes the minimum code in order to support Podman since it's 100% compatible with the Docker CLI.
|
||||
|
||||
The installation is basically the same. Podman v3.2 introduced a RESTful API that is 100% compatible with the Docker API, so you can use docker-compose with Podman easily. Install Podman and docker-compose with your package manager first.
|
||||
The installation is basically the same. Podman v3.2 introduced a RESTful API that is 100% compatible with the Docker API, so you can use Docker Compose with Podman easily. Install Podman and Docker Compose with your package manager first.
|
||||
|
||||
```bash
|
||||
sudo dnf install podman docker-compose
|
||||
|
@ -39,8 +39,8 @@ This will create a unix socket locate under `/run/podman/podman.sock`, which is
|
|||
|
||||
```bash
|
||||
export DOCKER_HOST="unix:///run/podman/podman.sock"
|
||||
docker-compose up -d mailserver
|
||||
docker-compose ps
|
||||
docker compose up -d mailserver
|
||||
docker compose ps
|
||||
```
|
||||
|
||||
You should see that docker-mailserver is running now.
|
||||
|
@ -67,7 +67,7 @@ Also notice that Podman's rootless mode is not about running as a non-root user
|
|||
|
||||
!!! warning
|
||||
|
||||
In order to make rootless `docker-mailserver` work we must modify some settings in the Linux system, it requires some basic linux server knowledge so don't follow this guide if you not sure what this guide is talking about. Podman rootfull mode and Docker are still good and security enough for normal daily usage.
|
||||
In order to make rootless DMS work we must modify some settings in the Linux system, it requires some basic linux server knowledge so don't follow this guide if you not sure what this guide is talking about. Podman rootfull mode and Docker are still good and security enough for normal daily usage.
|
||||
|
||||
First, enable `podman.socket` in systemd's userspace with a non-root user.
|
||||
|
||||
|
@ -75,7 +75,7 @@ First, enable `podman.socket` in systemd's userspace with a non-root user.
|
|||
systemctl enable --now --user podman.socket
|
||||
```
|
||||
|
||||
The socket file should be located at `/var/run/user/$(id -u)/podman/podman.sock`. Then, modify `docker-compose.yml` to make sure all ports are bindings are on non-privileged ports.
|
||||
The socket file should be located at `/var/run/user/$(id -u)/podman/podman.sock`. Then, modify `compose.yaml` to make sure all ports are bindings are on non-privileged ports.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
@ -88,12 +88,12 @@ services:
|
|||
- "10993:993" # IMAP4 (implicit TLS)
|
||||
```
|
||||
|
||||
Then, setup your `mailserver.env` file follow the documentation and use docker-compose to start the container.
|
||||
Then, setup your `mailserver.env` file follow the documentation and use Docker Compose to start the container.
|
||||
|
||||
```bash
|
||||
export DOCKER_HOST="unix:///var/run/user/$(id -u)/podman/podman.sock"
|
||||
docker-compose up -d mailserver
|
||||
docker-compose ps
|
||||
docker compose up -d mailserver
|
||||
docker compose ps
|
||||
```
|
||||
|
||||
### Security in Rootless Mode
|
||||
|
@ -106,12 +106,12 @@ The `PERMIT_DOCKER` variable in the `mailserver.env` file allows to specify trus
|
|||
|
||||
#### Use the slip4netns network driver
|
||||
|
||||
The second workaround is slightly more complicated because the `docker-compose.yml` has to be modified.
|
||||
As shown in the [fail2ban section](../../security/fail2ban/#podman-with-slirp4netns-port-driver) the `slirp4netns` network driver has to be enabled.
|
||||
The second workaround is slightly more complicated because the `compose.yaml` has to be modified.
|
||||
As shown in the [fail2ban section][docs::fail2ban::rootless] the `slirp4netns` network driver has to be enabled.
|
||||
This network driver enables podman to correctly resolve IP addresses but it is not compatible with
|
||||
user defined networks which might be a problem depending on your setup.
|
||||
|
||||
[Rootless Podman][rootless::podman] requires adding the value `slirp4netns:port_handler=slirp4netns` to the `--network` CLI option, or `network_mode` setting in your `docker-compose.yml`.
|
||||
[Rootless Podman][rootless::podman] requires adding the value `slirp4netns:port_handler=slirp4netns` to the `--network` CLI option, or `network_mode` setting in your `compose.yaml`.
|
||||
|
||||
You must also add the ENV `NETWORK_INTERFACE=tap0`, because Podman uses a [hard-coded interface name][rootless::podman::interface] for `slirp4netns`.
|
||||
|
||||
|
@ -150,7 +150,7 @@ Remember to run this command as root user.
|
|||
|
||||
### Port Forwarding
|
||||
|
||||
When it comes to forwarding ports using `firewalld`, see <https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/securing_networks/using-and-configuring-firewalld_securing-networks#port-forwarding_using-and-configuring-firewalld> for more information.
|
||||
When it comes to forwarding ports using `firewalld`, see [these port forwarding docs][firewalld-port-forwarding] for more information.
|
||||
|
||||
```bash
|
||||
firewall-cmd --permanent --add-forward-port=port=<25|143|465|587|993>:proto=<tcp>:toport=<10025|10143|10465|10587|10993>
|
||||
|
@ -169,7 +169,9 @@ firewall-cmd --permanent --direct --add-rule <ipv4|ipv6> nat OUTPUT 0 -p <tcp|ud
|
|||
firewall-cmd --reload
|
||||
```
|
||||
|
||||
Just map all the privilege port with non-privilege port you set in docker-compose.yml before as root user.
|
||||
Just map all the privilege port with non-privilege port you set in compose.yaml before as root user.
|
||||
|
||||
[docs::fail2ban::rootless]: ../security/fail2ban.md#rootless-container
|
||||
[rootless::podman]: https://github.com/containers/podman/blob/v3.4.1/docs/source/markdown/podman-run.1.md#--networkmode---net
|
||||
[rootless::podman::interface]: https://github.com/containers/podman/blob/v3.4.1/libpod/networking_slirp4netns.go#L264
|
||||
[firewalld-port-forwarding]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/securing_networks/using-and-configuring-firewalld_securing-networks#port-forwarding_using-and-configuring-firewalld
|
||||
|
|
|
@ -4,7 +4,9 @@ hide:
|
|||
- toc # Hide Table of Contents for this page
|
||||
---
|
||||
|
||||
Email auto-discovery means a client email is able to automagically find out about what ports and security options to use, based on the mail-server URI. It can help simplify the tedious / confusing task of adding own's email account for non-tech savvy users.
|
||||
# Auto-Discovery of Services
|
||||
|
||||
Email auto-discovery means a client email is able to automagically find out about what ports and security options to use, based on the mail server URI. It can help simplify the tedious / confusing task of adding own's email account for non-tech savvy users.
|
||||
|
||||
Email clients will search for auto-discoverable settings and prefill almost everything when a user enters its email address :heart:
|
||||
|
||||
|
|
|
@ -1,123 +0,0 @@
|
|||
---
|
||||
title: 'Best Practices | DKIM'
|
||||
---
|
||||
|
||||
DKIM is a security measure targeting email spoofing. It is greatly recommended one activates it.
|
||||
|
||||
!!! note
|
||||
See [the Wikipedia page](https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail) for more details on DKIM.
|
||||
|
||||
## Enabling DKIM Signature
|
||||
|
||||
To enable DKIM signature, **you must have created at least one email account**. Once its done, just run the following command to generate the signature:
|
||||
|
||||
```sh
|
||||
./setup.sh config dkim
|
||||
```
|
||||
|
||||
After generating DKIM keys, you should restart `docker-mailserver`. DNS edits may take a few minutes to hours to propagate.
|
||||
|
||||
The script should ideally be run with a volume for _config_ attached (eg: `./docker-data/dms/config/:/tmp/docker-mailserver/`), otherwise by default it will mount `./config/:/tmp/docker-mailserver/`.
|
||||
|
||||
The default keysize when generating the signature is 4096 bits for now. If you need to change it (e.g. your DNS provider limits the size), then provide the size as the first parameter of the command:
|
||||
|
||||
```sh
|
||||
./setup.sh config dkim keysize <keysize>
|
||||
```
|
||||
|
||||
For LDAP systems that do not have any directly created user account you can run the following command (since `8.0.0`) to generate the signature by additionally providing the desired domain name (if you have multiple domains use the command multiple times or provide a comma-separated list of domains):
|
||||
|
||||
```sh
|
||||
./setup.sh config dkim keysize <key-size> domain <example.com>[,<not-example.com>]
|
||||
```
|
||||
|
||||
Now the keys are generated, you can configure your DNS server with DKIM signature, simply by adding a TXT record. If you have direct access to your DNS zone file, then it's only a matter of pasting the content of `docker-data/dms/config/opendkim/keys/example.com/mail.txt` in your `example.com.hosts` zone.
|
||||
|
||||
```console
|
||||
$ dig mail._domainkey.example.com TXT
|
||||
---
|
||||
;; ANSWER SECTION
|
||||
mail._domainkey.<DOMAIN> 300 IN TXT "v=DKIM1; k=rsa; p=AZERTYUIOPQSDFGHJKLMWXCVBN/AZERTYUIOPQSDFGHJKLMWXCVBN/AZERTYUIOPQSDFGHJKLMWXCVBN/AZERTYUIOPQSDFGHJKLMWXCVBN/AZERTYUIOPQSDFGHJKLMWXCVBN/AZERTYUIOPQSDFGHJKLMWXCVBN/AZERTYUIOPQSDFGHJKLMWXCVBN/AZERTYUIOPQSDFGHJKLMWXCVBN"
|
||||
```
|
||||
|
||||
## Configuration using a Web Interface
|
||||
|
||||
1. Generate a new record of the type `TXT`.
|
||||
2. Paste `mail._domainkey` the `Name` txt field.
|
||||
3. In the `Target` or `Value` field fill in `v=DKIM1; k=rsa; p=AZERTYUGHJKLMWX...`.
|
||||
4. In `TTL` (time to live): Time span in seconds. How long the DNS server should cache the `TXT` record.
|
||||
5. Save.
|
||||
|
||||
!!! note
|
||||
Sometimes the key in `docker-data/dms/config/opendkim/keys/example.com/mail.txt` can be on multiple lines. If so then you need to concatenate the values in the TXT record:
|
||||
|
||||
```console
|
||||
$ dig mail._domainkey.example.com TXT
|
||||
---
|
||||
;; ANSWER SECTION
|
||||
mail._domainkey.<DOMAIN> 300 IN TXT "v=DKIM1; k=rsa; "
|
||||
"p=AZERTYUIOPQSDF..."
|
||||
"asdfQWERTYUIOPQSDF..."
|
||||
```
|
||||
|
||||
The target (or value) field must then have all the parts together: `v=DKIM1; k=rsa; p=AZERTYUIOPQSDF...asdfQWERTYUIOPQSDF...`
|
||||
|
||||
## Verify-Only
|
||||
|
||||
If you want DKIM to only _verify_ incoming emails, the following version of `/etc/opendkim.conf` may be useful (right now there is no easy mechanism for installing it other than forking the repo):
|
||||
|
||||
```conf
|
||||
# This is a simple config file verifying messages only
|
||||
|
||||
#LogWhy yes
|
||||
Syslog yes
|
||||
SyslogSuccess yes
|
||||
|
||||
Socket inet:12301@localhost
|
||||
PidFile /var/run/opendkim/opendkim.pid
|
||||
|
||||
ReportAddress postmaster@example.com
|
||||
SendReports yes
|
||||
|
||||
Mode v
|
||||
```
|
||||
|
||||
## Switch Off DKIM
|
||||
|
||||
Simply remove the DKIM key by recreating (not just relaunching) the `docker-mailserver` container.
|
||||
|
||||
## Debugging
|
||||
|
||||
- [DKIM-verifer](https://addons.mozilla.org/en-US/thunderbird/addon/dkim-verifier): A add-on for the mail client Thunderbird.
|
||||
- You can debug your TXT records with the `dig` tool.
|
||||
|
||||
```console
|
||||
$ dig TXT mail._domainkey.example.com
|
||||
---
|
||||
; <<>> DiG 9.10.3-P4-Debian <<>> TXT mail._domainkey.example.com
|
||||
;; global options: +cmd
|
||||
;; Got answer:
|
||||
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39669
|
||||
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
|
||||
|
||||
;; OPT PSEUDOSECTION:
|
||||
; EDNS: version: 0, flags:; udp: 512
|
||||
;; QUESTION SECTION:
|
||||
;mail._domainkey.example.com. IN TXT
|
||||
|
||||
;; ANSWER SECTION:
|
||||
mail._domainkey.example.com. 3600 IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCxBSjG6RnWAdU3oOlqsdf2WC0FOUmU8uHVrzxPLW2R3yRBPGLrGO1++yy3tv6kMieWZwEBHVOdefM6uQOQsZ4brahu9lhG8sFLPX4MaKYN/NR6RK4gdjrZu+MYSdfk3THgSbNwIDAQAB"
|
||||
|
||||
;; Query time: 50 msec
|
||||
;; SERVER: 127.0.1.1#53(127.0.1.1)
|
||||
;; WHEN: Wed Sep 07 18:22:57 CEST 2016
|
||||
;; MSG SIZE rcvd: 310
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
!!! warning "Key sizes >=4096-bit"
|
||||
|
||||
Keys of 4096 bits could de denied by some mail-servers. According to https://tools.ietf.org/html/rfc6376 keys are preferably between 512 and 2048 bits. See issue [#1854][github-issue-1854].
|
||||
|
||||
[github-issue-1854]: https://github.com/docker-mailserver/docker-mailserver/issues/1854
|
|
@ -0,0 +1,385 @@
|
|||
# DKIM, DMARC & SPF
|
||||
|
||||
Cloudflare has written an [article about DKIM, DMARC and SPF][cloudflare-dkim-dmarc-spf] that we highly recommend you to read to get acquainted with the topic.
|
||||
|
||||
!!! note "Rspamd vs Individual validators"
|
||||
|
||||
With v12.0.0, Rspamd was integrated into DMS. It can perform validations for DKIM, DMARC and SPF as part of the `spam-score-calculation` for an email. DMS provides individual alternatives for each validation that can be used instead of deferring to Rspamd:
|
||||
|
||||
- DKIM: `opendkim` is used as a milter (like Rspamd)
|
||||
- DMARC: `opendmarc` is used as a milter (like Rspamd)
|
||||
- SPF: `policyd-spf` is used in Postfix's `smtpd_recipient_restrictions`
|
||||
|
||||
In a future release Rspamd will become the default for these validations, with a deprecation notice issued prior to the removal of the above alternatives.
|
||||
|
||||
We encourage everyone to prefer Rspamd via `ENABLE_RSPAMD=1`.
|
||||
|
||||
!!! warning "DNS Caches & Propagation"
|
||||
|
||||
While modern DNS providers are quick, it may take minutes or even hours for new DNS records to become available / propagate.
|
||||
|
||||
## DKIM
|
||||
|
||||
!!! quote "What is DKIM"
|
||||
|
||||
DomainKeys Identified Mail (DKIM) is an email authentication method designed to detect forged sender addresses in email (email spoofing), a technique often used in phishing and email spam.
|
||||
|
||||
[Source][wikipedia-dkim]
|
||||
|
||||
When DKIM is enabled:
|
||||
|
||||
1. Inbound mail will verify any included DKIM signatures
|
||||
2. Outbound mail is signed (_when your sending domain has a configured DKIM key_)
|
||||
|
||||
DKIM requires a public/private key pair to enable **signing (_via private key_)** your outgoing mail, while the receiving end must query DNS to **verify (_via public key_)** that the signature is trustworthy.
|
||||
|
||||
??? info "Verification expiry"
|
||||
|
||||
Unlike your TLS certificate, your DKIM keypair does not have a fixed expiry associated to it.
|
||||
|
||||
|
||||
Instead, an expiry may be included in your DKIM signature for each mail sent, where a receiver will [refuse to validate the signature for an email after that expiry date][dkim-verification-expiry-refusal]. This is an added precaution to mitigate malicious activity like "DKIM replay attacks", where an already delivered email from a third-party with a trustworthy DKIM signature is leveraged by a spammer when sending mail to an MTA which verifies the DKIM signature successfully, enabling the spammer to bypass spam protections.
|
||||
|
||||
Unlike a TLS handshake where you are authenticating trust with future communications, with DKIM once the mail has been received and trust of the signature has been verified, the value of verifying the signature again at a later date is less meaningful since the signature was to ensure no tampering had occurred during delivery through the network.
|
||||
|
||||
??? tip "DKIM key rotation"
|
||||
|
||||
You can rotate your DKIM keypair by switching to a new DKIM selector (_and DNS updates_), while the previous key and selector remains valid for verification until the last mail signed with that key reaches it's expiry.
|
||||
|
||||
DMS does not provide any automation or support for key rotation, [nor is it likely to provide a notable security benefit][gh-discussion::dkim-key-rotation-expiry] to the typical small scale DMS deployment.
|
||||
|
||||
### Generating Keys
|
||||
|
||||
You'll need to repeat this process if you add any new domains.
|
||||
|
||||
You should have:
|
||||
|
||||
- At least one [email account setup][docs-accounts]
|
||||
- Attached a [volume for config][docs-volumes-config] to persist the generated files to local storage
|
||||
|
||||
!!! example "Creating DKIM Keys"
|
||||
|
||||
DKIM keys can be generated with good defaults by running:
|
||||
|
||||
```bash
|
||||
docker exec -it <CONTAINER NAME> setup config dkim
|
||||
```
|
||||
|
||||
If you need to generate your keys with different settings, check the `help` output for supported config options and examples:
|
||||
|
||||
```bash
|
||||
docker exec -it <CONTAINER NAME> setup config dkim help
|
||||
```
|
||||
|
||||
As described by the help output, you may need to use the `domain` option explicitly when you're using LDAP or Rspamd.
|
||||
|
||||
??? info "Changing the key size"
|
||||
|
||||
The keypair generated for using with DKIM presently defaults to RSA-2048. This is a good size but you can lower the security to `1024-bit`, or increase it to `4096-bit` (_discouraged as that is excessive_).
|
||||
|
||||
To generate a key with different size (_for RSA 1024-bit_) run:
|
||||
|
||||
```sh
|
||||
setup config dkim keysize 1024
|
||||
```
|
||||
|
||||
!!! warning "RSA Key Sizes >= 4096 Bit"
|
||||
|
||||
According to [RFC 8301][rfc-8301], keys are preferably between 1024 and 2048 bits. Keys of size 4096-bit or larger may not be compatible to all systems your mail is intended for.
|
||||
|
||||
You [should not need a key length beyond 2048-bit][gh-issue::dkim-length]. If 2048-bit does not meet your security needs, you may want to instead consider adopting key rotation or switching from RSA to ECC keys for DKIM.
|
||||
|
||||
??? note "You may need to specify mail domains explicitly"
|
||||
|
||||
Required when using LDAP and Rspamd.
|
||||
|
||||
`setup config dkim` will generate DKIM keys for what is assumed as the primary mail domain (_derived from the FQDN assigned to DMS, minus any subdomain_).
|
||||
|
||||
When the DMS FQDN is `mail.example.com` or `example.com`, by default this command will generate DKIM keys for `example.com` as the primary domain for your users mail accounts (eg: `hello@example.com`).
|
||||
|
||||
The DKIM generation does not have support to query LDAP for additional mail domains it should know about. If the primary mail domain is not sufficient, then you must explicitly specify any extra domains via the `domain` option:
|
||||
|
||||
```sh
|
||||
# ENABLE_OPENDKIM=1 (default):
|
||||
setup config dkim domain 'example.com,another-example.com'
|
||||
|
||||
# ENABLE_RSPAMD=1 + ENABLE_OPENDKIM=0:
|
||||
setup config dkim domain example.com
|
||||
setup config dkim domain another-example.com
|
||||
```
|
||||
|
||||
!!! info "OpenDKIM with `ACCOUNT_PROVISIONER=FILE`"
|
||||
|
||||
When DMS uses this configuration, it will by default also detect mail domains (_from accounts added via `setup email add`_), generating additional DKIM keys.
|
||||
|
||||
DKIM is currently supported by either OpenDKIM or Rspamd:
|
||||
|
||||
=== "OpenDKIM"
|
||||
|
||||
OpenDKIM is currently [enabled by default][docs-env-opendkim].
|
||||
|
||||
After running `setup config dkim`, your new DKIM key files (_and OpenDKIM config_) have been added to `/tmp/docker-mailserver/opendkim/`.
|
||||
|
||||
!!! info "Restart required"
|
||||
|
||||
After restarting DMS, outgoing mail will now be signed with your new DKIM key(s) :tada:
|
||||
|
||||
=== "Rspamd"
|
||||
|
||||
Requires opt-in via [`ENABLE_RSPAMD=1`][docs-env-rspamd] (_and disable the default OpenDKIM: `ENABLE_OPENDKIM=0`_).
|
||||
|
||||
Rspamd provides DKIM support through two separate modules:
|
||||
|
||||
1. [Verifying DKIM signatures from inbound mail][rspamd-docs-dkim-checks] is enabled by default.
|
||||
2. [Signing outbound mail with your DKIM key][rspamd-docs-dkim-signing] needs additional setup (key + dns + config).
|
||||
|
||||
??? warning "Using Multiple Domains"
|
||||
|
||||
If you have multiple domains, you need to:
|
||||
|
||||
- Create a key wth `docker exec -it <CONTAINER NAME> setup config dkim domain <DOMAIN>` for each domain DMS should sign outgoing mail for.
|
||||
- Provide a custom `dkim_signing.conf` (for which an example is shown below), as the default config only supports one domain.
|
||||
|
||||
!!! info "About the Helper Script"
|
||||
|
||||
The script will persist the keys in `/tmp/docker-mailserver/rspamd/dkim/`. Hence, if you are already using the default volume mounts, the keys are persisted in a volume. The script also restarts Rspamd directly, so changes take effect without restarting DMS.
|
||||
|
||||
The script provides you with log messages along the way of creating keys. In case you want to read the complete log, use `-v` (verbose) or `-vv` (very verbose).
|
||||
|
||||
---
|
||||
|
||||
In case you have not already provided a default DKIM signing configuration, the script will create one and write it to `/etc/rspamd/override.d/dkim_signing.conf`. If this file already exists, it will not be overwritten.
|
||||
|
||||
When you're already using [the `rspamd/override.d/` directory][docs-rspamd-config-dropin], the file is created inside your volume and therefore persisted correctly. If you are not using `rspamd/override.d/`, you will need to persist the file yourself (otherwise it is lost on container restart).
|
||||
|
||||
An example of what a default configuration file for DKIM signing looks like can be found by expanding the example below.
|
||||
|
||||
??? example "DKIM Signing Module Configuration Examples"
|
||||
|
||||
A simple configuration could look like this:
|
||||
|
||||
```cf
|
||||
# documentation: https://rspamd.com/doc/modules/dkim_signing.html
|
||||
|
||||
enabled = true;
|
||||
|
||||
sign_authenticated = true;
|
||||
sign_local = true;
|
||||
|
||||
use_domain = "header";
|
||||
use_redis = false; # don't change unless Redis also provides the DKIM keys
|
||||
use_esld = true;
|
||||
check_pubkey = true; # you want to use this in the beginning
|
||||
|
||||
selector = "mail";
|
||||
# The path location is searched for a DKIM key with these variables:
|
||||
# - `$domain` is sourced from the MIME mail message `From` header
|
||||
# - `$selector` is configured for `mail` (as a default fallback)
|
||||
path = "/tmp/docker-mailserver/dkim/keys/$domain/$selector.private";
|
||||
|
||||
# domain specific configurations can be provided below:
|
||||
domain {
|
||||
example.com {
|
||||
path = "/tmp/docker-mailserver/rspamd/dkim/mail.private";
|
||||
selector = "mail";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
As shown next:
|
||||
|
||||
- You can add more domains into the `domain { ... }` section (in the following example: `example.com` and `example.org`).
|
||||
- A domain can also be configured with multiple selectors and keys within a `selectors [ ... ]` array (in the following example, this is done for `example.org`).
|
||||
|
||||
```cf
|
||||
# ...
|
||||
|
||||
domain {
|
||||
example.com {
|
||||
path = /tmp/docker-mailserver/rspamd/example.com/ed25519.private";
|
||||
selector = "dkim-ed25519";
|
||||
}
|
||||
example.org {
|
||||
selectors [
|
||||
{
|
||||
path = "/tmp/docker-mailserver/rspamd/dkim/example.org/rsa.private";
|
||||
selector = "dkim-rsa";
|
||||
},
|
||||
{
|
||||
path = "/tmp/docker-mailserver/rspamd/dkim/example.org/ed25519.private";
|
||||
selector = "dkim-ed25519";
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
??? warning "Support for DKIM Keys using ED25519"
|
||||
|
||||
This modern elliptic curve is supported by Rspamd, but support by third-parties for [verifying Ed25519 DKIM signatures is unreliable][dkim-ed25519-support].
|
||||
|
||||
If you sign your mail with this key type, you should include RSA as a fallback, like shown in the above example.
|
||||
|
||||
??? tip "Let Rspamd Check Your Keys"
|
||||
|
||||
When `check_pubkey = true;` is set, Rspamd will query the DNS record for each DKIM selector, verifying each public key matches the private key configured.
|
||||
|
||||
If there is a mismatch, a warning will be emitted to the Rspamd log `/var/log/mail/rspamd.log`.
|
||||
|
||||
### DNS Record { #dkim-dns }
|
||||
|
||||
When mail signed with your DKIM key is sent from your mail server, the receiver needs to check a DNS `TXT` record to verify the DKIM signature is trustworthy.
|
||||
|
||||
!!! example "Configuring DNS - DKIM record"
|
||||
|
||||
When you generated your key in the previous step, the DNS data was saved into a file `<selector>.txt` (default: `mail.txt`). Use this content to update your [DNS via Web Interface][dns::example-webui] or directly edit your [DNS Zone file][dns::wikipedia-zonefile]:
|
||||
|
||||
=== "Web Interface"
|
||||
|
||||
Create a new record:
|
||||
|
||||
| Field | Value |
|
||||
| ----- | ------------------------------------------------------------------------------ |
|
||||
| Type | `TXT` |
|
||||
| Name | `<selector>._domainkey` (_default: `mail._domainkey`_) |
|
||||
| TTL | Use the default (_otherwise [3600 seconds is appropriate][dns::digicert-ttl]_) |
|
||||
| Data | File content within `( ... )` (_formatted as advised below_) |
|
||||
|
||||
When using Rspamd, the helper script has already provided you with the contents (the "Data" field) of the DNS record you need to create - you can just copy-paste this text.
|
||||
|
||||
=== "DNS Zone file"
|
||||
|
||||
`<selector>.txt` is already formatted as a snippet for adding to your [DNS Zone file][dns::wikipedia-zonefile].
|
||||
|
||||
Just copy/paste the file contents into your existing DNS zone. The `TXT` value has been split into separate strings every 255 characters for compatibility.
|
||||
|
||||
??? info "`<selector>.txt` - Formatting the `TXT` record value correctly"
|
||||
|
||||
This file was generated for use within a [DNS zone file][dns::wikipedia-zonefile]. The file name uses the DKIM selector it was generated with (default DKIM selector is `mail`, which creates `mail.txt`_).
|
||||
|
||||
For your DNS setup, DKIM support needs to create a `TXT` record to store the public key for mail clients to use. `TXT` records with values that are longer than 255 characters need to be split into multiple parts. This is why the generated `<selector>.txt` file (_containing your public key for use with DKIM_) has multiple value parts wrapped within double-quotes between `(` and `)`.
|
||||
|
||||
A DNS web-interface may handle this separation internally instead, and [could expect the value provided all as a single line][dns::webui-dkim] instead of split. When that is required, you'll need to manually format the value as described below.
|
||||
|
||||
Your generated DNS record file (`<selector>.txt`) should look similar to this:
|
||||
|
||||
```txt
|
||||
mail._domainkey IN TXT ( "v=DKIM1; k=rsa; "
|
||||
"p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqQMMqhb1S52Rg7VFS3EC6JQIMxNDdiBmOKZvY5fiVtD3Z+yd9ZV+V8e4IARVoMXWcJWSR6xkloitzfrRtJRwOYvmrcgugOalkmM0V4Gy/2aXeamuiBuUc4esDQEI3egmtAsHcVY1XCoYfs+9VqoHEq3vdr3UQ8zP/l+FP5UfcaJFCK/ZllqcO2P1GjIDVSHLdPpRHbMP/tU1a9mNZ"
|
||||
"5QMZBJ/JuJK/s+2bp8gpxKn8rh1akSQjlynlV9NI+7J3CC7CUf3bGvoXIrb37C/lpJehS39KNtcGdaRufKauSfqx/7SxA0zyZC+r13f7ASbMaQFzm+/RRusTqozY/p/MsWx8QIDAQAB"
|
||||
) ;
|
||||
```
|
||||
|
||||
Take the content between `( ... )`, and combine all the quote wrapped content and remove the double-quotes including the white-space between them. That is your `TXT` record value, the above example would become this:
|
||||
|
||||
```txt
|
||||
v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqQMMqhb1S52Rg7VFS3EC6JQIMxNDdiBmOKZvY5fiVtD3Z+yd9ZV+V8e4IARVoMXWcJWSR6xkloitzfrRtJRwOYvmrcgugOalkmM0V4Gy/2aXeamuiBuUc4esDQEI3egmtAsHcVY1XCoYfs+9VqoHEq3vdr3UQ8zP/l+FP5UfcaJFCK/ZllqcO2P1GjIDVSHLdPpRHbMP/tU1a9mNZ5QMZBJ/JuJK/s+2bp8gpxKn8rh1akSQjlynlV9NI+7J3CC7CUf3bGvoXIrb37C/lpJehS39KNtcGdaRufKauSfqx/7SxA0zyZC+r13f7ASbMaQFzm+/RRusTqozY/p/MsWx8QIDAQAB
|
||||
```
|
||||
|
||||
To test that your new DKIM record is correct, query it with the `dig` command. The `TXT` value response should be a single line split into multiple parts wrapped in double-quotes:
|
||||
|
||||
```console
|
||||
$ dig +short TXT mail._domainkey.example.com
|
||||
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqQMMqhb1S52Rg7VFS3EC6JQIMxNDdiBmOKZvY5fiVtD3Z+yd9ZV+V8e4IARVoMXWcJWSR6xkloitzfrRtJRwOYvmrcgugOalkmM0V4Gy/2aXeamuiBuUc4esDQEI3egmtAsHcVY1XCoYfs+9VqoHEq3vdr3UQ8zP/l+FP5UfcaJFCK/ZllqcO2P1GjIDVSHLdPpRHbMP/tU1a9mNZ5QMZBJ/JuJK/s+2bp8gpxKn8rh1akSQjlynlV9NI+7J3CC7CUf3bGvoXIrb37C/lpJehS39" "KNtcGdaRufKauSfqx/7SxA0zyZC+r13f7ASbMaQFzm+/RRusTqozY/p/MsWx8QIDAQAB"
|
||||
```
|
||||
|
||||
### Troubleshooting { #dkim-debug }
|
||||
|
||||
[MxToolbox has a DKIM Verifier][mxtoolbox-dkim-verifier] that you can use to check your DKIM DNS record(s).
|
||||
|
||||
When using Rspamd, we recommend you turn on `check_pubkey = true;` in `dkim_signing.conf`. Rspamd will then check whether your private key matches your public key, and you can check possible mismatches by looking at `/var/log/mail/rspamd.log`.
|
||||
|
||||
## DMARC
|
||||
|
||||
With DMS, DMARC is pre-configured out of the box. You may disable extra and excessive DMARC checks when using Rspamd via `ENABLE_OPENDMARC=0`.
|
||||
|
||||
The only thing you need to do in order to enable DMARC on a "DNS-level" is to add new `TXT`. In contrast to [DKIM](#dkim), DMARC DNS entries do not require any keys, but merely setting the [configuration values][dmarc-howto-configtags]. You can either handcraft the entry by yourself or use one of available generators (like [this one][dmarc-tool-gca]).
|
||||
|
||||
Typically something like this should be good to start with:
|
||||
|
||||
```txt
|
||||
_dmarc.example.com. IN TXT "v=DMARC1; p=none; sp=none; fo=0; adkim=r; aspf=r; pct=100; rf=afrf; ri=86400; rua=mailto:dmarc.report@example.com; ruf=mailto:dmarc.report@example.com"
|
||||
```
|
||||
|
||||
Or a bit more strict policies (_mind `p=quarantine` and `sp=quarantine`_):
|
||||
|
||||
```txt
|
||||
_dmarc.example.com. IN TXT "v=DMARC1; p=quarantine; sp=quarantine; fo=0; adkim=r; aspf=r; pct=100; rf=afrf; ri=86400; rua=mailto:dmarc.report@example.com; ruf=mailto:dmarc.report@example.com"
|
||||
```
|
||||
|
||||
The DMARC status may not be displayed instantly due to delays in DNS (caches). Dmarcian has [a few tools][dmarcian-tools] you can use to verify your DNS records.
|
||||
|
||||
## SPF
|
||||
|
||||
!!! quote "What is SPF"
|
||||
|
||||
Sender Policy Framework (SPF) is a simple email-validation system designed to detect email spoofing by providing a mechanism to allow receiving mail exchangers to check that incoming mail from a domain comes from a host authorized by that domain's administrators.
|
||||
|
||||
[Source][wikipedia-spf]
|
||||
|
||||
!!! tip "Disabling the default SPF service `policy-spf`"
|
||||
|
||||
Set [`ENABLE_POLICYD_SPF=0`][docs-env-spf-policyd] to opt-out of the default SPF service. Advised when Rspamd is configured to handle SPF instead.
|
||||
|
||||
### Adding an SPF Record
|
||||
|
||||
To add a SPF record in your DNS, insert the following line in your DNS zone:
|
||||
|
||||
```txt
|
||||
example.com. IN TXT "v=spf1 mx ~all"
|
||||
```
|
||||
|
||||
This enables the _Softfail_ mode for SPF. You could first add this SPF record with a very low TTL. _SoftFail_ is a good setting for getting started and testing, as it lets all email through, with spams tagged as such in the mailbox.
|
||||
|
||||
After verification, you _might_ want to change your SPF record to `v=spf1 mx -all` so as to enforce the _HardFail_ policy. See <http://www.open-spf.org/SPF_Record_Syntax> for more details about SPF policies.
|
||||
|
||||
In any case, increment the SPF record's TTL to its final value.
|
||||
|
||||
### Backup MX & Secondary MX for `policyd-spf`
|
||||
|
||||
For whitelisting an IP Address from the SPF test, you can create a config file (see [`policyd-spf.conf`](https://www.linuxcertif.com/man/5/policyd-spf.conf)) and mount that file into `/etc/postfix-policyd-spf-python/policyd-spf.conf`.
|
||||
|
||||
**Example:** Create and edit a `policyd-spf.conf` file at `docker-data/dms/config/postfix-policyd-spf.conf`:
|
||||
|
||||
```conf
|
||||
debugLevel = 1
|
||||
#0(only errors)-4(complete data received)
|
||||
|
||||
skip_addresses = 127.0.0.0/8,::ffff:127.0.0.0/104,::1
|
||||
|
||||
# Preferably use IP-Addresses for whitelist lookups:
|
||||
Whitelist = 192.168.0.0/31,192.168.1.0/30
|
||||
# Domain_Whitelist = mx1.not-example.com,mx2.not-example.com
|
||||
```
|
||||
|
||||
Then add this line to `compose.yaml`:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- ./docker-data/dms/config/postfix-policyd-spf.conf:/etc/postfix-policyd-spf-python/policyd-spf.conf
|
||||
```
|
||||
|
||||
[docs-accounts]: ../account-management/overview.md#accounts
|
||||
[docs-volumes-config]: ../advanced/optional-config.md#volumes-config
|
||||
[docs-env-opendkim]: ../environment.md#enable_opendkim
|
||||
[docs-env-rspamd]: ../environment.md#enable_rspamd
|
||||
[docs-env-spf-policyd]: ../environment.md#enable_policyd_spf
|
||||
[docs-rspamd-config-dropin]: ../security/rspamd.md#manually
|
||||
[cloudflare-dkim-dmarc-spf]: https://www.cloudflare.com/learning/email-security/dmarc-dkim-spf/
|
||||
[rfc-8301]: https://datatracker.ietf.org/doc/html/rfc8301#section-3.2
|
||||
[gh-discussion::dkim-key-rotation-expiry]: https://github.com/orgs/docker-mailserver/discussions/4068#discussioncomment-9784263
|
||||
[gh-issue::dkim-length]: https://github.com/docker-mailserver/docker-mailserver/issues/1854#issuecomment-806280929
|
||||
[rspamd-docs-dkim-checks]: https://www.rspamd.com/doc/modules/dkim.html
|
||||
[rspamd-docs-dkim-signing]: https://www.rspamd.com/doc/modules/dkim_signing.html
|
||||
[dns::example-webui]: https://www.vultr.com/docs/introduction-to-vultr-dns/
|
||||
[dns::digicert-ttl]: https://www.digicert.com/faq/dns/what-is-ttl
|
||||
[dns::wikipedia-zonefile]: https://en.wikipedia.org/wiki/Zone_file
|
||||
[dns::webui-dkim]: https://serverfault.com/questions/763815/route-53-doesnt-allow-adding-dkim-keys-because-length-is-too-long
|
||||
[dkim-ed25519-support]: https://serverfault.com/questions/1023674/is-ed25519-well-supported-for-the-dkim-validation/1074545#1074545
|
||||
[dkim-verification-expiry-refusal]: https://mxtoolbox.com/problem/dkim/dkim-signature-expiration
|
||||
[mxtoolbox-dkim-verifier]: https://mxtoolbox.com/dkim.aspx
|
||||
[dmarc-howto-configtags]: https://github.com/internetstandards/toolbox-wiki/blob/master/DMARC-how-to.md#overview-of-dmarc-configuration-tags
|
||||
[dmarc-tool-gca]: https://dmarcguide.globalcyberalliance.org
|
||||
[dmarcian-tools]: https://dmarcian.com/dmarc-tools/
|
||||
[wikipedia-dkim]: https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail
|
||||
[wikipedia-spf]: https://en.wikipedia.org/wiki/Sender_Policy_Framework
|
|
@ -1,36 +0,0 @@
|
|||
---
|
||||
title: 'Best Practices | DMARC'
|
||||
hide:
|
||||
- toc # Hide Table of Contents for this page
|
||||
---
|
||||
|
||||
More information at [DMARC Guide][dmarc-howto].
|
||||
|
||||
## Enabling DMARC
|
||||
|
||||
In `docker-mailserver`, DMARC is pre-configured out of the box. The only thing you need to do in order to enable it, is to add new `TXT` entry to your DNS.
|
||||
|
||||
In contrast with [DKIM][docs-dkim], the DMARC DNS entry does not require any keys, but merely setting the [configuration values][dmarc-howto::configtags]. You can either handcraft the entry by yourself or use one of available generators (like [this one][dmarc-tool::gca]).
|
||||
|
||||
Typically something like this should be good to start with (_don't forget to replace `@example.com` to your actual domain_):
|
||||
|
||||
```
|
||||
_dmarc.example.com. IN TXT "v=DMARC1; p=none; rua=mailto:dmarc.report@example.com; ruf=mailto:dmarc.report@example.com; sp=none; ri=86400"
|
||||
```
|
||||
|
||||
Or a bit more strict policies (_mind `p=quarantine` and `sp=quarantine`_):
|
||||
|
||||
```
|
||||
_dmarc IN TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc.report@example.com; ruf=mailto:dmarc.report@example.com; fo=0; adkim=r; aspf=r; pct=100; rf=afrf; ri=86400; sp=quarantine"
|
||||
```
|
||||
|
||||
DMARC status is not being displayed instantly in Gmail for instance. If you want to check it directly after DNS entries, you can use some services around the Internet such as from [Global Cyber Alliance][dmarc-tool::gca] or [RedSift][dmarc-tool::redsift]. In other cases, email clients will show "DMARC: PASS" in ~1 day or so.
|
||||
|
||||
Reference: [#1511][github-issue-1511]
|
||||
|
||||
[docs-dkim]: ./dkim.md
|
||||
[github-issue-1511]: https://github.com/docker-mailserver/docker-mailserver/issues/1511
|
||||
[dmarc-howto]: https://github.com/internetstandards/toolbox-wiki/blob/master/DMARC-how-to.md
|
||||
[dmarc-howto::configtags]: https://github.com/internetstandards/toolbox-wiki/blob/master/DMARC-how-to.md#overview-of-dmarc-configuration-tags
|
||||
[dmarc-tool::gca]: https://dmarcguide.globalcyberalliance.org
|
||||
[dmarc-tool::redsift]: https://ondmarc.redsift.com
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
title: 'Best practices | MTA-STS'
|
||||
hide:
|
||||
- toc # Hide Table of Contents for this page
|
||||
---
|
||||
|
||||
MTA-STS is an optional mechanism for a domain to signal support for STARTTLS.
|
||||
|
||||
- It can be used to prevent man-in-the-middle-attacks from hiding STARTTLS support that would force DMS to send outbound mail through an insecure connection.
|
||||
- MTA-STS is an alternative to DANE without the need of DNSSEC.
|
||||
- MTA-STS is supported by some of the biggest mail providers like Google Mail and Outlook.
|
||||
|
||||
## Supporting MTA-STS for outbound mail
|
||||
|
||||
Enable this feature via the ENV setting [`ENABLE_MTA_STS=1`](../environment.md#enable_mta_sts).
|
||||
|
||||
!!! warning "If you have configured DANE"
|
||||
|
||||
Enabling MTA-STS will by default override DANE if both are configured for a domain.
|
||||
|
||||
This can be partially addressed by configuring a dane-only policy resolver before the MTA-STS entry in `smtp_tls_policy_maps`. See the [`postfix-mta-sts-resolver` documentation][postfix-mta-sts-resolver::dane] for further details.
|
||||
|
||||
[postfix-mta-sts-resolver::dane]: https://github.com/Snawoot/postfix-mta-sts-resolver#warning-mta-sts-policy-overrides-dane-tls-authentication
|
||||
|
||||
## Supporting MTA-STS for inbound mail
|
||||
|
||||
While this feature in DMS supports ensuring STARTTLS is used when mail is sent to another mail server, you may setup similar for mail servers sending mail to DMS.
|
||||
|
||||
This requires configuring your DNS and hosting the MTA-STS policy file via a webserver. A good introduction can be found on [dmarcian.com](https://dmarcian.com/mta-sts/).
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
---
|
||||
title: 'Best Practices | SPF'
|
||||
hide:
|
||||
- toc # Hide Table of Contents for this page
|
||||
---
|
||||
|
||||
From [Wikipedia](https://en.wikipedia.org/wiki/Sender_Policy_Framework):
|
||||
|
||||
!!! quote
|
||||
Sender Policy Framework (SPF) is a simple email-validation system designed to detect email spoofing by providing a mechanism to allow receiving mail exchangers to check that incoming mail from a domain comes from a host authorized by that domain's administrators. The list of authorized sending hosts for a domain is published in the Domain Name System (DNS) records for that domain in the form of a specially formatted TXT record. Email spam and phishing often use forged "from" addresses, so publishing and checking SPF records can be considered anti-spam techniques.
|
||||
|
||||
!!! note
|
||||
For a more technical review: https://github.com/internetstandards/toolbox-wiki/blob/master/SPF-how-to.md
|
||||
|
||||
## Add a SPF Record
|
||||
|
||||
To add a SPF record in your DNS, insert the following line in your DNS zone:
|
||||
|
||||
```txt
|
||||
; MX record must be declared for SPF to work
|
||||
example.com. IN MX 1 mail.example.com.
|
||||
|
||||
; SPF record
|
||||
example.com. IN TXT "v=spf1 mx ~all"
|
||||
```
|
||||
|
||||
This enables the _Softfail_ mode for SPF. You could first add this SPF record with a very low TTL.
|
||||
|
||||
_SoftFail_ is a good setting for getting started and testing, as it lets all email through, with spams tagged as such in the mailbox.
|
||||
|
||||
After verification, you _might_ want to change your SPF record to `v=spf1 mx -all` so as to enforce the _HardFail_ policy. See http://www.open-spf.org/SPF_Record_Syntax for more details about SPF policies.
|
||||
|
||||
In any case, increment the SPF record's TTL to its final value.
|
||||
|
||||
## Backup MX, Secondary MX
|
||||
|
||||
For whitelisting an IP Address from the SPF test, you can create a config file (see [`policyd-spf.conf`](https://www.linuxcertif.com/man/5/policyd-spf.conf)) and mount that file into `/etc/postfix-policyd-spf-python/policyd-spf.conf`.
|
||||
|
||||
**Example:**
|
||||
|
||||
Create and edit a `policyd-spf.conf` file at `docker-data/dms/config/postfix-policyd-spf.conf`:
|
||||
|
||||
```conf
|
||||
debugLevel = 1
|
||||
#0(only errors)-4(complete data received)
|
||||
|
||||
skip_addresses = 127.0.0.0/8,::ffff:127.0.0.0/104,::1
|
||||
|
||||
# Preferably use IP-Addresses for whitelist lookups:
|
||||
Whitelist = 192.168.0.0/31,192.168.1.0/30
|
||||
# Domain_Whitelist = mx1.not-example.com,mx2.not-example.com
|
||||
```
|
||||
|
||||
Then add this line to `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- ./docker-data/dms/config/postfix-policyd-spf.conf:/etc/postfix-policyd-spf-python/policyd-spf.conf
|
||||
```
|
|
@ -10,7 +10,31 @@ This page contains valuable information when it comes to resolving issues you en
|
|||
|
||||
Please consider contributing solutions to the [FAQ][docs-faq] :heart:
|
||||
|
||||
## Preliminary Information
|
||||
## Preliminary Checks
|
||||
|
||||
- Check that all published DMS ports are actually open and not blocked by your ISP / hosting provider.
|
||||
- SSL errors are likely the result of a wrong setup on the user side and not caused by DMS itself.
|
||||
- Ensure that you have correctly started DMS. Many problems related to configuration are due to this.
|
||||
|
||||
!!! danger "Correctly starting DMS"
|
||||
|
||||
Use the [`--force-recreate`][docker-docs::force-recreate] option to avoid configuration mishaps: `docker compose up --force-recreate`
|
||||
|
||||
Alternatively, always use `docker compose down` to stop DMS. **Do not** rely on `CTRL + C`, `docker compose stop`, or `docker compose restart`.
|
||||
|
||||
---
|
||||
|
||||
DMS setup scripts are run when a container starts, but may fail to work properly if you do the following:
|
||||
|
||||
- Stopping a container with commands like: `docker stop` or `docker compose up` stopped via `CTRL + C` instead of `docker compose down`.
|
||||
- Restarting a container.
|
||||
|
||||
Volumes persist data across container instances, however the same container instance will keep internal changes not stored in a volume until the container is removed.
|
||||
|
||||
Due to this, DMS setup scripts may modify configuration it has already modified in the past.
|
||||
|
||||
- This is brittle as some changes are naive by assuming they are applied to the original configs from the image.
|
||||
- Volumes in `compose.yaml` are expected to persist any important data. Thus it should be safe to throwaway the container created each time, avoiding this config problem.
|
||||
|
||||
### Mail sent from DMS does not arrive at destination
|
||||
|
||||
|
@ -22,27 +46,92 @@ Some service providers block outbound traffic on port 25. Common hosting provide
|
|||
|
||||
These links may advise how the provider can unblock the port through additional services offered, or via a support ticket request.
|
||||
|
||||
### Mail sent to DMS does not get delivered to user
|
||||
|
||||
Common logs related to this are:
|
||||
|
||||
- `warning: do not list domain domain.fr in BOTH mydestination and virtual_mailbox_domains`
|
||||
- `Recipient address rejected: User unknown in local recipient table`
|
||||
|
||||
If your logs look like this, you likely have [assigned the same FQDN to the DMS `hostname` and your mail accounts][gh-issues::dms-fqdn-misconfigured] which is not supported by default. You can either adjust your DMS `hostname` or follow [this FAQ advice][docs::faq-bare-domain]
|
||||
|
||||
It is also possible that [DMS services are temporarily unavailable][gh-issues::dms-services-unavailable] when configuration changes are detected, producing the 2nd error. Certificate updates may be a less obvious trigger.
|
||||
|
||||
## Steps for Debugging DMS
|
||||
|
||||
1. **Increase log verbosity**: Very helpful for troubleshooting problems during container startup. Set the environment variable [`LOG_LEVEL`][docs-environment-log-level] to `debug` or `trace`.
|
||||
2. **Use error logs as a search query**: Try finding an _existing issue_ or _search engine result_ from any errors in your container log output. Often you'll find answers or more insights. If you still need to open an issue, sharing links from your search may help us assist you. The mail server log can be acquired by running `docker log <CONTAINER NAME>` (_or `docker logs -f <CONTAINER NAME>` if you want to follow the log_).
|
||||
3. **Understand the basics of mail servers**: Especially for beginners, make sure you read our [Introduction][docs-introduction] and [Usage][docs-usage] articles.
|
||||
4. **Search the whole FAQ**: Our [FAQ][docs-faq] contains answers for common problems. Make sure you go through the list.
|
||||
5. **Reduce the scope**: Ensure that you can run a basic setup of DMS first. Then incrementally restore parts of your original configuration until the problem is reproduced again. If you're new to DMS, it is common to find the cause is misunderstanding how to configure a minimal setup.
|
||||
2. **Use error logs as a search query**: Try [finding an _existing issue_][gh-issues] or _search engine result_ from any errors in your container log output. Often you'll find answers or more insights. If you still need to open an issue, sharing links from your search may help us assist you. The mail server log can be acquired by running `docker log <CONTAINER NAME>` (_or `docker logs -f <CONTAINER NAME>` if you want to follow the log_).
|
||||
3. **Inspect the logs of the service that is failing**: We provide a dedicated paragraph on this topic [further down below](#logs).
|
||||
4. **Understand the basics of mail servers**: Especially for beginners, make sure you read our [Introduction][docs-introduction] and [Usage][docs-usage] articles.
|
||||
5. **Search the whole FAQ**: Our [FAQ][docs-faq] contains answers for common problems. Make sure you go through the list.
|
||||
6. **Reduce the scope**: Ensure that you can run a basic setup of DMS first. Then incrementally restore parts of your original configuration until the problem is reproduced again. If you're new to DMS, it is common to find the cause is misunderstanding how to configure a minimal setup.
|
||||
|
||||
### Debug a running container
|
||||
|
||||
To get a shell inside the container run: `docker exec -it <CONTAINER NAME> bash`.
|
||||
#### General
|
||||
|
||||
If you need more flexibility than `docker logs` offers, within the container `/var/log/mail/mail.log` and `/var/log/supervisor/` are the most useful locations to get relevant DMS logs. Use the `tail` or `cat` commands to view their contents.
|
||||
To get a shell inside the container run: `docker exec -it <CONTAINER NAME> bash`. To install additional software, run:
|
||||
|
||||
To install additional software:
|
||||
1. `apt-get update` to update repository metadata.
|
||||
2. `apt-get install <PACKAGE>` to install a package, e.g., `apt-get install neovim` if you want to use NeoVim instead of `nano` (which is shipped by default).
|
||||
|
||||
- `apt-get update` is needed to update repository metadata.
|
||||
- `apt-get install <PACKAGE>`
|
||||
- For example if you need a text editor, `nano` is a good package choice for beginners.
|
||||
#### Logs
|
||||
|
||||
If you need more flexibility than what the `docker logs` command offers, then the most useful locations to get relevant DMS logs within the container are:
|
||||
|
||||
- `/var/log/mail/<SERVICE>.log`
|
||||
- `/var/log/supervisor/<SERVICE>.log`
|
||||
|
||||
You may use `nano` (a text editor) to edit files, while `less` (a file viewer) and `tail`/`cat` are useful tools to inspect the contents of logs.
|
||||
|
||||
## Compatibility
|
||||
|
||||
It's possible that the issue you're experiencing is due to a compatibility conflict.
|
||||
|
||||
This could be from outdated software, or running a system that isn't able to provide you newer software and kernels. You may want to verify if you can reproduce the issue on a system that is not affected by these concerns.
|
||||
|
||||
### Network
|
||||
|
||||
- Misconfigured network connections can cause the client IP address to be proxied through a docker network gateway IP, or a [service that acts on behalf of connecting clients for logins][gh-discuss-roundcube-fail2ban] where the connections client IP appears to be only from that service (eg: Container IP) instead. This can relay the wrong information to other services (eg: monitoring like Fail2Ban, SPF verification) causing unexpected failures.
|
||||
- **`userland-proxy`:** Prior to Docker `v23`, [changing the `userland-proxy` setting did not reliably remove NAT rules][network::docker-userlandproxy].
|
||||
- **UFW / firewalld:** Some users expect only their firewall frontend to manage the firewall rules, but these will be bypassed when Docker publishes a container port (_as there is no integration between the two_).
|
||||
- **`iptables` / `nftables`:**
|
||||
- Docker [only manages the NAT rules via `iptables`][network::docker-nftables], relying on compatibility shims for supporting the successor `nftables`. Internally DMS expects `nftables` support on the host kernel for services like Fail2Ban to function correctly.
|
||||
- [Kernels older than 5.2 may affect management of NAT rules via `nftables`][network::kernel-nftables]. Other software outside of DMS may also manipulate these rules, such as firewall frontends.
|
||||
- **IPv6:**
|
||||
- Requires [additional configuration][docs-ipv6] to prevent or properly support IPv6 connections (eg: Preserving the Client IP).
|
||||
- Support in 2023 is still considered experimental. You are advised to use at least Docker Engine `v23` (2023Q1).
|
||||
- Various networking bug fixes have been addressed since the initial IPv6 support arrived in Docker Engine `v20.10.0` (2020Q4).
|
||||
|
||||
### System
|
||||
|
||||
- **macOS:** DMS has limited support for macOS. Often an issue encountered is due to permissions related to the `volumes` config in `compose.yaml`. You may have luck [trying `gRPC FUSE`][gh-macos-support] as the file sharing implementation; [`VirtioFS` is the successor][docker-macos-virtiofs] but presently appears incompatible with DMS.
|
||||
- **Kernel:** Some systems provide [kernels with modifications (_replacing defaults and backporting patches_)][network::kernels-modified] to support running legacy software or kernels, complicating compatibility. This can be commonly experienced with products like NAS.
|
||||
- **CGroups v2:** Hosts running older kernels (prior to 5.2) and systemd (prior to v244) are not likely to leverage cgroup v2, or have not defaulted to the cgroup v2 `unified` hierarchy. Not meeting this baseline may influence the behavior of your DMS container, even with the latest Docker Engine installed.
|
||||
- **Container runtime:** Docker and Podman for example have subtle differences. DMS docs are primarily focused on Docker, but we try to document known issues where relevant.
|
||||
- **Rootless containers:** Introduces additional differences in behavior or requirements:
|
||||
- cgroup v2 is required for supporting rootless containers.
|
||||
- Differences such as for container networking which may further affect support for IPv6 and preserving the client IP (Remote address). Example with Docker rootless are [binding a port to a specific interface][docker-rootless-interface] and the choice of [port forwarding driver][docs::fail2ban::rootless-portdriver].
|
||||
|
||||
[network::docker-userlandproxy]: https://github.com/moby/moby/issues/44721
|
||||
[network::docker-nftables]: https://github.com/moby/moby/issues/26824
|
||||
[network::kernels-modified]: https://github.com/docker-mailserver/docker-mailserver/pull/2662#issuecomment-1168435970
|
||||
[network::kernel-nftables]: https://unix.stackexchange.com/questions/596493/can-nftables-and-iptables-ip6tables-rules-be-applied-at-the-same-time-if-so-wh/596497#596497
|
||||
|
||||
[docs-faq]: ../faq.md
|
||||
[docs-environment-log-level]: ./environment.md#log_level
|
||||
[docs-faq]: ../faq.md
|
||||
[docs::faq-bare-domain]: ../faq.md#can-i-use-a-nakedbare-domain-ie-no-hostname
|
||||
[docs-ipv6]: ./advanced/ipv6.md
|
||||
[docs-introduction]: ../introduction.md
|
||||
[docs::fail2ban::rootless-portdriver]: ./security/fail2ban.md#rootless-container
|
||||
[docs-usage]: ../usage.md
|
||||
|
||||
[gh-issues]: https://github.com/docker-mailserver/docker-mailserver/issues
|
||||
[gh-issues::dms-fqdn-misconfigured]: https://github.com/docker-mailserver/docker-mailserver/issues/3679#issuecomment-1837609043
|
||||
[gh-issues::dms-services-unavailable]: https://github.com/docker-mailserver/docker-mailserver/issues/3679#issuecomment-1848083358
|
||||
[gh-macos-support]: https://github.com/docker-mailserver/docker-mailserver/issues/3648#issuecomment-1822774080
|
||||
[gh-discuss-roundcube-fail2ban]: https://github.com/orgs/docker-mailserver/discussions/3273#discussioncomment-5654603
|
||||
|
||||
[docker-rootless-interface]: https://github.com/moby/moby/issues/45742
|
||||
[docker-macos-virtiofs]: https://www.docker.com/blog/speed-boost-achievement-unlocked-on-docker-desktop-4-6-for-mac/
|
||||
[docker-docs::force-recreate]: https://docs.docker.com/compose/reference/up/
|
||||
|
|
|
@ -10,10 +10,10 @@ title: Environment Variables
|
|||
|
||||
##### OVERRIDE_HOSTNAME
|
||||
|
||||
If you can't set your hostname (_eg: you're in a container platform that doesn't let you_) specify it via this environment variable. It will have priority over `docker run --hostname`, or the equivalent `hostname:` field in `docker-compose.yml`.
|
||||
If you can't set your hostname (_eg: you're in a container platform that doesn't let you_) specify it via this environment variable. It will have priority over `docker run --hostname`, or the equivalent `hostname:` field in `compose.yaml`.
|
||||
|
||||
- **empty** => Uses the `hostname -f` command to get canonical hostname for `docker-mailserver` to use.
|
||||
- => Specify an FQDN (fully-qualified domain name) to serve mail for. The hostname is required for `docker-mailserver` to function correctly.
|
||||
- **empty** => Uses the `hostname -f` command to get canonical hostname for DMS to use.
|
||||
- => Specify an FQDN (fully-qualified domain name) to serve mail for. The hostname is required for DMS to function correctly.
|
||||
|
||||
##### LOG_LEVEL
|
||||
|
||||
|
@ -33,23 +33,32 @@ Here you can adjust the [log-level for Supervisor](http://supervisord.org/loggin
|
|||
|
||||
The log-level will show everything in its class and above.
|
||||
|
||||
##### ONE_DIR
|
||||
##### DMS_VMAIL_UID
|
||||
|
||||
- 0 => state in default directories.
|
||||
- **1** => consolidate all states into a single directory (`/var/mail-state`) to allow persistence using docker volumes. See the [related FAQ entry][docs-faq-onedir] for more information.
|
||||
Default: 5000
|
||||
|
||||
The User ID assigned to the static vmail user for `/var/mail` (_Mail storage managed by Dovecot_).
|
||||
|
||||
!!! warning "Incompatible UID values"
|
||||
|
||||
- A value of [`0` (root) is not compatible][gh-issue::vmail-uid-cannot-be-root].
|
||||
- This feature will attempt to adjust the `uid` for the `docker` user (`/etc/passwd`), hence the error emitted to logs if the UID is already assigned to another user.
|
||||
- The feature appears to work with other UID values that are already assigned in `/etc/passwd`, even though Dovecot by default has a setting for the minimum UID as `500`.
|
||||
|
||||
##### DMS_VMAIL_GID
|
||||
|
||||
Default: 5000
|
||||
|
||||
The Group ID assigned to the static vmail group for `/var/mail` (_Mail storage managed by Dovecot_).
|
||||
|
||||
##### ACCOUNT_PROVISIONER
|
||||
|
||||
Configures the provisioning source of user accounts (including aliases) for user queries and authentication by services managed by DMS (_Postfix and Dovecot_).
|
||||
Configures the [provisioning source of user accounts][docs::account-management::overview] (including aliases) for user queries and authentication by services managed by DMS (_Postfix and Dovecot_).
|
||||
|
||||
User provisioning via OIDC is planned for the future, see [this tracking issue](https://github.com/docker-mailserver/docker-mailserver/issues/2713).
|
||||
|
||||
- **empty** => use FILE
|
||||
- **FILE** => use local files
|
||||
- LDAP => use LDAP authentication
|
||||
- OIDC => use OIDC authentication (**not yet implemented**)
|
||||
- FILE => use local files (this is used as the default)
|
||||
|
||||
A second container for the ldap service is necessary (e.g. [docker-openldap](https://github.com/osixia/docker-openldap))
|
||||
LDAP requires an external service (e.g. [`bitnami/openldap`](https://hub.docker.com/r/bitnami/openldap/)).
|
||||
|
||||
##### PERMIT_DOCKER
|
||||
|
||||
|
@ -96,6 +105,15 @@ This enables DNS block lists in _Postscreen_. If you want to know which lists we
|
|||
- **0** => DNS block lists are disabled
|
||||
- 1 => DNS block lists are enabled
|
||||
|
||||
##### ENABLE_MTA_STS
|
||||
|
||||
Enables MTA-STS support for outbound mail.
|
||||
|
||||
- **0** => Disabled
|
||||
- 1 => Enabled
|
||||
|
||||
See [MTA-STS](best-practices/mta-sts.md) for further explanation.
|
||||
|
||||
##### ENABLE_OPENDKIM
|
||||
|
||||
Enables the OpenDKIM service.
|
||||
|
@ -110,11 +128,23 @@ Enables the OpenDMARC service.
|
|||
- **1** => Enabled
|
||||
- 0 => Disabled
|
||||
|
||||
##### ENABLE_POLICYD_SPF
|
||||
|
||||
Enabled `policyd-spf` in Postfix's configuration. You will likely want to set this to `0` in case you're using Rspamd ([`ENABLE_RSPAMD=1`](#enable_rspamd)).
|
||||
|
||||
- 0 => Disabled
|
||||
- **1** => Enabled
|
||||
|
||||
##### ENABLE_POP3
|
||||
|
||||
- **empty** => POP3 service disabled
|
||||
- **0** => POP3 service disabled
|
||||
- 1 => Enables POP3 service
|
||||
|
||||
##### ENABLE_IMAP
|
||||
|
||||
- 0 => Disabled
|
||||
- **1** => Enabled
|
||||
|
||||
##### ENABLE_CLAMAV
|
||||
|
||||
- **0** => ClamAV is disabled
|
||||
|
@ -125,7 +155,7 @@ Enables the OpenDMARC service.
|
|||
- **0** => fail2ban service disabled
|
||||
- 1 => Enables fail2ban service
|
||||
|
||||
If you enable Fail2Ban, don't forget to add the following lines to your `docker-compose.yml`:
|
||||
If you enable Fail2Ban, don't forget to add the following lines to your `compose.yaml`:
|
||||
|
||||
``` BASH
|
||||
cap_add:
|
||||
|
@ -172,11 +202,11 @@ Please read [the SSL page in the documentation][docs-tls] for more information.
|
|||
Configures the handling of creating mails with forged sender addresses.
|
||||
|
||||
- **0** => (not recommended) Mail address spoofing allowed. Any logged in user may create email messages with a [forged sender address](https://en.wikipedia.org/wiki/Email_spoofing).
|
||||
- 1 => Mail spoofing denied. Each user may only send with his own or his alias addresses. Addresses with [extension delimiters](http://www.postfix.org/postconf.5.html#recipient_delimiter) are not able to send messages.
|
||||
- 1 => Mail spoofing denied. Each user may only send with their own or their alias addresses. Addresses with [extension delimiters](http://www.postfix.org/postconf.5.html#recipient_delimiter) are not able to send messages.
|
||||
|
||||
##### ENABLE_SRS
|
||||
|
||||
Enables the Sender Rewriting Scheme. SRS is needed if `docker-mailserver` acts as forwarder. See [postsrsd](https://github.com/roehling/postsrsd/blob/master/README.md#sender-rewriting-scheme-crash-course) for further explanation.
|
||||
Enables the Sender Rewriting Scheme. SRS is needed if DMS acts as forwarder. See [postsrsd](https://github.com/roehling/postsrsd/blob/main/README.rst) for further explanation.
|
||||
|
||||
- **0** => Disabled
|
||||
- 1 => Enabled
|
||||
|
@ -204,9 +234,9 @@ Provide any valid URI. Examples:
|
|||
- `lmtps:inet:<host>:<port>` (secure lmtp with starttls)
|
||||
- `lmtp:<kopano-host>:2003` (use kopano as mailstore)
|
||||
|
||||
##### POSTFIX\_MAILBOX\_SIZE\_LIMIT
|
||||
##### POSTFIX_MAILBOX_SIZE_LIMIT
|
||||
|
||||
Set the mailbox size limit for all users. If set to zero, the size will be unlimited (default).
|
||||
Set the mailbox size limit for all users. If set to zero, the size will be unlimited (default). Size is in bytes.
|
||||
|
||||
- **empty** => 0 (no limit)
|
||||
|
||||
|
@ -217,9 +247,9 @@ Set the mailbox size limit for all users. If set to zero, the size will be unlim
|
|||
|
||||
See [mailbox quota][docs-accounts-quota].
|
||||
|
||||
##### POSTFIX\_MESSAGE\_SIZE\_LIMIT
|
||||
##### POSTFIX_MESSAGE_SIZE_LIMIT
|
||||
|
||||
Set the message size limit for all users. If set to zero, the size will be unlimited (not recommended!)
|
||||
Set the message size limit for all users. If set to zero, the size will be unlimited (not recommended!). Size is in bytes.
|
||||
|
||||
- **empty** => 10240000 (~10 MB)
|
||||
|
||||
|
@ -265,7 +295,14 @@ Customize the update check interval. Number + Suffix. Suffix must be 's' for sec
|
|||
- sdbox => (experimental) uses Dovecot high-performance mailbox format, one file contains one message
|
||||
- mdbox ==> (experimental) uses Dovecot high-performance mailbox format, multiple messages per file and multiple files per box
|
||||
|
||||
This option has been added in November 2019. Using other format than Maildir is considered as experimental in docker-mailserver and should only be used for testing purpose. For more details, please refer to [Dovecot Documentation](https://wiki2.dovecot.org/MailboxFormat).
|
||||
This option has been added in November 2019. Using other format than Maildir is considered as experimental in docker-mailserver and should only be used for testing purpose. For more details, please refer to [Dovecot Documentation](https://doc.dovecot.org/admin_manual/mailbox_formats/#mailbox-formats).
|
||||
|
||||
##### POSTFIX_REJECT_UNKNOWN_CLIENT_HOSTNAME
|
||||
|
||||
If enabled, employs `reject_unknown_client_hostname` to sender restrictions in Postfix's configuration.
|
||||
|
||||
- **0** => Disabled
|
||||
- 1 => Enabled
|
||||
|
||||
##### POSTFIX_INET_PROTOCOLS
|
||||
|
||||
|
@ -285,25 +322,49 @@ Note: More information at <https://dovecot.org/doc/dovecot-example.conf>
|
|||
|
||||
##### MOVE_SPAM_TO_JUNK
|
||||
|
||||
When enabled, e-mails marked with the
|
||||
- 0 => Spam messages will be delivered to the inbox.
|
||||
- **1** => Spam messages will be delivered to the Junk mailbox.
|
||||
|
||||
1. `X-Spam: Yes` header added by Rspamd
|
||||
2. `X-Spam-Flag: YES` header added by SpamAssassin (requires [`SPAMASSASSIN_SPAM_TO_INBOX=1`](#spamassassin_spam_to_inbox))
|
||||
Routes mail identified as spam into the recipient(s) Junk mailbox (_a specialized folder for junk associated to the [special-use flag `\Junk`][docs::dovecot::special-use-flag], handled via a Dovecot sieve script internally_).
|
||||
|
||||
will be automatically moved to the Junk folder (with the help of a Sieve script).
|
||||
[docs::dovecot::special-use-flag]: ../examples/use-cases/imap-folders.md
|
||||
|
||||
- 0 => Spam messages will be delivered in the mailbox.
|
||||
- **1** => Spam messages will be delivered in the `Junk` folder.
|
||||
!!! info
|
||||
|
||||
Mail is received as spam when it has been marked with either header:
|
||||
|
||||
- `X-Spam: Yes` (_added by Rspamd_)
|
||||
- `X-Spam-Flag: YES` (_added by SpamAssassin - requires [`SPAMASSASSIN_SPAM_TO_INBOX=1`](#spamassassin_spam_to_inbox)_)
|
||||
|
||||
##### MARK_SPAM_AS_READ
|
||||
|
||||
- **0** => disabled
|
||||
- 1 => Spam messages will be marked as read
|
||||
|
||||
Enable to treat received spam as "read" (_avoids notification to MUA client of new mail_).
|
||||
|
||||
!!! info
|
||||
|
||||
Mail is received as spam when it has been marked with either header:
|
||||
|
||||
- `X-Spam: Yes` (_added by Rspamd_)
|
||||
- `X-Spam-Flag: YES` (_added by SpamAssassin - requires [`SPAMASSASSIN_SPAM_TO_INBOX=1`](#spamassassin_spam_to_inbox)_)
|
||||
|
||||
##### SPAM_SUBJECT
|
||||
|
||||
This variable defines a prefix for e-mails tagged with the `X-Spam: Yes` (Rspamd) or `X-Spam-Flag: YES` (SpamAssassin/Amavis) header.
|
||||
|
||||
Default: empty (no prefix will be added to e-mails)
|
||||
|
||||
??? example "Including trailing white-space"
|
||||
|
||||
Add trailing white-space by quote wrapping the value: `SPAM_SUBJECT='[SPAM] '`
|
||||
|
||||
#### Rspamd
|
||||
|
||||
##### ENABLE_RSPAMD
|
||||
|
||||
Enable or disable Rspamd.
|
||||
|
||||
!!! warning "Current State"
|
||||
|
||||
Rspamd-support is under active development. Be aware that breaking changes can happen at any time. To get more information, see [the detailed documentation page for Rspamd][docs-rspamd].
|
||||
Enable or disable [Rspamd][docs-rspamd].
|
||||
|
||||
- **0** => disabled
|
||||
- 1 => enabled
|
||||
|
@ -328,14 +389,39 @@ The purpose of this setting is to opt-out of starting an internal Redis instance
|
|||
- 0 => Disabled
|
||||
- 1 => Enabled
|
||||
|
||||
##### RSPAMD_CHECK_AUTHENTICATED
|
||||
|
||||
This settings controls whether checks should be performed on emails coming from authenticated users (i.e. most likely outgoing emails). The default value is `0` in order to align better with SpamAssassin. **We recommend** reading through [the Rspamd documentation on scanning outbound emails][rspamd-scanning-outbound] though to decide for yourself whether you need and want this feature.
|
||||
|
||||
!!! note "Not all checks and actions are disabled"
|
||||
|
||||
DKIM signing of e-mails will still happen.
|
||||
|
||||
- **0** => No checks will be performed for authenticated users
|
||||
- 1 => All default checks will be performed for authenticated users
|
||||
|
||||
[rspamd-scanning-outbound]: https://rspamd.com/doc/tutorials/scanning_outbound.html
|
||||
|
||||
##### RSPAMD_GREYLISTING
|
||||
|
||||
Controls whether the [Rspamd Greylisting module][rspamd-greylisting-module] is enabled. This module can further assist in avoiding spam emails by [greylisting] e-mails with a certain spam score.
|
||||
|
||||
- **0** => Disabled
|
||||
- 1 => Enabled
|
||||
|
||||
[rspamd-greylisting-module]: https://rspamd.com/doc/modules/greylisting.html
|
||||
[greylisting]: https://en.wikipedia.org/wiki/Greylisting_(email)
|
||||
|
||||
##### RSPAMD_LEARN
|
||||
|
||||
When enabled,
|
||||
|
||||
1. the "[autolearning][rspamd-autolearn]" feature is turned on;
|
||||
2. the Bayes classifier will be trained when moving mails from or to the Junk folder (with the help of Sieve scripts).
|
||||
2. the Bayes classifier will be trained (with the help of Sieve scripts) when moving mails
|
||||
1. from anywhere to the `Junk` folder (learning this email as spam);
|
||||
2. from the `Junk` folder into the `INBOX` (learning this email as ham).
|
||||
|
||||
!!! attention
|
||||
!!! warning "Attention"
|
||||
|
||||
As of now, the spam learning database is global (i.e. available to all users). If one user deliberately trains it with malicious data, then it will ruin your detection rate.
|
||||
|
||||
|
@ -346,6 +432,32 @@ When enabled,
|
|||
- **0** => Disabled
|
||||
- 1 => Enabled
|
||||
|
||||
##### RSPAMD_HFILTER
|
||||
|
||||
Can be used to enable or disable the [Hfilter group module][rspamd-docs-hfilter-group-module]. This is used by DMS to adjust the `HFILTER_HOSTNAME_UNKNOWN` symbol, increasing its default weight to act similar to Postfix's `reject_unknown_client_hostname`, without the need to outright reject a message.
|
||||
|
||||
- 0 => Disabled
|
||||
- **1** => Enabled
|
||||
|
||||
[rspamd-docs-hfilter-group-module]: https://www.rspamd.com/doc/modules/hfilter.html
|
||||
|
||||
##### RSPAMD_HFILTER_HOSTNAME_UNKNOWN_SCORE
|
||||
|
||||
Can be used to control the score when the [`HFILTER_HOSTNAME_UNKNOWN` symbol](#rspamd_hfilter) applies. A higher score is more punishing. Setting it to 15 (the default score for rejecting an e-mail) is equivalent to rejecting the email when the check fails.
|
||||
|
||||
Default: 6 (which corresponds to the `add_header` action)
|
||||
|
||||
|
||||
##### RSPAMD_NEURAL
|
||||
|
||||
Can be used to enable or disable the [Neural network module][rspamd-docs-neural-network]. This is an experimental anti-spam weigh method using three neural networks in the configuration added here. As far as we can tell it trains itself by using other modules to find out what spam is. It will take a while (a week or more) to train its first neural network. The config trains new networks all the time and discards old networks.
|
||||
Since it is experimental, it is switched off by default.
|
||||
|
||||
- **0** => Disabled
|
||||
- 1 => Enabled
|
||||
|
||||
[rspamd-docs-neural-network]: https://www.rspamd.com/doc/modules/neural.html
|
||||
|
||||
#### Reports
|
||||
|
||||
##### PFLOGSUMM_TRIGGER
|
||||
|
@ -423,12 +535,18 @@ Changes the interval in which log files are rotated.
|
|||
|
||||
The entire log output for the container is still available via `docker logs mailserver` (or your respective container name). If you want to configure external log rotation for that container output as well, : [Docker Logging Drivers](https://docs.docker.com/config/containers/logging/configure/).
|
||||
|
||||
By default, the logs are lost when the container is destroyed (eg: re-creating via `docker-compose down && docker-compose up -d`). To keep the logs, mount a volume (to `/var/log/mail/`).
|
||||
By default, the logs are lost when the container is destroyed (eg: re-creating via `docker compose down && docker compose up -d`). To keep the logs, mount a volume (to `/var/log/mail/`).
|
||||
|
||||
!!! note
|
||||
|
||||
This variable can also determine the interval for Postfix's log summary reports, see [`PFLOGSUMM_TRIGGER`](#pflogsumm_trigger).
|
||||
|
||||
##### LOGROTATE_COUNT
|
||||
|
||||
Defines how many files are kept by logrotate.
|
||||
|
||||
- **4** => Number of files
|
||||
|
||||
#### SpamAssassin
|
||||
|
||||
##### ENABLE_SPAMASSASSIN
|
||||
|
@ -436,63 +554,153 @@ Changes the interval in which log files are rotated.
|
|||
- **0** => SpamAssassin is disabled
|
||||
- 1 => SpamAssassin is enabled
|
||||
|
||||
##### SPAMASSASSIN_SPAM_TO_INBOX
|
||||
??? info "SpamAssassin analyzes incoming mail and assigns a spam score"
|
||||
|
||||
- 0 => Spam messages will be bounced (_rejected_) without any notification (_dangerous_).
|
||||
- **1** => Spam messages will be delivered to the inbox and tagged as spam using `SA_SPAM_SUBJECT`.
|
||||
Integration with Amavis involves processing mail based on the assigned spam score via [`SA_TAG`, `SA_TAG2` and `SA_KILL`][amavis-docs::spam-score].
|
||||
|
||||
These settings have equivalent ENV supported by DMS for easy adjustments, as documented below.
|
||||
|
||||
[amavis-docs::spam-score]: https://www.ijs.si/software/amavisd/amavisd-new-docs.html#tagkill
|
||||
|
||||
##### ENABLE_SPAMASSASSIN_KAM
|
||||
|
||||
[KAM](https://mcgrail.com/template/projects#KAM1) is a 3rd party SpamAssassin ruleset, provided by the McGrail Foundation. If SpamAssassin is enabled, KAM can be used in addition to the default ruleset.
|
||||
|
||||
- **0** => KAM disabled
|
||||
- 1 => KAM enabled
|
||||
|
||||
[KAM](https://mcgrail.com/template/projects#KAM1) is a 3rd party SpamAssassin ruleset, provided by the McGrail Foundation. If SpamAssassin is enabled, KAM can be used in addition to the default ruleset.
|
||||
|
||||
##### SPAMASSASSIN_SPAM_TO_INBOX
|
||||
|
||||
- 0 => (_Amavis action: `D_BOUNCE`_): Spam messages will be bounced (_rejected_) without any notification (_dangerous_).
|
||||
- **1** => (_Amavis action: `D_PASS`_): Spam messages will be delivered to the inbox.
|
||||
|
||||
!!! note
|
||||
|
||||
The Amavis action configured by this setting:
|
||||
|
||||
- Influences the behavior of the [`SA_KILL`](#sa_kill) setting.
|
||||
- Applies to the Amavis config parameters `$final_spam_destiny` and `$final_bad_header_destiny`.
|
||||
|
||||
!!! note "This ENV setting is related to"
|
||||
|
||||
- [`MOVE_SPAM_TO_JUNK=1`](#move_spam_to_junk)
|
||||
- [`MARK_SPAM_AS_READ=1`](#mark_spam_as_read)
|
||||
- [`SPAM_SUBJECT`](#spam_subject)
|
||||
|
||||
##### SA_TAG
|
||||
|
||||
- **2.0** => add spam info headers if at, or above that level
|
||||
- **2.0** => add 'spam info' headers at, or above this spam score
|
||||
|
||||
Note: this SpamAssassin setting needs `ENABLE_SPAMASSASSIN=1`
|
||||
Mail is not yet considered spam at this spam score, but for purposes like diagnostics it can be useful to identify mail with a spam score at a lower bound than `SA_TAG2`.
|
||||
|
||||
??? example "`X-Spam` headers appended to mail"
|
||||
|
||||
Send a simple mail to a local DMS account `hello@example.com`:
|
||||
|
||||
```bash
|
||||
docker exec dms swaks --server 0.0.0.0 --to hello@example.com --body 'spam'
|
||||
```
|
||||
|
||||
Inspecting the raw mail you will notice several `X-Spam` headers were added to the mail like this:
|
||||
|
||||
```
|
||||
X-Spam-Flag: NO
|
||||
X-Spam-Score: 4.162
|
||||
X-Spam-Level: ****
|
||||
X-Spam-Status: No, score=4.162 tagged_above=2 required=4
|
||||
tests=[BODY_SINGLE_WORD=1, DKIM_ADSP_NXDOMAIN=0.8,
|
||||
NO_DNS_FOR_FROM=0.379, NO_RECEIVED=-0.001, NO_RELAYS=-0.001,
|
||||
PYZOR_CHECK=1.985] autolearn=no autolearn_force=no
|
||||
```
|
||||
|
||||
!!! info "The `X-Spam-Score` is `4.162`"
|
||||
|
||||
High enough for `SA_TAG` to trigger adding these headers, but not high enough for `SA_TAG2` (_which would set `X-Spam-Flag: YES` instead_).
|
||||
|
||||
##### SA_TAG2
|
||||
|
||||
- **6.31** => add 'spam detected' headers at that level
|
||||
- **6.31** => add 'spam detected' headers at, or above this level
|
||||
|
||||
Note: this SpamAssassin setting needs `ENABLE_SPAMASSASSIN=1`
|
||||
When a spam score is high enough, mark mail as spam (_Appends the mail header: `X-Spam-Flag: YES`_).
|
||||
|
||||
!!! info "Interaction with other ENV"
|
||||
|
||||
- [`SPAM_SUBJECT`](#spam_subject) modifies the mail subject to better communicate spam mail to the user.
|
||||
- [`MOVE_SPAM_TO_JUNK=1`](#move_spam_to_junk): The mail is still delivered, but to the recipient(s) junk folder instead. This feature reduces the usefulness of `SPAM_SUBJECT`.
|
||||
|
||||
##### SA_KILL
|
||||
|
||||
- **10.0** => triggers spam evasive actions
|
||||
- **10.0** => quarantine + triggers action to handle spam
|
||||
|
||||
!!! note "This SpamAssassin setting needs `ENABLE_SPAMASSASSIN=1`"
|
||||
Controls the spam score threshold for triggering an action on mail that has a high spam score.
|
||||
|
||||
By default, `docker-mailserver` is configured to quarantine spam emails.
|
||||
??? tip "Choosing an appropriate `SA_KILL` value"
|
||||
|
||||
If emails are quarantined, they are compressed and stored in a location dependent on the `ONE_DIR` setting above. To inhibit this behaviour and deliver spam emails, set this to a very high value e.g. `100.0`.
|
||||
The value should be high enough to be represent confidence in mail as spam:
|
||||
|
||||
If `ONE_DIR=1` (default) the location is `/var/mail-state/lib-amavis/virusmails/`, or if `ONE_DIR=0`: `/var/lib/amavis/virusmails/`. These paths are inside the docker container.
|
||||
- Too low: The action taken may prevent legitimate mail (ham) that was incorrectly detected as spam from being delivered successfully.
|
||||
- Too high: Allows more spam to bypass the `SA_KILL` trigger (_how to treat mail with high confidence that it is actually spam_).
|
||||
|
||||
##### SA_SPAM_SUBJECT
|
||||
Experiences from DMS users with these settings has been [collected here][gh-issue::sa-tunables-insights], along with [some direct configuration guides][gh-issue::sa-tunables-guides] (_under "Resources for references"_).
|
||||
|
||||
- **\*\*\*SPAM\*\*\*** => add tag to subject if spam detected
|
||||
[gh-issue::sa-tunables-insights]: https://github.com/docker-mailserver/docker-mailserver/pull/3058#issuecomment-1420268148
|
||||
[gh-issue::sa-tunables-guides]: https://github.com/docker-mailserver/docker-mailserver/pull/3058#issuecomment-1416547911
|
||||
|
||||
Note: this SpamAssassin setting needs `ENABLE_SPAMASSASSIN=1`. Add the SpamAssassin score to the subject line by inserting the keyword \_SCORE\_: **\*\*\*SPAM(\_SCORE\_)\*\*\***.
|
||||
??? info "Trigger action"
|
||||
|
||||
DMS will configure Amavis with either of these actions based on the DMS [`SPAMASSASSIN_SPAM_TO_INBOX`](#spamassassin_spam_to_inbox) ENV setting:
|
||||
|
||||
- `D_PASS` (**default**):
|
||||
- Accept mail and deliver it to the recipient(s), despite the high spam score. A copy is still stored in quarantine.
|
||||
- This is a good default to start with until you are more confident in an `SA_KILL` threshold that won't accidentally discard / bounce legitimate mail users are expecting to arrive but is detected as spam.
|
||||
- `D_BOUNCE`:
|
||||
- Additionally sends a bounce notification (DSN).
|
||||
- The [DSN is suppressed][amavis-docs::actions] (_no bounce sent_) when the spam score exceeds the Amavis `$sa_dsn_cutoff_level` config setting (default: `10`). With the DMS `SA_KILL` default also being `10`, no DSN will ever be sent.
|
||||
- `D_REJECT` / `D_DISCARD`:
|
||||
- These two aren't configured by DMS, but are valid alternative action values if configuring Amavis directly.
|
||||
|
||||
??? note "Quarantined mail"
|
||||
|
||||
When mail has a spam score that reaches the `SA_KILL` threshold:
|
||||
|
||||
- [It will be quarantined][amavis-docs::quarantine] regardless of the `SA_KILL` action to perform.
|
||||
- With `D_PASS` the delivered mail also appends an `X-Quarantine-ID` mail header. The ID value of this header is part of the quarantined file name.
|
||||
|
||||
If emails are quarantined, they are compressed and stored at a location:
|
||||
|
||||
- Default: `/var/lib/amavis/virusmails/`
|
||||
- When the [`/var/mail-state/` volume][docs::dms-volumes-state] is present: `/var/mail-state/lib-amavis/virusmails/`
|
||||
|
||||
!!! tip
|
||||
|
||||
Easily list mail stored in quarantine with `find` and the quarantine path:
|
||||
|
||||
```bash
|
||||
find /var/lib/amavis/virusmails -type f
|
||||
```
|
||||
|
||||
[amavis-docs::actions]: https://www.ijs.si/software/amavisd/amavisd-new-docs.html#actions
|
||||
[amavis-docs::quarantine]: https://www.ijs.si/software/amavisd/amavisd-new-docs.html#quarantine
|
||||
|
||||
##### SA_SHORTCIRCUIT_BAYES_SPAM
|
||||
|
||||
- **1** => will activate SpamAssassin short circuiting for bayes spam detection.
|
||||
|
||||
This will uncomment the respective line in ```/etc/spamassasin/local.cf```
|
||||
This will uncomment the respective line in `/etc/spamassasin/local.cf`
|
||||
|
||||
Note: activate this only if you are confident in your bayes database for identifying spam.
|
||||
!!! warning
|
||||
|
||||
Activate this only if you are confident in your bayes database for identifying spam.
|
||||
|
||||
##### SA_SHORTCIRCUIT_BAYES_HAM
|
||||
|
||||
- **1** => will activate SpamAssassin short circuiting for bayes ham detection
|
||||
|
||||
This will uncomment the respective line in ```/etc/spamassasin/local.cf```
|
||||
This will uncomment the respective line in `/etc/spamassasin/local.cf`
|
||||
|
||||
Note: activate this only if you are confident in your bayes database for identifying ham.
|
||||
!!! warning
|
||||
|
||||
Activate this only if you are confident in your bayes database for identifying ham.
|
||||
|
||||
#### Fetchmail
|
||||
|
||||
|
@ -507,17 +715,39 @@ Note: activate this only if you are confident in your bayes database for identif
|
|||
|
||||
##### FETCHMAIL_PARALLEL
|
||||
|
||||
**0** => `fetchmail` runs with a single config file `/etc/fetchmailrc`
|
||||
**1** => `/etc/fetchmailrc` is split per poll entry. For every poll entry a separate fetchmail instance is started to allow having multiple imap idle configurations defined.
|
||||
- **0** => `fetchmail` runs with a single config file `/etc/fetchmailrc`
|
||||
- 1 => `/etc/fetchmailrc` is split per poll entry. For every poll entry a separate fetchmail instance is started to [allow having multiple imap idle connections per server][fetchmail-imap-workaround] (_when poll entries reference the same IMAP server_).
|
||||
|
||||
[fetchmail-imap-workaround]: https://otremba.net/wiki/Fetchmail_(Debian)#Immediate_Download_via_IMAP_IDLE
|
||||
|
||||
Note: The defaults of your fetchmailrc file need to be at the top of the file. Otherwise it won't be added correctly to all separate `fetchmail` instances.
|
||||
#### Getmail
|
||||
|
||||
##### ENABLE_GETMAIL
|
||||
|
||||
Enable or disable `getmail`.
|
||||
|
||||
- **0** => Disabled
|
||||
- 1 => Enabled
|
||||
|
||||
##### GETMAIL_POLL
|
||||
|
||||
- **5** => `getmail` The number of minutes for the interval. Min: 1; Default: 5.
|
||||
|
||||
|
||||
#### OAUTH2
|
||||
|
||||
##### ENABLE_OAUTH2
|
||||
|
||||
- **empty** => OAUTH2 authentication is disabled
|
||||
- 1 => OAUTH2 authentication is enabled
|
||||
|
||||
##### OAUTH2_INTROSPECTION_URL
|
||||
|
||||
- => Specify the user info endpoint URL of the oauth2 provider (_eg: `https://oauth2.example.com/userinfo/`_)
|
||||
|
||||
#### LDAP
|
||||
|
||||
##### ENABLE_LDAP
|
||||
|
||||
Deprecated. See [`ACCOUNT_PROVISIONER`](#account_provisioner).
|
||||
|
||||
##### LDAP_START_TLS
|
||||
|
||||
- **empty** => no
|
||||
|
@ -526,8 +756,8 @@ Deprecated. See [`ACCOUNT_PROVISIONER`](#account_provisioner).
|
|||
##### LDAP_SERVER_HOST
|
||||
|
||||
- **empty** => mail.example.com
|
||||
- => Specify the dns-name/ip-address where the ldap-server is listening, or an URI like `ldaps://mail.example.com`
|
||||
- NOTE: If you going to use `docker-mailserver` in combination with `docker-compose.yml` you can set the service name here
|
||||
- => Specify the `<dns-name>` / `<ip-address>` where the LDAP server is reachable via a URI like: `ldaps://mail.example.com`.
|
||||
- Note: You must include the desired URI scheme (`ldap://`, `ldaps://`, `ldapi://`).
|
||||
|
||||
##### LDAP_SEARCH_BASE
|
||||
|
||||
|
@ -596,14 +826,13 @@ The following variables overwrite the default values for ```/etc/dovecot/dovecot
|
|||
##### DOVECOT_DNPASS
|
||||
|
||||
- **empty** => same as `LDAP_BIND_PW`
|
||||
- => Password for LDAP dn sepecifified in `DOVECOT_DN`.
|
||||
- => Password for LDAP dn specified in `DOVECOT_DN`.
|
||||
|
||||
##### DOVECOT_URIS
|
||||
|
||||
- **empty** => same as `LDAP_SERVER_HOST`
|
||||
- => Specify a space separated list of LDAP uris.
|
||||
- Note: If the protocol is missing, `ldap://` will be used.
|
||||
- Note: This deprecates `DOVECOT_HOSTS` (as it didn't allow to use LDAPS), which is currently still supported for backwards compatibility.
|
||||
- => Specify a space separated list of LDAP URIs.
|
||||
- Note: You must include the desired URI scheme (`ldap://`, `ldaps://`, `ldapi://`).
|
||||
|
||||
##### DOVECOT_LDAP_VERSION
|
||||
|
||||
|
@ -681,22 +910,26 @@ Note: This postgrey setting needs `ENABLE_POSTGREY=1`
|
|||
|
||||
##### SASLAUTHD_MECHANISMS
|
||||
|
||||
- **empty** => pam
|
||||
- `ldap` => authenticate against ldap server
|
||||
- `shadow` => authenticate against local user db
|
||||
- `mysql` => authenticate against mysql db
|
||||
- `rimap` => authenticate against imap server
|
||||
- NOTE: can be a list of mechanisms like pam ldap shadow
|
||||
DMS only implements support for these mechanisms:
|
||||
|
||||
- **`ldap`** => Authenticate against an LDAP server
|
||||
- `rimap` => Authenticate against an IMAP server
|
||||
|
||||
##### SASLAUTHD_MECH_OPTIONS
|
||||
|
||||
- **empty** => None
|
||||
- e.g. with SASLAUTHD_MECHANISMS rimap you need to specify the ip-address/servername of the imap server ==> xxx.xxx.xxx.xxx
|
||||
|
||||
!!! info
|
||||
|
||||
With `SASLAUTHD_MECHANISMS=rimap` you need to specify the ip-address / servername of the IMAP server, such as `SASLAUTHD_MECH_OPTIONS=127.0.0.1`.
|
||||
|
||||
##### SASLAUTHD_LDAP_SERVER
|
||||
|
||||
- **empty** => same as `LDAP_SERVER_HOST`
|
||||
- Note: since version 10.0.0, you can specify a protocol here (like ldaps://); this deprecates SASLAUTHD_LDAP_SSL.
|
||||
- **empty** => Use the same value as `LDAP_SERVER_HOST`
|
||||
|
||||
!!! note
|
||||
|
||||
You must include the desired URI scheme (`ldap://`, `ldaps://`, `ldapi://`).
|
||||
|
||||
##### SASLAUTHD_LDAP_START_TLS
|
||||
|
||||
|
@ -796,41 +1029,121 @@ you to replace both instead of just the envelope sender.
|
|||
- **empty** => Derived from [`OVERRIDE_HOSTNAME`](#override_hostname), `$DOMAINNAME` (internal), or the container's hostname
|
||||
- Set this if auto-detection fails, isn't what you want, or you wish to have a separate container handle DSNs
|
||||
|
||||
#### Default Relay Host
|
||||
#### Relay Host
|
||||
|
||||
Supported ENV for the [Relay Host][docs::relay-host] feature.
|
||||
|
||||
!!! note "Prefer `DEFAULT_RELAY_HOST` instead of `RELAY_HOST`"
|
||||
|
||||
This is advised unless you need support for sender domain opt-out (via `setup relay exclude-domain`).
|
||||
|
||||
The implementation for `RELAY_HOST` is not compatible with LDAP.
|
||||
|
||||
!!! tip "Opt-in for relay host support"
|
||||
|
||||
Enable relaying only for specific sender domains instead by using `setup relay add-domain`.
|
||||
|
||||
**NOTE:** Presently there is a caveat when relay host credentials are configured (_which is incompatible with opt-in_).
|
||||
|
||||
##### DEFAULT_RELAY_HOST
|
||||
|
||||
- **empty** => don't set default relayhost setting in main.cf
|
||||
- default host and port to relay all mail through.
|
||||
Format: `[example.com]:587` (don't forget the brackets if you need this to
|
||||
be compatible with `$RELAY_USER` and `$RELAY_PASSWORD`, explained below).
|
||||
Configures a default relay host.
|
||||
|
||||
#### Multi-domain Relay Hosts
|
||||
!!! info
|
||||
|
||||
- All mail sent outbound from DMS will be relayed through the configured host, unless sender-dependent relayhost maps have been configured (_which have precedence_).
|
||||
- The host value may optionally be wrapped in brackets (_skips DNS query for MX record_): `[mail.example.com]:587` vs `example.com:587`
|
||||
|
||||
!!! abstract "Technical Details"
|
||||
|
||||
This ENV internally configures the Postfix `main.cf` setting: [`relayhost`][postfix-config::relayhost]
|
||||
|
||||
##### RELAY_HOST
|
||||
|
||||
- **empty** => don't configure relay host
|
||||
- default host to relay mail through
|
||||
Configures a default relay host.
|
||||
|
||||
!!! note
|
||||
|
||||
Expects a value like `mail.example.com`. Internally this will be wrapped to `[mail.example.com]`, so it should resolve to the MTA directly.
|
||||
|
||||
!!! warning "Do not use with `DEFAULT_RELAY_HOST`"
|
||||
|
||||
`RELAY_HOST` has precedence as it is configured with `sender_dependent_relayhost_maps`.
|
||||
|
||||
!!! info
|
||||
|
||||
- This is a legacy ENV. It is however required for the opt-out feature of `postfix-relaymap.cf` to work.
|
||||
- Internal configuration however differs from `DEFAULT_RELAY_HOST`.
|
||||
|
||||
!!! abstract "Technical Details"
|
||||
|
||||
This feature is configured internally using the:
|
||||
|
||||
- Postfix setting with config: [`sender_dependent_relayhost_maps = texthash:/etc/postfix/relayhost_map`][postfix-config::relayhost_maps]
|
||||
- DMS Config volume support via: `postfix-relaymap.cf` (_generates `/etc/postfix/relayhost_map`_)
|
||||
|
||||
All known mail domains managed by DMS will be configured to relay outbound mail to `RELAY_HOST` by adding them implicitly to `/etc/postfix/relayhost_map`, except for domains using the opt-out feature of `postfix-relaymap.cf`.
|
||||
|
||||
##### RELAY_PORT
|
||||
|
||||
- **empty** => 25
|
||||
- default port to relay mail through
|
||||
Default => 25
|
||||
|
||||
Support for configuring a different port than 25 for `RELAY_HOST` to use.
|
||||
|
||||
!!! note
|
||||
|
||||
Requires `RELAY_HOST`.
|
||||
|
||||
#### Relay Host Credentials
|
||||
|
||||
!!! warning "Configuring relay host credentials enforces outbound authentication"
|
||||
|
||||
Presently when `RELAY_USER` + `RELAY_PASSWORD` or `postfix-sasl-password.cf` are configured, all outbound mail traffic is configured to require a secure connection established and forbids the omission of credentials.
|
||||
|
||||
Additional feature work is required to only enforce these requirements on mail sent through a configured relay host.
|
||||
|
||||
##### RELAY_USER
|
||||
|
||||
- **empty** => no default
|
||||
- default relay username (if no specific entry exists in postfix-sasl-password.cf)
|
||||
|
||||
##### RELAY_PASSWORD
|
||||
|
||||
- **empty** => no default
|
||||
- password for default relay user
|
||||
Provide the credentials to use with `RELAY_HOST` or `DEFAULT_RELAY_HOST`.
|
||||
|
||||
!!! tip "Alternative credentials config"
|
||||
|
||||
You may prefer to use `setup relay add-auth` to avoid risking ENV exposing secrets.
|
||||
|
||||
- With the CLI command, you must provide relay credentials for each of your sender domains.
|
||||
- Alternatively manually edit `postfix-sasl-password.cf` with the correct relayhost entry (_`DEFAULT_RELAY_HOST` value, or as defined in `/etc/postfix/relayhost_map`_) to provide credentials per relayhost configured.
|
||||
|
||||
!!! abstract "Technical Details"
|
||||
|
||||
Credentials for relay hosts are configured internally using the:
|
||||
|
||||
- Postfix setting with config: [`smtp_sasl_password_maps = texthash:/etc/postfix/sasl_passwd`][postfix-config::sasl_passwd]
|
||||
- DMS Config volume support via: `postfix-sasl-password.cf` (_generates `/etc/postfix/sasl_passwd`_)
|
||||
|
||||
---
|
||||
|
||||
When `postfix-sasl-password.cf` is present, DMS will copy it internally to `/etc/postfix/sasl_passwd`.
|
||||
|
||||
- DMS provides support for mapping credentials by sender domain:
|
||||
- Explicitly via `setup relay add-auth` (_creates / updates `postfix-sasl-password.cf`_).
|
||||
- Implicitly via the relay ENV support (_configures all known DMS managed domains to use the relay ENV_).
|
||||
- Credentials can be explicitly configured for specific relay hosts instead of sender domains:
|
||||
- Add the exact relayhost value (`host:port` / `[host]:port`) from the generated `/etc/postfix/relayhost_map`, or `main.cf:relayhost` (`DEFAULT_RELAY_HOST`).
|
||||
- `setup relay ...` is missing support, you must instead add these manually to `postfix-sasl-password.cf`.
|
||||
|
||||
[gh-issue::vmail-uid-cannot-be-root]: https://github.com/docker-mailserver/docker-mailserver/issues/4098#issuecomment-2257201025
|
||||
|
||||
[docs-rspamd]: ./security/rspamd.md
|
||||
[docs-faq-onedir]: ../faq.md#what-about-docker-datadmsmail-state-folder-varmail-state-internally
|
||||
[docs-tls]: ./security/ssl.md
|
||||
[docs-tls-letsencrypt]: ./security/ssl.md#lets-encrypt-recommended
|
||||
[docs-tls-manual]: ./security/ssl.md#bring-your-own-certificates
|
||||
[docs-tls-selfsigned]: ./security/ssl.md#self-signed-certificates
|
||||
[docs-accounts-quota]: ./user-management.md#quotas
|
||||
[docs-accounts-quota]: ./account-management/overview.md#quotas
|
||||
[docs::account-management::overview]: ./account-management/overview.md
|
||||
[docs::relay-host]: ./advanced/mail-forwarding/relay-hosts.md
|
||||
[docs::dms-volumes-state]: ./advanced/optional-config.md#volumes-state
|
||||
[postfix-config::relayhost]: https://www.postfix.org/postconf.5.html#relayhost
|
||||
[postfix-config::relayhost_maps]: https://www.postfix.org/postconf.5.html#sender_dependent_relayhost_maps
|
||||
[postfix-config::sasl_passwd]: https://www.postfix.org/postconf.5.html#smtp_sasl_password_maps
|
||||
|
|
|
@ -4,7 +4,7 @@ hide:
|
|||
- toc # Hide Table of Contents for this page
|
||||
---
|
||||
|
||||
If you want to use POP3(S), you have to add the ports 110 and/or 995 (TLS secured) and the environment variable `ENABLE_POP3` to your `docker-compose.yml`:
|
||||
If you want to use POP3(S), you have to add the ports 110 and/or 995 (TLS secured) and the environment variable `ENABLE_POP3` to your `compose.yaml`:
|
||||
|
||||
```yaml
|
||||
mailserver:
|
||||
|
|
|
@ -4,116 +4,159 @@ hide:
|
|||
- toc # Hide Table of Contents for this page
|
||||
---
|
||||
|
||||
Fail2Ban is installed automatically and bans IP addresses for 3 hours after 3 failed attempts in 10 minutes by default.
|
||||
!!! quote "What is Fail2Ban (F2B)?"
|
||||
|
||||
## Configuration files
|
||||
Fail2ban is an intrusion prevention software framework. Written in the Python programming language, it is designed to prevent against brute-force attacks. It is able to run on POSIX systems that have an interface to a packet-control system or firewall installed locally, such as \[NFTables\] or TCP Wrapper.
|
||||
|
||||
If you want to change this, you can easily edit our github example file: [`config-examples/fail2ban-jail.cf`][github-file-f2bjail].
|
||||
[Source][wikipedia-fail2ban]
|
||||
|
||||
You can do the same with the values from `fail2ban.conf`, e.g `dbpurgeage`. In that case you need to edit: [`config-examples/fail2ban-fail2ban.cf`][github-file-f2bconfig].
|
||||
[wikipedia-fail2ban]: https://en.wikipedia.org/wiki/Fail2ban
|
||||
|
||||
The configuration files need to be located at the root of the `/tmp/docker-mailserver/` volume bind (usually `./docker-data/dms/config/:/tmp/docker-mailserver/`).
|
||||
|
||||
This following configuration files from `/tmp/docker-mailserver/` will be copied during container startup.
|
||||
|
||||
- `fail2ban-jail.cf` -> `/etc/fail2ban/jail.d/user-jail.local`
|
||||
- `fail2ban-fail2ban.cf` -> `/etc/fail2ban/fail2ban.local`
|
||||
|
||||
### Docker-compose config
|
||||
|
||||
Example configuration volume bind:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- ./docker-data/dms/config/:/tmp/docker-mailserver/
|
||||
```
|
||||
|
||||
!!! attention
|
||||
`docker-mailserver` must be launched with the `NET_ADMIN` capability in order to be able to install the nftables rules that actually ban IP addresses.
|
||||
|
||||
Thus either include `--cap-add=NET_ADMIN` in the `docker run` command, or the equivalent in `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
```
|
||||
|
||||
## Running fail2ban in a rootless container
|
||||
|
||||
[`RootlessKit`][rootless::rootless-kit] is the _fakeroot_ implementation for supporting _rootless mode_ in Docker and Podman. By default RootlessKit uses the [`builtin` port forwarding driver][rootless::port-drivers], which does not propagate source IP addresses.
|
||||
|
||||
It is necessary for `fail2ban` to have access to the real source IP addresses in order to correctly identify clients. This is achieved by changing the port forwarding driver to [`slirp4netns`][rootless::slirp4netns], which is slower than `builtin` but does preserve the real source IPs.
|
||||
|
||||
### Docker with `slirp4netns` port driver
|
||||
|
||||
For [rootless mode][rootless::docker] in Docker, create `~/.config/systemd/user/docker.service.d/override.conf` with the following content:
|
||||
|
||||
```
|
||||
[Service]
|
||||
Environment="DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns"
|
||||
```
|
||||
|
||||
And then restart the daemon:
|
||||
|
||||
```console
|
||||
$ systemctl --user daemon-reload
|
||||
$ systemctl --user restart docker
|
||||
```
|
||||
|
||||
!!! note
|
||||
|
||||
This changes the port driver for all rootless containers managed by Docker.
|
||||
|
||||
Per container configuration is not supported, if you need that consider Podman instead.
|
||||
|
||||
### Podman with `slirp4netns` port driver
|
||||
|
||||
[Rootless Podman][rootless::podman] requires adding the value `slirp4netns:port_handler=slirp4netns` to the `--network` CLI option, or `network_mode` setting in your `docker-compose.yml`.
|
||||
|
||||
|
||||
You must also add the ENV `NETWORK_INTERFACE=tap0`, because Podman uses a [hard-coded interface name][rootless::podman::interface] for `slirp4netns`.
|
||||
## Configuration
|
||||
|
||||
Enabling Fail2Ban support can be done via ENV, but also requires granting at least the `NET_ADMIN` capability to interact with the kernel and ban IP addresses.
|
||||
|
||||
!!! example
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mailserver:
|
||||
network_mode: "slirp4netns:port_handler=slirp4netns"
|
||||
environment:
|
||||
- ENABLE_FAIL2BAN=1
|
||||
- NETWORK_INTERFACE=tap0
|
||||
...
|
||||
```
|
||||
=== "Docker Compose"
|
||||
|
||||
!!! note
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
mailserver:
|
||||
environment:
|
||||
- ENABLE_FAIL2BAN=1
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
```
|
||||
|
||||
`slirp4netns` is not compatible with user-defined networks.
|
||||
=== "Docker CLI"
|
||||
|
||||
## Manage bans
|
||||
```bash
|
||||
docker run --rm -it \
|
||||
--cap-add=NET_ADMIN \
|
||||
--env ENABLE_FAIL2BAN=1
|
||||
```
|
||||
|
||||
You can also manage and list the banned IPs with the [`setup.sh`][docs-setupsh] script.
|
||||
!!! warning "Security risk of adding non-default capabilties"
|
||||
|
||||
### List bans
|
||||
DMS bundles F2B into the image for convenience to simplify integration and deployment.
|
||||
|
||||
```sh
|
||||
./setup.sh fail2ban
|
||||
```
|
||||
The [`NET_ADMIN`][security::cap-net-admin] and [`NET_RAW`][security::cap-net-raw] capabilities are not granted by default to the container root user, as they can be used to compromise security.
|
||||
|
||||
### Un-ban
|
||||
If this risk concerns you, it may be wiser to instead prefer only granting these capabilities to a dedicated Fail2Ban container ([example][lsio:f2b-image]).
|
||||
|
||||
Here `192.168.1.15` is our banned IP.
|
||||
!!! bug "Running Fail2Ban on Older Kernels"
|
||||
|
||||
```sh
|
||||
./setup.sh fail2ban unban 192.168.1.15
|
||||
```
|
||||
DMS configures F2B to use [NFTables][network::nftables], not [IPTables (legacy)][network::iptables-legacy].
|
||||
|
||||
[docs-setupsh]: ../setup.sh.md
|
||||
We have observed that older systems (for example NAS systems), do not support the modern NFTables rules. You will need to configure F2B to use legacy IPTables again, for example with the [`fail2ban-jail.cf`][github-file-f2bjail], see the [section on configuration further down below](#custom-files).
|
||||
|
||||
[security::cap-net-admin]: https://0xn3va.gitbook.io/cheat-sheets/container/escaping/excessive-capabilities#cap_net_admin
|
||||
[security::cap-net-raw]: https://0xn3va.gitbook.io/cheat-sheets/container/escaping/excessive-capabilities#cap_net_raw
|
||||
[lsio:f2b-image]: https://docs.linuxserver.io/images/docker-fail2ban
|
||||
[network::nftables]: https://en.wikipedia.org/wiki/Nftables
|
||||
[network::iptables-legacy]: https://developers.redhat.com/blog/2020/08/18/iptables-the-two-variants-and-their-relationship-with-nftables#two_variants_of_the_iptables_command
|
||||
|
||||
### DMS Defaults
|
||||
|
||||
DMS will automatically ban IP addresses of hosts that have generated 6 failed attempts over the course of the last week. The bans themselves last for one week. The Postfix jail is configured to use `mode = extra` in DMS.
|
||||
|
||||
### Custom Files
|
||||
|
||||
!!! question "What is [`docker-data/dms/config/`][docs::dms-volumes-config]?"
|
||||
|
||||
This following configuration files inside the `docker-data/dms/config/` volume will be copied inside the container during startup
|
||||
|
||||
1. `fail2ban-jail.cf` is copied to `/etc/fail2ban/jail.d/user-jail.local`
|
||||
- with this file, you can adjust the configuration of individual jails and their defaults
|
||||
- there is an example provided [in our repository on GitHub][github-file-f2bjail]
|
||||
2. `fail2ban-fail2ban.cf` is copied to `/etc/fail2ban/fail2ban.local`
|
||||
- with this file, you can adjust F2B behavior in general
|
||||
- there is an example provided [in our repository on GitHub][github-file-f2bconfig]
|
||||
|
||||
[docs::dms-volumes-config]: ../advanced/optional-config.md#volumes-config
|
||||
[github-file-f2bjail]: https://github.com/docker-mailserver/docker-mailserver/blob/master/config-examples/fail2ban-jail.cf
|
||||
[github-file-f2bconfig]: https://github.com/docker-mailserver/docker-mailserver/blob/master/config-examples/fail2ban-fail2ban.cf
|
||||
|
||||
### Viewing All Bans
|
||||
|
||||
When just running
|
||||
|
||||
```bash
|
||||
setup fail2ban
|
||||
```
|
||||
|
||||
the script will show all banned IP addresses.
|
||||
|
||||
To get a more detailed `status` view, run
|
||||
|
||||
```bash
|
||||
setup fail2ban status
|
||||
```
|
||||
|
||||
### Managing Bans
|
||||
|
||||
You can manage F2B with the `setup` script. The usage looks like this:
|
||||
|
||||
```bash
|
||||
docker exec <CONTAINER NAME> setup fail2ban [<ban|unban> <IP>]
|
||||
```
|
||||
|
||||
### Viewing the Log File
|
||||
|
||||
```bash
|
||||
docker exec <CONTAINER NAME> setup fail2ban log
|
||||
```
|
||||
|
||||
## Running Inside A Rootless Container { #rootless-container }
|
||||
|
||||
[`RootlessKit`][rootless::rootless-kit] is the _fakeroot_ implementation for supporting _rootless mode_ in Docker and Podman. By default, RootlessKit uses the [`builtin` port forwarding driver][rootless::port-drivers], which does not propagate source IP addresses.
|
||||
|
||||
It is necessary for F2B to have access to the real source IP addresses in order to correctly identify clients. This is achieved by changing the port forwarding driver to [`slirp4netns`][rootless::slirp4netns], which is slower than the builtin driver but does preserve the real source IPs.
|
||||
|
||||
[rootless::rootless-kit]: https://github.com/rootless-containers/rootlesskit
|
||||
[rootless::port-drivers]: https://github.com/rootless-containers/rootlesskit/blob/v0.14.5/docs/port.md#port-drivers
|
||||
[rootless::slirp4netns]: https://github.com/rootless-containers/slirp4netns
|
||||
[rootless::docker]: https://docs.docker.com/engine/security/rootless
|
||||
[rootless::podman]: https://github.com/containers/podman/blob/v3.4.1/docs/source/markdown/podman-run.1.md#--networkmode---net
|
||||
[rootless::podman::interface]: https://github.com/containers/podman/blob/v3.4.1/libpod/networking_slirp4netns.go#L264
|
||||
|
||||
=== "Docker"
|
||||
|
||||
For [rootless mode][rootless::docker] in Docker, create `~/.config/systemd/user/docker.service.d/override.conf` with the following content:
|
||||
|
||||
!!! danger inline end
|
||||
|
||||
This changes the port driver for all rootless containers managed by Docker. Per container configuration is not supported, if you need that consider Podman instead.
|
||||
|
||||
```cf
|
||||
[Service]
|
||||
Environment="DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns"
|
||||
```
|
||||
|
||||
And then restart the daemon:
|
||||
|
||||
```console
|
||||
$ systemctl --user daemon-reload
|
||||
$ systemctl --user restart docker
|
||||
```
|
||||
|
||||
[rootless::docker]: https://docs.docker.com/engine/security/rootless
|
||||
|
||||
=== "Podman"
|
||||
|
||||
[Rootless Podman][rootless::podman] requires adding the value `slirp4netns:port_handler=slirp4netns` to the `--network` CLI option, or `network_mode` setting in your `compose.yaml`:
|
||||
|
||||
!!! example
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mailserver:
|
||||
network_mode: "slirp4netns:port_handler=slirp4netns"
|
||||
environment:
|
||||
- ENABLE_FAIL2BAN=1
|
||||
- NETWORK_INTERFACE=tap0
|
||||
...
|
||||
```
|
||||
|
||||
You must also add the ENV `NETWORK_INTERFACE=tap0`, because Podman uses a [hard-coded interface name][rootless::podman::interface] for `slirp4netns`. `slirp4netns` is not compatible with user-defined networks!
|
||||
|
||||
[rootless::podman]: https://github.com/containers/podman/blob/v3.4.1/docs/source/markdown/podman-run.1.md#--networkmode---net
|
||||
[rootless::podman::interface]: https://github.com/containers/podman/blob/v3.4.1/libpod/networking_slirp4netns.go#L264
|
||||
|
|
|
@ -30,7 +30,7 @@ Official Dovecot documentation: https://doc.dovecot.org/configuration_manual/mai
|
|||
}
|
||||
```
|
||||
|
||||
2. Shutdown your mailserver (`docker-compose down`)
|
||||
2. Shutdown your mailserver (`docker compose down`)
|
||||
|
||||
3. You then need to [generate your global EC key](https://doc.dovecot.org/configuration_manual/mail_crypt_plugin/#ec-key). We named them `/certs/ecprivkey.pem` and `/certs/ecpubkey.pem` in step #1.
|
||||
|
||||
|
@ -45,7 +45,7 @@ Official Dovecot documentation: https://doc.dovecot.org/configuration_manual/mai
|
|||
. . .
|
||||
```
|
||||
|
||||
5. While you're editing the `docker-compose.yml`, add the configuration file:
|
||||
5. While you're editing the `compose.yaml`, add the configuration file:
|
||||
```yaml
|
||||
services:
|
||||
mailserver:
|
||||
|
|
|
@ -2,234 +2,368 @@
|
|||
title: 'Security | Rspamd'
|
||||
---
|
||||
|
||||
!!! warning "The current state of Rspamd integration into DMS"
|
||||
|
||||
Recent pull requests have stabilized integration of Rspamd to a point that we encourage users to test the feature. We are confident that there are no major bugs in our integration that make using Rspamd infeasible. Please note that there may still be (breaking) changes ahead as integration is still work in progress!
|
||||
|
||||
We expect to stabilize this feature with version `v12.1.0`.
|
||||
|
||||
## About
|
||||
|
||||
Rspamd is a ["fast, free and open-source spam filtering system"][homepage]. DMS integrates Rspamd like any other service. We provide a very simple but easy to maintain setup of Rspamd.
|
||||
Rspamd is a ["fast, free and open-source spam filtering system"][rspamd-web]. DMS integrates Rspamd like any other service. We provide a basic but easy to maintain setup of Rspamd.
|
||||
|
||||
If you want to have a look at the default configuration files for Rspamd that DMS packs, navigate to [`target/rspamd/` inside the repository][dms-default-configuration]. Please consult the [section "The Default Configuration"](#the-default-configuration) section down below for a written overview.
|
||||
If you want to take a look at the default configuration files for Rspamd that DMS adds, navigate to [`target/rspamd/` inside the repository][dms-repo::default-rspamd-configuration]. Please consult the [section "The Default Configuration"](#the-default-configuration) section down below for a written overview.
|
||||
|
||||
!!! note "AMD64 vs ARM64"
|
||||
### Enable Rspamd
|
||||
|
||||
We are currently doing a best-effort installation of Rspamd for ARM64 (from the Debian backports repository for Debian 11). The current version difference is two minor versions (AMD64 is at version 3.4, ARM64 at 3.2 \[13th Feb 2023\]).
|
||||
Rspamd is presently opt-in for DMS, but intended to become the default anti-spam service in a future release.
|
||||
|
||||
Maintainers noticed only few differences, some of them with a big impact though. For those running Rspamd on ARM64, we recommend [disabling](#with-the-help-of-a-custom-file) the [DKIM signing module][dkim-signing-module] if you don't use it.
|
||||
DMS offers two anti-spam solutions:
|
||||
|
||||
The following environment variables are related to Rspamd:
|
||||
- Legacy (_Amavis, SpamAssassin, OpenDKIM, OpenDMARC_)
|
||||
- Rspamd (_Provides equivalent features of software from the legacy solution_)
|
||||
|
||||
1. [`ENABLE_RSPAMD`](../environment.md#enable_rspamd)
|
||||
2. [`ENABLE_RSPAMD_REDIS`](../environment.md#enable_rspamd_redis)
|
||||
3. [`RSPAMD_LEARN`](../environment.md#rspamd_learn)
|
||||
4. [`MOVE_SPAM_TO_JUNK`](../environment.md#move_spam_to_junk)
|
||||
While you could configure Rspamd to only replace some of the legacy services, it is advised to only use Rspamd with the legacy services disabled.
|
||||
|
||||
## The Default Configuration
|
||||
!!! example "Switch to Rspamd"
|
||||
|
||||
To use Rspamd add the following ENV config changes:
|
||||
|
||||
```env
|
||||
ENABLE_RSPAMD=1
|
||||
|
||||
# Rspamd replaces the functionality of all these anti-spam services, disable them:
|
||||
ENABLE_OPENDKIM=0
|
||||
ENABLE_OPENDMARC=0
|
||||
ENABLE_POLICYD_SPF=0
|
||||
ENABLE_AMAVIS=0
|
||||
ENABLE_SPAMASSASSIN=0
|
||||
# Greylisting is opt-in, if you had enabled Postgrey switch to the Rspamd equivalent:
|
||||
ENABLE_POSTGREY=0
|
||||
RSPAMD_GREYLISTING=1
|
||||
|
||||
# Optional: Add anti-virus support with ClamAV (compatible with Rspamd):
|
||||
ENABLE_CLAMAV=1
|
||||
```
|
||||
|
||||
!!! info "Relevant Environment Variables"
|
||||
|
||||
The following environment variables are related to Rspamd:
|
||||
|
||||
1. [`ENABLE_RSPAMD`](../environment.md#enable_rspamd)
|
||||
2. [`ENABLE_RSPAMD_REDIS`](../environment.md#enable_rspamd_redis)
|
||||
3. [`RSPAMD_CHECK_AUTHENTICATED`](../environment.md#rspamd_check_authenticated)
|
||||
4. [`RSPAMD_GREYLISTING`](../environment.md#rspamd_greylisting)
|
||||
5. [`RSPAMD_HFILTER`](../environment.md#rspamd_hfilter)
|
||||
6. [`RSPAMD_HFILTER_HOSTNAME_UNKNOWN_SCORE`](../environment.md#rspamd_hfilter_hostname_unknown_score)
|
||||
7. [`RSPAMD_LEARN`](../environment.md#rspamd_learn)
|
||||
8. [`SPAM_SUBJECT`](../environment.md#spam_subject)
|
||||
9. [`MOVE_SPAM_TO_JUNK`][docs::spam-to-junk]
|
||||
10. [`MARK_SPAM_AS_READ`](../environment.md#mark_spam_as_read)
|
||||
|
||||
## Overview of Rspamd support
|
||||
|
||||
### Mode of Operation
|
||||
|
||||
The proxy worker operates in [self-scan mode][proxy-self-scan-mode]. This simplifies the setup as we do not require a normal worker. You can easily change this though by [overriding the configuration by DMS](#providing-custom-settings-overriding-settings).
|
||||
!!! note "Attention"
|
||||
|
||||
Read this section carefully if you want to understand how Rspamd is integrated into DMS and how it works (on a surface level).
|
||||
|
||||
Rspamd is integrated as a milter into DMS. When enabled, Postfix's `main.cf` configuration file includes the parameter `rspamd_milter = inet:localhost:11332`, which is added to `smtpd_milters`. As a milter, Rspamd can inspect incoming and outgoing e-mails.
|
||||
|
||||
Each mail is assigned what Rspamd calls symbols: when an e-mail matches a specific criterion, the e-mail receives a symbol. Afterward, Rspamd applies a _spam score_ (as usual with anti-spam software) to the e-mail.
|
||||
|
||||
- The score itself is calculated by adding the values of the individual symbols applied earlier. The higher the spam score is, the more likely the e-mail is spam.
|
||||
- Symbol values can be negative (i.e., these symbols indicate the mail is legitimate, maybe because [SPF and DKIM][docs::dkim-dmarc-spf] are verified successfully). On the other hand, symbol scores can be positive (i.e., these symbols indicate the e-mail is spam, perhaps because the e-mail contains numerous links).
|
||||
|
||||
Rspamd then adds (a few) headers to the e-mail based on the spam score. Most important is `X-Spamd-Result`, which contains an overview of which symbols were applied. It could look like this:
|
||||
|
||||
```txt
|
||||
X-Spamd-Result default: False [-2.80 / 11.00]; R_SPF_NA(1.50)[no SPF record]; R_DKIM_ALLOW(-1.00)[example.com:s=dtag1]; DWL_DNSWL_LOW(-1.00)[example.com:dkim]; RWL_AMI_LASTHOP(-1.00)[192.0.2.42:from]; DMARC_POLICY_ALLOW(-1.00)[example.com,none]; RWL_MAILSPIKE_EXCELLENT(-0.40)[192.0.2.42:from]; FORGED_SENDER(0.30)[noreply@example.com,some-reply-address@bounce.example.com]; RCVD_IN_DNSWL_LOW(-0.10)[192.0.2.42:from]; MIME_GOOD(-0.10)[multipart/mixed,multipart/related,multipart/alternative,text/plain]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:+,4:~,5:~,6:~]; RCVD_COUNT_THREE(0.00)[3]; RCPT_COUNT_ONE(0.00)[1]; REPLYTO_DN_EQ_FROM_DN(0.00)[]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[example.com:+]; HAS_ATTACHMENT(0.00)[]; TO_DN_NONE(0.00)[]; FROM_NEQ_ENVFROM(0.00)[noreply@example.com,some-reply-address@bounce.example.com]; FROM_HAS_DN(0.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[receiver@anotherexample.com]; ASN(0.00)[asn:3320, ipnet:192.0.2.0/24, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; MISSING_XM_UA(0.00)[]; HAS_REPLYTO(0.00)[some-reply-address@dms-reply.example.com]
|
||||
```
|
||||
|
||||
And then there is a corresponding `X-Rspamd-Action` header, which shows the overall result and the action that is taken. In our example, it would be:
|
||||
|
||||
```txt
|
||||
X-Rspamd-Action no action
|
||||
```
|
||||
|
||||
Since the score is `-2.80`, nothing will happen and the e-mail is not classified as spam. Our custom [`actions.conf`][dms-repo::rspamd-actions-config] defines what to do at certain scores:
|
||||
|
||||
1. At a score of 4, the e-mail is to be _greylisted_;
|
||||
2. At a score of 6, the e-mail is _marked with a header_ (`X-Spam: Yes`);
|
||||
3. At a score of 11, the e-mail is outright _rejected_.
|
||||
|
||||
---
|
||||
|
||||
There is more to spam analysis than meets the eye: we have not covered the [Bayes training and filters][rspamd-docs::bayes] here, nor have we discussed [Sieve rules for e-mails that are marked as spam][docs::spam-to-junk].
|
||||
|
||||
Even the calculation of the score with the individual symbols has been presented to you in a simplified manner. But with the knowledge from above, you're equipped to read on and use Rspamd confidently. Keep on reading to understand the integration even better - you will want to know about your anti-spam software, not only to keep the bad e-mail out, but also to make sure the good e-mail arrive properly!
|
||||
|
||||
### Workers
|
||||
|
||||
The proxy worker operates in [self-scan mode][rspamd-docs::proxy-self-scan-mode]. This simplifies the setup as we do not require a normal worker. You can easily change this though by [overriding the configuration by DMS](#providing-custom-settings-overriding-settings).
|
||||
|
||||
DMS does not set a default password for the controller worker. You may want to do that yourself. In setups where you already have an authentication provider in front of the Rspamd webpage, you may want to [set the `secure_ip ` option to `"0.0.0.0/0"` for the controller worker](#with-the-help-of-a-custom-file) to disable password authentication inside Rspamd completely.
|
||||
|
||||
### Persistence with Redis
|
||||
|
||||
When Rspamd is enabled, we implicitly also start an instance of Redis in the container. Redis is configured to persist it's data via RDB snapshots to disk in the directory `/var/lib/redis` (_which is a symbolic link to `/var/mail-state/lib-redis/` when [`ONE_DIR=1`](../environment.md#one_dir) and a volume is mounted to `/var/mail-state/`_). With the volume mount the snapshot will restore the Redis data across container restarts, and provide a way to keep backup.
|
||||
When Rspamd is enabled, we implicitly also start an instance of Redis in the container:
|
||||
|
||||
Redis uses `/etc/redis/redis.conf` for configuration. We adjust this file when enabling the internal Redis service. If you have an external instance of Redis to use, the internal Redis service can be opt-out via setting the ENV [`ENABLE_RSPAMD_REDIS=0`](../environment.md#enable_rspamd_redis) (_link also details required changes to the DMS rspamd config_).
|
||||
- Redis is configured to persist its data via RDB snapshots to disk in the directory `/var/lib/redis` (_or the [`/var/mail-state/`][docs::dms-volumes-state] volume when present_).
|
||||
- With the volume mount, the snapshot will restore the Redis data across container updates, and provide a way to keep a backup.
|
||||
- Without a volume mount a containers internal state will persist across restarts until the container is recreated due to changes like ENV or upgrading the image for the container.
|
||||
|
||||
Redis uses `/etc/redis/redis.conf` for configuration:
|
||||
|
||||
- We adjust this file when enabling the internal Redis service.
|
||||
- If you have an external instance of Redis to use, the internal Redis service can be opt-out via setting the ENV [`ENABLE_RSPAMD_REDIS=0`][docs::env::enable-redis] (_link also details required changes to the DMS Rspamd config_).
|
||||
|
||||
If you are interested in using Valkey instead of Redis, please refer to [this guidance][gh-dms::guide::valkey].
|
||||
|
||||
### Web Interface
|
||||
|
||||
Rspamd provides a [web interface][rspamd-docs::web-ui], which contains statistics and data Rspamd collects. The interface is enabled by default and reachable on port 11334.
|
||||
|
||||

|
||||
|
||||
To use the web interface you will need to configure a password, [otherwise you won't be able to log in][rspamd-docs::web-ui::password].
|
||||
|
||||
??? example "Set a custom password"
|
||||
|
||||
Add this line to [your Rspamd `custom-commands.conf` config](#with-the-help-of-a-custom-file) which sets the `password` option of the _controller worker_:
|
||||
|
||||
```
|
||||
set-option-for-controller password "your hashed password here"
|
||||
```
|
||||
|
||||
The password hash can be generated via the `rspamadm pw` command:
|
||||
|
||||
```bash
|
||||
docker exec -it <CONTAINER_NAME> rspamadm pw
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Related:** A minimal Rspamd `compose.yaml` [example with a reverse-proxy for web access][gh-dms::guide::rspamd-web].
|
||||
|
||||
### DNS
|
||||
|
||||
DMS does not supply custom values for DNS servers (to Rspamd). If you need to use custom DNS servers, which could be required when using [DNS-based deny/allowlists](#rbls-real-time-blacklists-dnsbls-dns-based-blacklists), you need to adjust [`options.inc`][rspamd-docs::config::global] yourself. Make sure to also read our [FAQ page on DNS servers][docs::faq::dns-servers].
|
||||
|
||||
!!! warning
|
||||
|
||||
Rspamd heavily relies on a properly working DNS server that it can use to resolve DNS queries. If your DNS server is misconfigured, you will encounter issues when Rspamd queries DNS to assess if mail is spam. Legitimate mail is then unintentionally marked as spam or worse, rejected entirely.
|
||||
|
||||
When Rspamd is deciding if mail is spam, it will check DNS records for SPF, DKIM and DMARC. Each of those has an associated symbol for DNS temporary errors with a non-zero weight assigned. That weight contributes towards the spam score assessed by Rspamd which is normally desirable - provided your network DNS is functioning correctly, otherwise when DNS is broken all mail is biased towards spam due to these failed DNS lookups.
|
||||
|
||||
!!! danger
|
||||
|
||||
While we do not provide values for custom DNS servers by default, we set `soft_reject_on_timeout = true;` by default. This setting will cause a soft reject if a task (presumably a DNS request) timeout takes place.
|
||||
|
||||
This setting is enabled to not allow spam to proceed just because DNS requests did not succeed. It could deny legitimate e-mails to pass though too in case your DNS setup is incorrect or not functioning properly.
|
||||
|
||||
### Logs
|
||||
|
||||
You can find the Rspamd logs at `/var/log/mail/rspamd.log`, and the corresponding logs for [Redis](#persistence-with-redis), if it is enabled, at `/var/log/supervisor/rspamd-redis.log`. We recommend inspecting these logs (with `docker exec -it <CONTAINER NAME> less /var/log/mail/rspamd.log`) in case Rspamd does not work as expected.
|
||||
|
||||
### Modules
|
||||
|
||||
You can find a list of all Rspamd modules [on their website][modules].
|
||||
You can find a list of all Rspamd modules [on their website][rspamd-docs::modules].
|
||||
|
||||
#### Disabled By Default
|
||||
|
||||
DMS disables certain modules (clickhouse, elastic, greylist, neural, reputation, spamassassin, url_redirector, metric_exporter) by default. We believe these are not required in a standard setup, and they would otherwise needlessly use system resources.
|
||||
DMS disables certain modules (`clickhouse`, `elastic`, `neural`, `reputation`, `spamassassin`, `url_redirector`, `metric_exporter`) by default. We believe these are not required in a standard setup, and they would otherwise needlessly use system resources.
|
||||
|
||||
#### Anti-Virus (ClamAV)
|
||||
|
||||
You can choose to enable ClamAV, and Rspamd will then use it to check for viruses. Just set the environment variable `ENABLE_CLAMAV=1`.
|
||||
|
||||
#### RBLs (Realtime Blacklists) / DNSBLs (DNS-based Blacklists)
|
||||
#### RBLs (Real-time Blacklists) / DNSBLs (DNS-based Blacklists)
|
||||
|
||||
The [RBL module](https://rspamd.com/doc/modules/rbl.html) is enabled by default. As a consequence, Rspamd will perform DNS lookups to a variety of blacklists. Whether an RBL or a DNSBL is queried depends on where the domain name was obtained: RBL servers are queried with IP addresses extracted from message headers, DNSBL server are queried with domains and IP addresses extracted from the message body \[[source][rbl-vs-dnsbl]\].
|
||||
The [RBL module][rspamd-docs::modules::rbl] is enabled by default. As a consequence, Rspamd will perform DNS lookups to various blacklists. Whether an RBL or a DNSBL is queried depends on where the domain name was obtained: RBL servers are queried with IP addresses extracted from message headers, DNSBL server are queried with domains and IP addresses extracted from the message body ([source][www::rbl-vs-dnsbl]).
|
||||
|
||||
!!! danger "Rspamd and DNS Block Lists"
|
||||
|
||||
When the RBL module is enabled, Rspamd will do a variety of DNS requests to (amongst other things) DNSBLs. There are a variety of issues involved when using DNSBLs. Rspamd will try to mitigate some of them by properly evaluating all return codes. This evaluation is a best effort though, so if the DNSBL operators change or add return codes, it may take a while for Rspamd to adjust as well.
|
||||
|
||||
If you want to use DNSBLs, **try to use your own DNS resolver** and make sure it is set up correctly, i.e. it should be a non-public & **recursive** resolver. Otherwise, you might not be able ([see this Spamhaus post](https://www.spamhaus.org/faq/section/DNSBL%20Usage#365)) to make use of the block lists.
|
||||
If you want to use DNSBLs, **try to use your own DNS resolver** and make sure it is set up correctly, i.e. it should be a non-public & **recursive** resolver. Otherwise, you might not be able ([see this Spamhaus post][spamhaus::faq::dnsbl-usage]) to make use of the block lists.
|
||||
|
||||
## Providing Custom Settings & Overriding Settings
|
||||
|
||||
### Manually
|
||||
!!! info "Rspamd config overriding precedence"
|
||||
|
||||
DMS brings sane default settings for Rspamd. They are located at `/etc/rspamd/local.d/` inside the container (or `target/rspamd/local.d/` in the repository). If you want to change these settings and / or provide your own settings, you can
|
||||
Rspamd has a layered approach for configuration with [`local.d` and `override.d` config directories][rspamd-docs::config-directories].
|
||||
|
||||
1. place files at `/etc/rspamd/override.d/` which will override Rspamd settings and DMS settings
|
||||
2. (re-)place files at `/etc/rspamd/local.d/` to override DMS settings and merge them with Rspamd settings
|
||||
- DMS [extends the Rspamd default configs via `/etc/rspamd/local.d/`][dms-repo::default-rspamd-configuration].
|
||||
- User config changes should be handled separately as overrides via the [DMS Config Volume][docs::dms-volumes-config] (`docker-data/dms/config/`) with either:
|
||||
- `./rspamd/override.d/` - Config files placed here are copied to `/etc/rspamd/override.d/` during container startup.
|
||||
- [`./rspamd/custom-commands.conf`](#with-the-help-of-a-custom-file) - Applied after copying any provided configs from `rspamd/override.d/` (DMS Config volume) to `/etc/rspamd/override.d/`.
|
||||
|
||||
!!! warning "Clashing Overrides"
|
||||
!!! abstract "Reference docs for Rspamd config"
|
||||
|
||||
Note that when also [using the `rspamd-commands` file](#with-the-help-of-a-custom-file), files in `override.d` may be overwritten in case you adjust them manually and with the help of the file.
|
||||
- [Config Overview][rspamd-docs::config::overview], [Quickstart guide][rspamd-docs::config::quickstart], and [Config Syntax (UCL)][rspamd-docs::config::ucl-syntax]
|
||||
- Global Options ([`options.inc`][rspamd-docs::config::global])
|
||||
- [Workers][rspamd-docs::config::workers] ([`worker-controller.inc`][rspamd-docs::config::worker-controller], [`worker-proxy.inc`][rspamd-docs::config::worker-proxy])
|
||||
- [Modules][rspamd-docs::modules] (_view each module page for their specific config options_)
|
||||
|
||||
### With the Help of a Custom File
|
||||
!!! tip "View rendered config"
|
||||
|
||||
DMS provides the ability to do simple adjustments to Rspamd modules with the help of a single file. Just place a file called `rspamd-modules.conf` into the directory `docker-data/dms/config/` (which translates to `/tmp/docker-mailserver/` in the container). If this file is present, DMS will evaluate it. The structure is _very_ simple. Each line in the file looks like this:
|
||||
`rspamadm configdump` will output the full rspamd configuration that is used should you need it for troubleshooting / inspection.
|
||||
|
||||
```txt
|
||||
COMMAND ARGUMENT1 ARGUMENT2 ARGUMENT3
|
||||
```
|
||||
- You can also see which modules are enabled / disabled via `rspamadm configdump --modules-state`
|
||||
- Specific config sections like `dkim` or `worker` can also be used to filter the output to just those sections: `rspamadm configdump dkim worker`
|
||||
- Use `--show-help` to include inline documentation for many settings.
|
||||
|
||||
where `COMMAND` can be:
|
||||
### Using `custom-commands.conf` { #with-the-help-of-a-custom-file }
|
||||
|
||||
1. `disable-module`: disables the module with name `ARGUMENT1`
|
||||
2. `enable-module`: explicitly enables the module with name `ARGUMENT1`
|
||||
3. `set-option-for-module`: sets the value for option `ARGUMENT2` to `ARGUMENT3` inside module `ARGUMENT1`
|
||||
4. `set-option-for-controller`: set the value of option `ARGUMENT1` to `ARGUMENT2` for the controller worker
|
||||
5. `set-option-for-proxy`: set the value of option `ARGUMENT1` to `ARGUMENT2` for the proxy worker
|
||||
6. `set-common-option`: set the option `ARGUMENT1` that [defines basic Rspamd behaviour][basic-options] to value `ARGUMENT2`
|
||||
7. `add-line`: this will add the complete line after `ARGUMENT1` (with all characters) to the file `/etc/rspamd/override.d/<ARGUMENT1>`
|
||||
For convenience DMS provides a single config file that will directly create or modify multiple configs at `/etc/rspamd/override.d/`. This is handled as the final rspamd configuration step during container startup.
|
||||
|
||||
!!! example "An Example Is [Shown Down Below](#adjusting-and-extending-the-very-basic-configuration)"
|
||||
DMS will apply this config when you provide `rspamd/custom-commands.conf` in your DMS Config volume. Configure it with directive lines as documented below.
|
||||
|
||||
!!! note "File Names & Extensions"
|
||||
!!! note "Only use this feature for `option = value` changes"
|
||||
|
||||
For command 1 - 3, we append the `.conf` suffix to the module name to get the correct file name automatically. For commands 4 - 6, the file name is fixed (you don't even need to provide it). For command 7, you will need to provide the whole file name (including the suffix) yourself!
|
||||
`custom-commands.conf` is only suitable for adding or replacing simple `option = value` settings for configs at `/etc/rspamd/override.d/`.
|
||||
|
||||
- New settings are appended to the associated config file.
|
||||
- When replacing an existing setting in an override config, that setting may be any matching line (_allowing for nested scopes, instead of only top-level keys_).
|
||||
|
||||
Any changes involving more advanced [UCL config syntax][rspamd-docs::config::ucl-syntax] should instead add UCL config files directly to `rspamd/override.d/` (_in the DMS Config volume_).
|
||||
|
||||
You can also have comments (the line starts with `#`) and blank lines in `rspamd-modules.conf` - they are properly handled and not evaluated.
|
||||
!!! info "`custom-commands.conf` syntax"
|
||||
|
||||
!!! tip "Adjusting Modules This Way"
|
||||
There are 7 directives available to manage custom Rspamd configurations. Add these directive lines into `custom-commands.conf`, they will be processed sequentially.
|
||||
|
||||
These simple commands are meant to give users the ability to _easily_ alter modules and their options. As a consequence, they are not powerful enough to enable multi-line adjustments. If you need to do something more complex, we advise to do that [manually](#manually)!
|
||||
**Directives:**
|
||||
|
||||
## Examples & Advanced Configuration
|
||||
```txt
|
||||
# For /etc/rspamd/override.d/{options.inc,worker-controller.inc,worker-proxy}.inc
|
||||
set-common-option <OPTION NAME> <OPTION VALUE>
|
||||
set-option-for-controller <OPTION NAME> <OPTION VALUE>
|
||||
set-option-for-proxy <OPTION NAME> <OPTION VALUE>
|
||||
|
||||
### A Very Basic Configuration
|
||||
# For /etc/rspamd/override.d/<MODULE NAME>.conf
|
||||
enable-module <MODULE NAME>
|
||||
disable-module <MODULE NAME>
|
||||
set-option-for-module <MODULE NAME> <OPTION NAME> <OPTION VALUE>
|
||||
|
||||
You want to start using Rspamd? Rspamd is disabled by default, so you need to set the following environment variables:
|
||||
# For /etc/rspamd/override.d/<FILENAME>
|
||||
add-line <FILENAME> <CONTENT>
|
||||
```
|
||||
|
||||
```cf
|
||||
ENABLE_RSPAMD=1
|
||||
ENABLE_OPENDKIM=0
|
||||
ENABLE_OPENDMARC=0
|
||||
ENABLE_AMAVIS=0
|
||||
ENABLE_SPAMASSASSIN=0
|
||||
```
|
||||
**Syntax:**
|
||||
|
||||
This will enable Rspamd and disable services you don't need when using Rspamd. Note that with this setup, the default DKIM signing that DMS provides does not work (as it is disabled)! To solve this issue, look at [this subsection](#dkim-signing).
|
||||
- Blank lines are ok.
|
||||
- `#` at the start of a line represents a comment for adding notes.
|
||||
- `<OPTION VALUE>` and `<CONTENT>` will contain the remaining content of their line, any preceding inputs are delimited by white-space.
|
||||
|
||||
### Adjusting and Extending The Very Basic Configuration
|
||||
---
|
||||
|
||||
Rspamd is running, but you want or need to adjust it?
|
||||
??? note "`<MODULE NAME>` can also target non-module configs"
|
||||
|
||||
1. Say you want to be able to easily look at the frontend Rspamd provides on port 11334 (default) without the need to enter a password (maybe because you already provide authorization and authentication). You will need to adjust the controller worker: create a file called `rspamd-modules.conf` and add the line `set-option-for-controller secure_ip "0.0.0.0/0"`. Place the file `rspamd-modules.conf` inside the directory on the host you mount to `/tmp/docker-mailserver/` inside the container (in our documentation, we use `docker-data/dms/config` on the host for this purpose). And you're done! Note: this disables authentication on the website - make sure you know what you're doing!
|
||||
2. You additionally want to enable the auto-spam-learning for the Bayes module? No problem, just add another line to `rspamd-modules.conf` that looks like this: `set-option-for-module classifier-bayes autolearn true`.
|
||||
3. But the chartable module gets on your nerves? Just disable it by adding another line: `disable-module chartable
|
||||
`.
|
||||
An example is the `statistics` module, which has config to import a separate file (`classifier-bayes.conf`) for easier overrides to this section of the module config.
|
||||
|
||||
??? example
|
||||
|
||||
```conf title="rspamd/custom-commands.conf"
|
||||
# If you're confident you've properly secured access to the rspamd web service/API (Default port: 11334)
|
||||
# with your own auth layer (eg: reverse-proxy) you can bypass rspamd requiring credentials:
|
||||
# https://rspamd.com/doc/workers/controller.html#controller-configuration
|
||||
set-option-for-controller secure_ip "0.0.0.0/0"
|
||||
|
||||
# Some settings aren't documented well, you may find them in snippets or Rspamds default config files:
|
||||
# https://rspamd.com/doc/tutorials/quickstart.html#using-of-milter-protocol-for-rspamd--16
|
||||
# /etc/rspamd/worker-proxy.inc
|
||||
set-option-for-proxy reject_message "Rejected - Detected as spam"
|
||||
|
||||
# Equivalent to the previous example, but `add-line` is more verbose:
|
||||
add-line worker-proxy.inc reject_message = "Rejected - Detected as spam"
|
||||
|
||||
# Enable Bayes auto-learning feature to classify spam based on Rspamd action/score results:
|
||||
# NOTE: The statistics module imports a separate file for classifier-bayes config
|
||||
# https://rspamd.com/doc/configuration/statistic.html#autolearning
|
||||
set-option-for-module classifier-bayes autolearn true
|
||||
|
||||
# Disable the `chartable` module:
|
||||
# https://rspamd.com/doc/modules/chartable.html
|
||||
disable-module chartable
|
||||
```
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
### DKIM Signing
|
||||
|
||||
By default, DMS offers no option to generate and configure signing e-mails with DKIM. This is because the parsing would be difficult. But don't worry: the process is relatively straightforward nevertheless. The [official Rspamd documentation for the DKIM signing module][dkim-signing-module] is pretty good. Basically, you need to
|
||||
There is a dedicated [section for setting up DKIM with Rspamd in our documentation][docs::dkim-with-rspamd].
|
||||
|
||||
1. `exec` into the container
|
||||
2. Run a command similar to `rspamadm dkim_keygen -s 'woosh' -b 2048 -d example.com -k example.private > example.txt`, adjusted to your needs
|
||||
3. Make sure to then persists the files `example.private` and `example.txt` (created in step 2) in the container (for example with a Docker bind mount)
|
||||
4. Create a configuration for the DKIM signing module, i.e. a file called `dkim_signing.conf` that you mount to `/etc/rspamd/local.d/` or `/etc/rspamd/override.d/`. We provide example configurations down below. We recommend mounting this file into the container as well (as described [here](#manually)); do not use [`rspamd-modules.conf`](#with-the-help-of-a-custom-file) for this purpose.
|
||||
### ARC (Authenticated Received Chain)
|
||||
|
||||
??? example "DKIM Signing Module Configuration Examples"
|
||||
[ARC][wikipedia::arc] support in DMS is opt-in via config file. [Enable the ARC Rspamd module][rspamd-docs::arc] by creating a config file at `docker-data/dms/config/rspamd/override.d/arc.conf`.
|
||||
|
||||
A simple configuration could look like this:
|
||||
!!! example
|
||||
|
||||
```cf
|
||||
# documentation: https://rspamd.com/doc/modules/dkim_signing.html
|
||||
For each mail domain you have DMS manage, add the equivalent `example.com` sub-section to `domain` and adjust the `path` + `selector` fields as necessary.
|
||||
|
||||
enabled = true;
|
||||
|
||||
sign_authenticated = true;
|
||||
```conf title="rspamd/override.d/arc.conf"
|
||||
sign_local = true;
|
||||
|
||||
use_domain = "header";
|
||||
use_redis = false; # don't change unless Redis also provides the DKIM keys
|
||||
use_esld = true;
|
||||
check_pubkey = true;
|
||||
sign_authenticated = true;
|
||||
|
||||
domain {
|
||||
example.com {
|
||||
path = "/path/to/example.private";
|
||||
selector = "woosh";
|
||||
path = "/tmp/docker-mailserver/rspamd/dkim/rsa-2048-mail-example.private.txt";
|
||||
selector = "mail";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you have multiple domains and you want to sign with the modern ED25519 elliptic curve but also with RSA (you will likely want to have RSA as a fallback!):
|
||||
!!! tip "Using a common keypair"
|
||||
|
||||
```cf
|
||||
# documentation: https://rspamd.com/doc/modules/dkim_signing.html
|
||||
As with DKIM, the keypair can be shared across your configured domains.
|
||||
|
||||
enabled = true;
|
||||
|
||||
sign_authenticated = true;
|
||||
sign_local = true;
|
||||
|
||||
use_domain = "header";
|
||||
use_redis = false; # don't change unless Redis also provides the DKIM keys
|
||||
use_esld = true;
|
||||
check_pubkey = true;
|
||||
|
||||
domain {
|
||||
example.com {
|
||||
selectors [
|
||||
{
|
||||
path = "/path/to/com.example.rsa.private";
|
||||
selector = "dkim-rsa";
|
||||
},
|
||||
{
|
||||
path = /path/to/com.example.ed25519.private";
|
||||
selector = "dkim-ed25519";
|
||||
}
|
||||
]
|
||||
}
|
||||
example.org {
|
||||
selectors [
|
||||
{
|
||||
path = "/path/to/org.example.rsa.private";
|
||||
selector = "dkim-rsa";
|
||||
},
|
||||
{
|
||||
path = "/path/to/org.example.ed25519.private";
|
||||
selector = "dkim-ed25519";
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
Your ARC config can share the same DKIM private key + selector (_with associated DNS record for the public key_).
|
||||
|
||||
### _Abusix_ Integration
|
||||
|
||||
This subsection gives information about the integration of [Abusix], "a set of blocklists that work as an additional email security layer for your existing mail environment". The setup is straight-forward and well documented:
|
||||
This subsection provides information about the integration of [Abusix][abusix-web], "a set of blocklists that work as an additional email security layer for your existing mail environment". The setup is straight-forward and well documented:
|
||||
|
||||
1. [Create an account](https://app.abusix.com/signup)
|
||||
1. [Create an account][abusix-web::register]
|
||||
2. Retrieve your API key
|
||||
3. Navigate to the ["Getting Started" documentation for Rspamd][abusix-rspamd-integration] and follow the steps described there
|
||||
3. Navigate to the ["Getting Started" documentation for Rspamd][abusix-docs::rspamd-integration] and follow the steps described there
|
||||
4. Make sure to change `<APIKEY>` to your private API key
|
||||
|
||||
We recommend mounting the files directly into the container, as they are rather big and not manageable with the [modules script](#with-the-help-of-a-custom-file). If mounted to the correct location, Rspamd will automatically pick them up.
|
||||
We recommend mounting the files directly into the container, as they are rather big and not manageable with our [`custom-command.conf` script](#with-the-help-of-a-custom-file). If mounted to the correct location, Rspamd will automatically pick them up.
|
||||
|
||||
While _Abusix_ can be integrated into Postfix, Postscreen and a multitude of other software, we recommend integrating _Abusix_ only into a single piece of software running in your mail server - everything else would be excessive and wasting queries. Moreover, we recommend the integration into suitable filtering software and not Postfix itself, as software like Postscreen or Rspamd can properly evaluate the return codes and other configuration.
|
||||
|
||||
[Abusix]: https://abusix.com/
|
||||
[abusix-rspamd-integration]: https://docs.abusix.com/abusix-mail-intelligence/gbG8EcJ3x3fSUv8cMZLiwA/getting-started/dmw9dcwSGSNQiLTssFAnBW#rspamd
|
||||
[rspamd-web]: https://rspamd.com/
|
||||
[rspamd-docs::bayes]: https://rspamd.com/doc/configuration/statistic.html
|
||||
[rspamd-docs::proxy-self-scan-mode]: https://rspamd.com/doc/workers/rspamd_proxy.html#self-scan-mode
|
||||
[rspamd-docs::web-ui]: https://rspamd.com/webui/
|
||||
[rspamd-docs::web-ui::password]: https://www.rspamd.com/doc/tutorials/quickstart.html#setting-the-controller-password
|
||||
[rspamd-docs::modules]: https://rspamd.com/doc/modules/
|
||||
[rspamd-docs::modules::rbl]: https://rspamd.com/doc/modules/rbl.html
|
||||
[rspamd-docs::config-directories]: https://rspamd.com/doc/faq.html#what-are-the-locald-and-overrided-directories
|
||||
[rspamd-docs::config::ucl-syntax]: https://rspamd.com/doc/configuration/ucl.html
|
||||
[rspamd-docs::config::overview]: https://rspamd.com/doc/configuration/index.html
|
||||
[rspamd-docs::config::quickstart]: https://rspamd.com/doc/tutorials/quickstart.html#configuring-rspamd
|
||||
[rspamd-docs::config::global]: https://rspamd.com/doc/configuration/options.html
|
||||
[rspamd-docs::config::workers]: https://rspamd.com/doc/workers/
|
||||
[rspamd-docs::config::worker-controller]: https://rspamd.com/doc/workers/controller.html
|
||||
[rspamd-docs::config::worker-proxy]: https://rspamd.com/doc/workers/rspamd_proxy.html
|
||||
|
||||
[//]: # (General Links)
|
||||
[wikipedia::arc]: https://en.wikipedia.org/wiki/Authenticated_Received_Chain
|
||||
[rspamd-docs::arc]: https://rspamd.com/doc/modules/arc.html
|
||||
|
||||
[homepage]: https://rspamd.com/
|
||||
[modules]: https://rspamd.com/doc/modules/
|
||||
[proxy-self-scan-mode]: https://rspamd.com/doc/workers/rspamd_proxy.html#self-scan-mode
|
||||
[dms-default-configuration]: https://github.com/docker-mailserver/docker-mailserver/tree/master/target/rspamd
|
||||
[rbl-vs-dnsbl]: https://forum.eset.com/topic/25277-dnsbl-vs-rbl-mail-security/?do=findComment&comment=119818
|
||||
[dkim-signing-module]: https://rspamd.com/doc/modules/dkim_signing.html
|
||||
[basic-options]: https://rspamd.com/doc/configuration/options.html
|
||||
[www::rbl-vs-dnsbl]: https://forum.eset.com/topic/25277-dnsbl-vs-rbl-mail-security/#comment-119818
|
||||
[abusix-web]: https://abusix.com/
|
||||
[abusix-web::register]: https://app.abusix.com/
|
||||
[abusix-docs::rspamd-integration]: https://abusix.com/docs/rspamd/
|
||||
[spamhaus::faq::dnsbl-usage]: https://www.spamhaus.org/faq/section/DNSBL%20Usage#365
|
||||
|
||||
[dms-repo::rspamd-actions-config]: https://github.com/docker-mailserver/docker-mailserver/tree/v15.0.0/target/rspamd/local.d/actions.conf
|
||||
[dms-repo::default-rspamd-configuration]: https://github.com/docker-mailserver/docker-mailserver/tree/v15.0.0/target/rspamd
|
||||
[gh-dms::guide::valkey]: https://github.com/docker-mailserver/docker-mailserver/issues/4001#issuecomment-2652596692
|
||||
[gh-dms::guide::rspamd-web]: https://github.com/orgs/docker-mailserver/discussions/4269#discussioncomment-11329588
|
||||
|
||||
[docs::env::enable-redis]: ../environment.md#enable_rspamd_redis
|
||||
[docs::spam-to-junk]: ../environment.md#move_spam_to_junk
|
||||
[docs::dkim-dmarc-spf]: ../best-practices/dkim_dmarc_spf.md
|
||||
[docs::dkim-with-rspamd]: ../best-practices/dkim_dmarc_spf.md#dkim
|
||||
|
||||
[docs::dms-volumes-config]: ../advanced/optional-config.md#volumes-config
|
||||
[docs::dms-volumes-state]: ../advanced/optional-config.md#volumes-state
|
||||
|
||||
[docs::faq::dns-servers]: ../../faq.md#what-about-dns-servers
|
||||
|
|
|
@ -6,7 +6,7 @@ There are multiple options to enable SSL (via [`SSL_TYPE`][docs-env::ssl-type]):
|
|||
|
||||
- Using [letsencrypt](#lets-encrypt-recommended) (recommended)
|
||||
- Using [Caddy](#caddy)
|
||||
- Using [Traefik](#traefik-v2)
|
||||
- Using [Traefik](#traefik)
|
||||
- Using [self-signed certificates](#self-signed-certificates)
|
||||
- Using [your own certificates](#bring-your-own-certificates)
|
||||
|
||||
|
@ -25,12 +25,12 @@ After installation, you can test your setup with:
|
|||
|
||||
## The FQDN
|
||||
|
||||
An [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) (_Fully Qualified Domain Name_) such as `mail.example.com` is required for `docker-mailserver` to function correctly, especially for looking up the correct SSL certificate to use.
|
||||
An [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) (_Fully Qualified Domain Name_) such as `mail.example.com` is required for DMS to function correctly, especially for looking up the correct SSL certificate to use.
|
||||
|
||||
- `mail.example.com` will still use `user@example.com` as the mail address. You do not need a bare domain for that.
|
||||
- We usually discourage assigning a bare domain (_When your DNS MX record does not point to a subdomain_) to represent `docker-mailserver`. However, an FQDN of [just `example.com` is also supported][docs-faq-baredomain].
|
||||
- We usually discourage assigning a bare domain (_When your DNS MX record does not point to a subdomain_) to represent DMS. However, an FQDN of [just `example.com` is also supported][docs-faq-baredomain].
|
||||
- Internally, `hostname -f` will be used to retrieve the FQDN as configured in the below examples.
|
||||
- Wildcard certificates (eg: `*.example.com`) are supported for `SSL_TYPE=letsencrypt`. Your configured FQDN below may be `mail.example.com`, and your wildcard certificate provisioned to `/etc/letsencrypt/live/example.com` which will be checked as a fallback FQDN by `docker-mailserver`.
|
||||
- Wildcard certificates (eg: `*.example.com`) are supported for `SSL_TYPE=letsencrypt`. Your configured FQDN below may be `mail.example.com`, and your wildcard certificate provisioned to `/etc/letsencrypt/live/example.com` which will be checked as a fallback FQDN by DMS.
|
||||
|
||||
!!! example "Setting the hostname correctly"
|
||||
|
||||
|
@ -40,11 +40,11 @@ An [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) (_Fully Qua
|
|||
# CLI:
|
||||
docker run --hostname mail.example.com
|
||||
```
|
||||
|
||||
|
||||
or
|
||||
|
||||
|
||||
```yml
|
||||
# docker-compose.yml
|
||||
# compose.yaml
|
||||
services:
|
||||
mailserver:
|
||||
hostname: mail.example.com
|
||||
|
@ -54,10 +54,10 @@ An [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) (_Fully Qua
|
|||
|
||||
### Let's Encrypt (Recommended)
|
||||
|
||||
To enable _Let's Encrypt_ for `docker-mailserver`, you have to:
|
||||
To enable _Let's Encrypt_ for DMS, you have to:
|
||||
|
||||
1. Get your certificate using the _Let's Encrypt_ client [Certbot][certbot::github].
|
||||
2. For your `docker-mailserver` container:
|
||||
2. For your DMS container:
|
||||
|
||||
- Add the environment variable `SSL_TYPE=letsencrypt`.
|
||||
- Mount [your local `letsencrypt` folder][certbot::certs-storage] as a volume to `/etc/letsencrypt`.
|
||||
|
@ -68,11 +68,11 @@ You don't have to do anything else. Enjoy!
|
|||
|
||||
`/etc/letsencrypt/live` stores provisioned certificates in individual folders named by their FQDN.
|
||||
|
||||
Make sure that the entire folder is mounted to `docker-mailserver` as there are typically symlinks from `/etc/letsencrypt/live/mail.example.com` to `/etc/letsencrypt/archive`.
|
||||
Make sure that the entire folder is mounted to DMS as there are typically symlinks from `/etc/letsencrypt/live/mail.example.com` to `/etc/letsencrypt/archive`.
|
||||
|
||||
!!! example
|
||||
|
||||
Add these additions to the `mailserver` service in your [`docker-compose.yml`][github-file-compose]:
|
||||
Add these additions to the `mailserver` service in your [`compose.yaml`][github-file-compose]:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
@ -86,7 +86,7 @@ You don't have to do anything else. Enjoy!
|
|||
|
||||
#### Example using Docker for _Let's Encrypt_ { data-toc-label='Certbot with Docker' }
|
||||
|
||||
Certbot provisions certificates to `/etc/letsencrypt`. Add a volume to store these, so that they can later be accessed by `docker-mailserver` container. You may also want to persist Certbot [logs][certbot::log-rotation], just in case you need to troubleshoot.
|
||||
Certbot provisions certificates to `/etc/letsencrypt`. Add a volume to store these, so that they can later be accessed by DMS container. You may also want to persist Certbot [logs][certbot::log-rotation], just in case you need to troubleshoot.
|
||||
|
||||
1. Getting a certificate is this simple! (_Referencing: [Certbot docker instructions][certbot::docker] and [`certonly --standalone` mode][certbot::standalone]_):
|
||||
|
||||
|
@ -99,11 +99,11 @@ Certbot provisions certificates to `/etc/letsencrypt`. Add a volume to store the
|
|||
certbot/certbot certonly --standalone -d mail.example.com
|
||||
```
|
||||
|
||||
2. Add a volume for `docker-mailserver` that maps the _local `certbot/certs/` folder_ to the container path `/etc/letsencrypt/`.
|
||||
2. Add a volume for DMS that maps the _local `certbot/certs/` folder_ to the container path `/etc/letsencrypt/`.
|
||||
|
||||
!!! example
|
||||
|
||||
Add these additions to the `mailserver` service in your [`docker-compose.yml`][github-file-compose]:
|
||||
Add these additions to the `mailserver` service in your [`compose.yaml`][github-file-compose]:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
@ -134,6 +134,8 @@ Certbot provisions certificates to `/etc/letsencrypt`. Add a volume to store the
|
|||
```
|
||||
|
||||
This process can also be [automated via _cron_ or _systemd timers_][certbot::automated-renewal].
|
||||
|
||||
- [Example with a systemd timer][certbot::automated-renewal::example-systemd-timer]
|
||||
|
||||
!!! note "Using a different ACME CA"
|
||||
|
||||
|
@ -161,9 +163,10 @@ Obtain a Cloudflare API token:
|
|||
dns_cloudflare_api_token = YOUR_CLOUDFLARE_TOKEN_HERE
|
||||
```
|
||||
|
||||
- As this is sensitive data, you should restrict access to it with `chmod 600` and `chown 0:0`.
|
||||
- Store the file in a folder if you like, such as `docker-data/certbot/secrets/`.
|
||||
5. Your `docker-compose.yml` should include the following:
|
||||
- As this is sensitive data, you should restrict access to it with `chmod 600` and `chown 0:0`.
|
||||
- Store the file in a folder if you like, such as `docker-data/certbot/secrets/`.
|
||||
|
||||
5. Your `compose.yaml` should include the following:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
@ -172,7 +175,7 @@ Obtain a Cloudflare API token:
|
|||
# Set SSL certificate type.
|
||||
- SSL_TYPE=letsencrypt
|
||||
volumes:
|
||||
# Mount the cert folder generated by Certbot into mail-server:
|
||||
# Mount the cert folder generated by Certbot:
|
||||
- ./docker-data/certbot/certs/:/etc/letsencrypt/:ro
|
||||
|
||||
certbot-cloudflare:
|
||||
|
@ -206,7 +209,7 @@ Obtain a Cloudflare API token:
|
|||
6. Run the service to provision a certificate:
|
||||
|
||||
```sh
|
||||
docker-compose run certbot-cloudflare
|
||||
docker compose run certbot-cloudflare
|
||||
```
|
||||
|
||||
7. You should see the following log output:
|
||||
|
@ -220,7 +223,7 @@ Obtain a Cloudflare API token:
|
|||
This certificate expires on YYYY-MM-DD.
|
||||
These files will be updated when the certificate renews.
|
||||
NEXT STEPS:
|
||||
- The certificate will need to be renewed before it expires. Certbot can automatically renew the certificate in background, but you may need to take steps to enable that functionality. See https://certbot.org/renewal structions.
|
||||
- The certificate will need to be renewed before it expires. Certbot can automatically renew the certificate in background, but you may need to take steps to enable that functionality. See https://certbot.org/renewal instructions.
|
||||
```
|
||||
|
||||
After completing the steps above, your certificate should be ready to use.
|
||||
|
@ -229,7 +232,7 @@ After completing the steps above, your certificate should be ready to use.
|
|||
|
||||
We've only demonstrated how to provision a certificate, but it will expire in 90 days and need to be renewed before then.
|
||||
|
||||
In the following example, add a new service (`certbot-cloudflare-renew`) into `docker-compose.yml` that will handle certificate renewals:
|
||||
In the following example, add a new service (`certbot-cloudflare-renew`) into `compose.yaml` that will handle certificate renewals:
|
||||
|
||||
```yml
|
||||
services:
|
||||
|
@ -237,7 +240,7 @@ After completing the steps above, your certificate should be ready to use.
|
|||
image: certbot/dns-cloudflare:latest
|
||||
command: renew --dns-cloudflare --dns-cloudflare-credentials /run/secrets/cloudflare-api-token
|
||||
volumes:
|
||||
- ./docker-data/certbot/certs/:/etc/letsencrtypt/
|
||||
- ./docker-data/certbot/certs/:/etc/letsencrypt/
|
||||
- ./docker-data/certbot/logs/:/var/log/letsencrypt/
|
||||
secrets:
|
||||
- cloudflare-api-token
|
||||
|
@ -247,7 +250,7 @@ After completing the steps above, your certificate should be ready to use.
|
|||
You can manually run this service to renew the cert within 90 days:
|
||||
|
||||
```sh
|
||||
docker-compose run certbot-cloudflare-renew
|
||||
docker compose run certbot-cloudflare-renew
|
||||
```
|
||||
|
||||
You should see the following output
|
||||
|
@ -273,14 +276,14 @@ After completing the steps above, your certificate should be ready to use.
|
|||
(`crontab` example: Checks every day if the certificate should be renewed)
|
||||
|
||||
```sh
|
||||
0 0 * * * docker-compose -f PATH_TO_YOUR_DOCKER_COMPOSE_YML up certbot-cloudflare-renew
|
||||
0 0 * * * docker compose -f PATH_TO_YOUR_DOCKER_COMPOSE_YML up certbot-cloudflare-renew
|
||||
```
|
||||
|
||||
#### Example using `nginx-proxy` and `acme-companion` with Docker { data-toc-label='nginx-proxy with Docker' }
|
||||
|
||||
If you are running a web server already, port 80 will be in use which Certbot requires. You could use the [Certbot `--webroot`][certbot::webroot] feature, but it is more common to leverage a _reverse proxy_ that manages the provisioning and renewal of certificates for your services automatically.
|
||||
|
||||
In the following example, we show how `docker-mailserver` can be run alongside the docker containers [`nginx-proxy`][nginx-proxy::github] and [`acme-companion`][acme-companion::github] (_Referencing: [`acme-companion` documentation][acme-companion::docs]_):
|
||||
In the following example, we show how DMS can be run alongside the docker containers [`nginx-proxy`][nginx-proxy::github] and [`acme-companion`][acme-companion::github] (_Referencing: [`acme-companion` documentation][acme-companion::docs]_):
|
||||
|
||||
1. Start the _reverse proxy_ (`nginx-proxy`):
|
||||
|
||||
|
@ -314,7 +317,7 @@ In the following example, we show how `docker-mailserver` can be run alongside t
|
|||
|
||||
3. Start the rest of your web server containers as usual.
|
||||
|
||||
4. Start a _dummy container_ to provision certificates for your FQDN (eg: `mail.example.com`). `acme-companion` will detect the container and generate a _Let's Encrypt_ certificate for your domain, which can be used by `docker-mailserver`:
|
||||
4. Start a _dummy container_ to provision certificates for your FQDN (eg: `mail.example.com`). `acme-companion` will detect the container and generate a _Let's Encrypt_ certificate for your domain, which can be used by DMS:
|
||||
|
||||
```sh
|
||||
docker run --detach \
|
||||
|
@ -327,7 +330,7 @@ In the following example, we show how `docker-mailserver` can be run alongside t
|
|||
|
||||
You may want to add `--env LETSENCRYPT_TEST=true` to the above while testing, to avoid the _Let's Encrypt_ certificate generation rate limits.
|
||||
|
||||
5. Make sure your mount path to the `letsencrypt` certificates directory is correct. Edit your `docker-compose.yml` for the `mailserver` service to have volumes added like below:
|
||||
5. Make sure your mount path to the `letsencrypt` certificates directory is correct. Edit your `compose.yaml` for the `mailserver` service to have volumes added like below:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
|
@ -337,15 +340,15 @@ In the following example, we show how `docker-mailserver` can be run alongside t
|
|||
- ./docker-data/acme-companion/certs/:/etc/letsencrypt/live/:ro
|
||||
```
|
||||
|
||||
6. Then from the `docker-compose.yml` project directory, run: `docker-compose up -d mailserver`.
|
||||
6. Then from the `compose.yaml` project directory, run: `docker compose up -d mailserver`.
|
||||
|
||||
#### Example using `nginx-proxy` and `acme-companion` with `docker-compose` { data-toc-label='nginx-proxy with docker-compose' }
|
||||
|
||||
The following example is the [basic setup][acme-companion::basic-setup] you need for using `nginx-proxy` and `acme-companion` with `docker-mailserver` (_Referencing: [`acme-companion` documentation][acme-companion::docs]_):
|
||||
The following example is the [basic setup][acme-companion::basic-setup] you need for using `nginx-proxy` and `acme-companion` with DMS (_Referencing: [`acme-companion` documentation][acme-companion::docs]_):
|
||||
|
||||
???+ example "Example: `docker-compose.yml`"
|
||||
???+ example "Example: `compose.yaml`"
|
||||
|
||||
You should have an existing `docker-compose.yml` with a `mailserver` service. Below are the modifications to add for integrating with `nginx-proxy` and `acme-companion` services:
|
||||
You should have an existing `compose.yaml` with a `mailserver` service. Below are the modifications to add for integrating with `nginx-proxy` and `acme-companion` services:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
@ -385,7 +388,7 @@ The following example is the [basic setup][acme-companion::basic-setup] you need
|
|||
container_name: nginx-proxy-acme
|
||||
restart: always
|
||||
environment:
|
||||
# Only docker-compose v2 supports: `volumes_from: [nginx-proxy]`,
|
||||
# When `volumes_from: [nginx-proxy]` is not supported,
|
||||
# reference the _reverse-proxy_ `container_name` here:
|
||||
- NGINX_PROXY_CONTAINER=nginx-proxy
|
||||
volumes:
|
||||
|
@ -407,12 +410,12 @@ The following example is the [basic setup][acme-companion::basic-setup] you need
|
|||
|
||||
- `LETSENCRYPT_TEST=true`: _Recommended during initial setup_. Otherwise the default production endpoint has a [rate limit of 5 duplicate certificates per week][letsencrypt::limits]. Overrides `ACME_CA_URI` to use the _Let's Encrypt_ staging endpoint.
|
||||
- `LETSENCRYPT_EMAIL`: For when you don't use `DEFAULT_EMAIL` on `acme-companion`, or want to assign a different email contact for this container.
|
||||
- `LETSENCRYPT_KEYSIZE`: Allows you to configure the type (RSA or ECDSA) and size of the private key for your certificate. Default is RSA 4096.
|
||||
- `LETSENCRYPT_KEYSIZE`: Allows you to configure the type (RSA or ECDSA) and size of the private key for your certificate. Default is RSA 4096, but RSA 2048 is recommended.
|
||||
- `LETSENCRYPT_RESTART_CONTAINER=true`: When the certificate is renewed, the entire container will be restarted to ensure the new certificate is used.
|
||||
|
||||
[`acme-companion` ENV for default settings][acme-companion::env-config] that apply to all containers using `LETSENCRYPT_HOST`:
|
||||
|
||||
- `DEFAULT_EMAIL`: An email address that the CA (_eg: Let's Encrypt_) can contact you about expiring certificates, failed renewals, or for account recovery. You may want to use an email address not handled by your mail-server to ensure deliverability in the event your mail-server breaks.
|
||||
- `DEFAULT_EMAIL`: An email address that the CA (_eg: Let's Encrypt_) can contact you about expiring certificates, failed renewals, or for account recovery. You may want to use an email address not handled by your mail server to ensure deliverability in the event your mail server breaks.
|
||||
- `CERTS_UPDATE_INTERVAL`: If you need to adjust the frequency to check for renewals. 3600 seconds (1 hour) by default.
|
||||
- `DEBUG=1`: Should be helpful when [troubleshooting provisioning issues][acme-companion::troubleshooting] from `acme-companion` logs.
|
||||
- `ACME_CA_URI`: Useful in combination with `CA_BUNDLE` to use a private CA. To change the default _Let's Encrypt_ endpoint to the staging endpoint, use `https://acme-staging-v02.api.letsencrypt.org/directory`.
|
||||
|
@ -449,8 +452,8 @@ The following example is the [basic setup][acme-companion::basic-setup] you need
|
|||
# Optional variables:
|
||||
LETSENCRYPT_mail_TEST=true
|
||||
LETSENCRYPT_mail_EMAIL='admin@example.com'
|
||||
# RSA-4096 => `4096`, ECDSA-256 => `ec-256`:
|
||||
LETSENCRYPT_mail_KEYSIZE=4096
|
||||
# Supported values are `2048`, `3072` and `4096` for RSA keys, and `ec-256` or `ec-384` for elliptic curve keys.
|
||||
LETSENCRYPT_mail_KEYSIZE=2048
|
||||
```
|
||||
|
||||
Unlike with the equivalent ENV for containers, [changes to this file will **not** be detected automatically][acme-companion::standalone-changes]. You would need to wait until the next renewal check by `acme-companion` (_every hour by default_), restart `acme-companion`, or [manually invoke the _service loop_][acme-companion::service-loop]:
|
||||
|
@ -461,9 +464,9 @@ The following example is the [basic setup][acme-companion::basic-setup] you need
|
|||
|
||||
Version 6.2 and later of the Synology NAS DSM OS now come with an interface to generate and renew letencrypt certificates. Navigation into your DSM control panel and go to Security, then click on the tab Certificate to generate and manage letsencrypt certificates.
|
||||
|
||||
Amongst other things, you can use these to secure your mail-server. DSM locates the generated certificates in a folder below `/usr/syno/etc/certificate/_archive/`.
|
||||
Amongst other things, you can use these to secure your mail server. DSM locates the generated certificates in a folder below `/usr/syno/etc/certificate/_archive/`.
|
||||
|
||||
Navigate to that folder and note the 6 character random folder name of the certificate you'd like to use. Then, add the following to your `docker-compose.yml` declaration file:
|
||||
Navigate to that folder and note the 6 character random folder name of the certificate you'd like to use. Then, add the following to your `compose.yaml` declaration file:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
|
@ -478,114 +481,133 @@ DSM-generated letsencrypt certificates get auto-renewed every three months.
|
|||
|
||||
### Caddy
|
||||
|
||||
For Caddy v2 you can specify the `key_type` in your server's global settings, which would end up looking something like this if you're using a `Caddyfile`:
|
||||
[Caddy][web::caddy] is an open-source web server with built-in TLS certificate generation. You can use the [official Docker image][dockerhub::caddy] and write your own `Caddyfile`.
|
||||
|
||||
```caddyfile
|
||||
{
|
||||
debug
|
||||
admin localhost:2019
|
||||
http_port 80
|
||||
https_port 443
|
||||
default_sni example.com
|
||||
key_type rsa4096
|
||||
}
|
||||
```
|
||||
!!! example
|
||||
|
||||
If you are instead using a json config for Caddy v2, you can set it in your site's TLS automation policies:
|
||||
While DMS does not need a webserver to work, this workaround will provision a TLS certificate for DMS to use by adding a dummy site block to trigger cert provisioning.
|
||||
|
||||
??? example "Caddy v2 JSON example snippet"
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
# Basic Caddy service to provision certs:
|
||||
reverse-proxy:
|
||||
image: caddy:2.7
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- ${CADDY_DATA_DIR}:/data
|
||||
|
||||
```json
|
||||
{
|
||||
"apps": {
|
||||
"http": {
|
||||
"servers": {
|
||||
"srv0": {
|
||||
"listen": [
|
||||
":443"
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"match": [
|
||||
{
|
||||
"host": [
|
||||
"mail.example.com",
|
||||
]
|
||||
}
|
||||
],
|
||||
"handle": [
|
||||
{
|
||||
"handler": "subroute",
|
||||
"routes": [
|
||||
{
|
||||
"handle": [
|
||||
{
|
||||
"body": "",
|
||||
"handler": "static_response"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"terminal": true
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"tls": {
|
||||
"automation": {
|
||||
"policies": [
|
||||
{
|
||||
"subjects": [
|
||||
"mail.example.com",
|
||||
],
|
||||
"key_type": "rsa2048",
|
||||
"issuer": {
|
||||
"email": "admin@example.com",
|
||||
"module": "acme"
|
||||
}
|
||||
},
|
||||
{
|
||||
"issuer": {
|
||||
"email": "admin@example.com",
|
||||
"module": "acme"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
# Share the Caddy data volume for certs and configure SSL_TYPE to `letsencrypt`
|
||||
mailserver:
|
||||
image: ghcr.io/docker-mailserver/docker-mailserver:latest
|
||||
hostname: mail.example.com
|
||||
environment:
|
||||
SSL_TYPE: letsencrypt
|
||||
# While you could use a named data volume instead of a bind mount volume, it would require the long-syntax to rename cert files:
|
||||
# https://docs.docker.com/compose/compose-file/05-services/#volumes
|
||||
volumes:
|
||||
- ${CADDY_DATA_DIR}/certificates/acme-v02.api.letsencrypt.org-directory/mail.example.com/mail.example.com.crt:/etc/letsencrypt/live/mail.example.com/fullchain.pem
|
||||
- ${CADDY_DATA_DIR}/certificates/acme-v02.api.letsencrypt.org-directory/mail.example.com/mail.example.com.key:/etc/letsencrypt/live/mail.example.com/privkey.pem
|
||||
```
|
||||
|
||||
An explicit entry in your `Caddyfile` config will have Caddy provision and renew a certificate for your DMS FQDN:
|
||||
|
||||
```caddyfile title="Caddyfile"
|
||||
mail.example.com {
|
||||
# Optionally provision RSA 2048-bit certificate instead of ECDSA P-256:
|
||||
tls {
|
||||
key_type rsa2048
|
||||
}
|
||||
|
||||
# Optional, can be useful for troubleshooting
|
||||
# connection to Caddy with correct certificate:
|
||||
respond "Hello DMS"
|
||||
}
|
||||
```
|
||||
|
||||
The generated certificates can then be mounted:
|
||||
!!! info
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- ${CADDY_DATA_DIR}/certificates/acme-v02.api.letsencrypt.org-directory/mail.example.com/mail.example.com.crt:/etc/letsencrypt/live/mail.example.com/fullchain.pem
|
||||
- ${CADDY_DATA_DIR}/certificates/acme-v02.api.letsencrypt.org-directory/mail.example.com/mail.example.com.key:/etc/letsencrypt/live/mail.example.com/privkey.pem
|
||||
```
|
||||
An explicit `tls` directive affects only the site-address block it's used in:
|
||||
|
||||
### Traefik v2
|
||||
- Use [`tls internal { ... }`][caddy-docs::tls-internal] if wanting to create a local self-signed cert, which may be useful for testing. This allows opt-in to use self-signed certs unlike the global `local_certs` option.
|
||||
- [`key_type`][caddy-docs::key-type] can be used in the `tls` block if you need to enforce RSA as the key type for certificates provisioned. The default is currently ECDSA (P-256). This may improve compatibility with legacy clients.
|
||||
|
||||
[Traefik][traefik::github] is an open-source application proxy using the [ACME protocol][ietf::rfc::acme]. [Traefik][traefik::github] can request certificates for domains and subdomains, and it will take care of renewals, challenge negotiations, etc. We strongly recommend to use [Traefik][traefik::github]'s major version 2.
|
||||
??? example "With `caddy-docker-proxy`"
|
||||
|
||||
[Traefik][traefik::github]'s storage format is natively supported if the `acme.json` store is mounted into the container at `/etc/letsencrypt/acme.json`. The file is also monitored for changes and will trigger a reload of the mail services (Postfix and Dovecot).
|
||||
Using [`lucaslorentz/caddy-docker-proxy`][github::caddy-docker-proxy] allows you to generate a `Caddyfile` by adding labels to your services in `compose.yaml`:
|
||||
|
||||
Wildcard certificates are supported. If your FQDN is `mail.example.com` and your wildcard certificate is `*.example.com`, add the ENV: `#!bash SSL_DOMAIN=example.com`.
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
reverse-proxy:
|
||||
image: lucaslorentz/caddy-docker-proxy:2.8
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ${CADDY_DATA_DIR}:/data
|
||||
labels:
|
||||
# Set global config here, this option has an empty value to enable self-signed certs for local testing:
|
||||
# NOTE: Remove this label when going to production.
|
||||
caddy.local_certs: ""
|
||||
|
||||
The mail-server will select it's certificate from `acme.json` checking these ENV for a matching FQDN (_in order of priority_):
|
||||
# Use labels to configure Caddy to provision DMS certs
|
||||
mailserver:
|
||||
image: ghcr.io/docker-mailserver/docker-mailserver:latest
|
||||
hostname: mail.example.com
|
||||
environment:
|
||||
SSL_TYPE: letsencrypt
|
||||
volumes:
|
||||
- ${CADDY_DATA_DIR}/certificates/acme-v02.api.letsencrypt.org-directory/mail.example.com/mail.example.com.crt:/etc/letsencrypt/live/mail.example.com/fullchain.pem
|
||||
- ${CADDY_DATA_DIR}/certificates/acme-v02.api.letsencrypt.org-directory/mail.example.com/mail.example.com.key:/etc/letsencrypt/live/mail.example.com/privkey.pem
|
||||
labels:
|
||||
# Set your DMS FQDN here to add the site-address into the generated Caddyfile:
|
||||
caddy_0: mail.example.com
|
||||
# Adding a dummy directive is required:
|
||||
caddy_0.respond: "Hello DMS"
|
||||
# Uncomment to make a proxy for Rspamd:
|
||||
# caddy_1: rspamd.example.com
|
||||
# caddy_1.reverse_proxy: "{{upstreams 11334}}"
|
||||
```
|
||||
|
||||
1. `#!bash ${SSL_DOMAIN}`
|
||||
2. `#!bash ${HOSTNAME}`
|
||||
3. `#!bash ${DOMAINNAME}`
|
||||
!!! warning "Caddy certificate location varies"
|
||||
|
||||
This setup only comes with one caveat: The domain has to be configured on another service for [Traefik][traefik::github] to actually request it from _Let's Encrypt_, i.e. [Traefik][traefik::github] will not issue a certificate without a service / router demanding it.
|
||||
The path contains the certificate provisioner used. This path may be different from the example above for you and may change over time when [multiple ACME provisioner services are used][dms-pr-feedback::caddy-provisioning-gotcha].
|
||||
|
||||
This can make the volume mounting for DMS to find the certificates non-deterministic, but you can [restrict provisioning to single service via the `acme_ca` setting][caddy::restrict-acme-provisioner].
|
||||
|
||||
---
|
||||
|
||||
**NOTE:** Bind mounting a file directly instead of a directory will mount by inode. If the file is updated at renewal and this modifies the inode on the host system, then the container will still point to the old certificate.
|
||||
|
||||
If this happens, consider using our manual TLS type instead:
|
||||
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
mailserver:
|
||||
environment:
|
||||
SSL_TYPE: manual
|
||||
SSL_CERT_PATH: /srv/tls/mail.example.com/mail.example.com.crt
|
||||
SSL_KEY_PATH: /srv/tls/mail.example.com/mail.example.com.key
|
||||
volumes:
|
||||
- ${CADDY_DATA_DIR}/certificates/acme-v02.api.letsencrypt.org-directory/mail.example.com/:/srv/tls/mail.example.com/:ro
|
||||
```
|
||||
|
||||
### Traefik
|
||||
|
||||
[Traefik][traefik::github] is an open-source application proxy using the [ACME protocol][ietf::rfc::acme]. Traefik can request certificates for domains and subdomains, and it will take care of renewals, challenge negotiations, etc.
|
||||
|
||||
Traefik's storage format is natively supported if the `acme.json` store is mounted into the container at `/etc/letsencrypt/acme.json`. The file is also monitored for changes and will trigger a reload of the mail services (Postfix and Dovecot).
|
||||
|
||||
DMS will select it's certificate from `acme.json` prioritizing a match for the DMS FQDN (hostname), while also checking one DNS level up (_eg: `mail.example.com` => `example.com`_). Wildcard certificates are supported.
|
||||
|
||||
This setup only comes with one caveat - The domain has to be configured on another service for Traefik to actually request it from _Let's Encrypt_ (_i.e. Traefik will not issue a certificate without a service / router demanding it_).
|
||||
|
||||
???+ example "Example Code"
|
||||
Here is an example setup for [`docker-compose`](https://docs.docker.com/compose/):
|
||||
|
||||
Here is an example setup for [`Docker Compose`](https://docs.docker.com/compose/):
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
@ -594,7 +616,7 @@ This setup only comes with one caveat: The domain has to be configured on anothe
|
|||
container_name: mailserver
|
||||
hostname: mail.example.com
|
||||
volumes:
|
||||
- ./docker-data/traefik/acme.json:/etc/letsencrypt/acme.json:ro
|
||||
- ./docker-data/traefik/acme.json:/etc/letsencrypt/acme.json:ro
|
||||
environment:
|
||||
SSL_TYPE: letsencrypt
|
||||
SSL_DOMAIN: mail.example.com
|
||||
|
@ -605,26 +627,26 @@ This setup only comes with one caveat: The domain has to be configured on anothe
|
|||
image: docker.io/traefik:latest #v2.5
|
||||
container_name: docker-traefik
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
command:
|
||||
- --providers.docker
|
||||
- --entrypoints.http.address=:80
|
||||
- --entrypoints.http.http.redirections.entryPoint.to=https
|
||||
- --entrypoints.http.http.redirections.entryPoint.scheme=https
|
||||
- --entrypoints.https.address=:443
|
||||
- --entrypoints.https.http.tls.certResolver=letsencrypt
|
||||
- --certificatesresolvers.letsencrypt.acme.email=admin@example.com
|
||||
- --certificatesresolvers.letsencrypt.acme.storage=/acme.json
|
||||
- --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=http
|
||||
- --providers.docker
|
||||
- --entrypoints.http.address=:80
|
||||
- --entrypoints.http.http.redirections.entryPoint.to=https
|
||||
- --entrypoints.http.http.redirections.entryPoint.scheme=https
|
||||
- --entrypoints.https.address=:443
|
||||
- --entrypoints.https.http.tls.certResolver=letsencrypt
|
||||
- --certificatesresolvers.letsencrypt.acme.email=admin@example.com
|
||||
- --certificatesresolvers.letsencrypt.acme.storage=/acme.json
|
||||
- --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=http
|
||||
volumes:
|
||||
- ./docker-data/traefik/acme.json:/acme.json
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- ./docker-data/traefik/acme.json:/acme.json
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
|
||||
whoami:
|
||||
image: docker.io/traefik/whoami:latest
|
||||
labels:
|
||||
- "traefik.http.routers.whoami.rule=Host(`mail.example.com`)"
|
||||
- "traefik.http.routers.whoami.rule=Host(`mail.example.com`)"
|
||||
```
|
||||
|
||||
### Self-Signed Certificates
|
||||
|
@ -633,19 +655,19 @@ This setup only comes with one caveat: The domain has to be configured on anothe
|
|||
|
||||
Use self-signed certificates only for testing purposes!
|
||||
|
||||
This feature requires you to provide the following files into your [`docker-data/dms/config/ssl/` directory][docs-optional-config] (_internal location: `/tmp/docker-mailserver/ssl/`_):
|
||||
This feature requires you to provide the following files into your [`docker-data/dms/config/ssl/` directory][docs::dms-volumes-config] (_internal location: `/tmp/docker-mailserver/ssl/`_):
|
||||
|
||||
- `<FQDN>-key.pem`
|
||||
- `<FQDN>-cert.pem`
|
||||
- `demoCA/cacert.pem`
|
||||
|
||||
Where `<FQDN>` is the FQDN you've configured for your `docker-mailserver` container.
|
||||
Where `<FQDN>` is the FQDN you've configured for your DMS container.
|
||||
|
||||
Add `SSL_TYPE=self-signed` to your `docker-mailserver` environment variables. Postfix and Dovecot will be configured to use the provided certificate (_`.pem` files above_) during container startup.
|
||||
Add `SSL_TYPE=self-signed` to your DMS environment variables. Postfix and Dovecot will be configured to use the provided certificate (_`.pem` files above_) during container startup.
|
||||
|
||||
#### Generating a self-signed certificate
|
||||
|
||||
One way to generate self-signed certificates is with [Smallstep's `step` CLI](https://smallstep.com/docs/step-cli). This is exactly what [`docker-mailserver` does for creating test certificates][github-file::tls-readme].
|
||||
One way to generate self-signed certificates is with [Smallstep's `step` CLI](https://smallstep.com/docs/step-cli). This is exactly what [DMS does for creating test certificates][github-file::tls-readme].
|
||||
|
||||
For example with the FQDN `mail.example.test`, you can generate the required files by running:
|
||||
|
||||
|
@ -689,7 +711,7 @@ docker run --rm -it \
|
|||
|
||||
### Bring Your Own Certificates
|
||||
|
||||
You can also provide your own certificate files. Add these entries to your `docker-compose.yml`:
|
||||
You can also provide your own certificate files. Add these entries to your `compose.yaml`:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
|
@ -709,11 +731,11 @@ The local and internal paths may be whatever you prefer, so long as both `SSL_CE
|
|||
|
||||
!!! info
|
||||
|
||||
You may have to restart `docker-mailserver` once the certificates change.
|
||||
You may have to restart DMS once the certificates change.
|
||||
|
||||
## Testing a Certificate is Valid
|
||||
|
||||
- From your host:
|
||||
!!! example "Connect to DMS on port 25"
|
||||
|
||||
```sh
|
||||
docker exec mailserver openssl s_client \
|
||||
|
@ -722,26 +744,42 @@ The local and internal paths may be whatever you prefer, so long as both `SSL_CE
|
|||
-CApath /etc/ssl/certs/
|
||||
```
|
||||
|
||||
- Or:
|
||||
The response should show the certificate chain with a line further down: `Verify return code: 0 (ok)`
|
||||
|
||||
---
|
||||
|
||||
This example runs within the DMS container itself to verify the cert is working locally.
|
||||
|
||||
- Adjust the `-connect` IP if testing externally from another system. Additionally testing for port 143 (Dovecot IMAP) is encouraged (_change the protocol for `-starttls` from `smtp` to `imap`_).
|
||||
- `-CApath` will help verify the certificate chain, provided the location contains the root CA that signed your TLS cert for DMS.
|
||||
|
||||
??? example "Verify certificate dates"
|
||||
|
||||
```sh
|
||||
docker exec mailserver openssl s_client \
|
||||
-connect 0.0.0.0:143 \
|
||||
-starttls imap \
|
||||
-CApath /etc/ssl/certs/
|
||||
-connect 0.0.0.0:25 \
|
||||
-starttls smtp \
|
||||
-CApath /etc/ssl/certs/ \
|
||||
2>/dev/null | openssl x509 -noout -dates
|
||||
```
|
||||
|
||||
And you should see the certificate chain, the server certificate and: `Verify return code: 0 (ok)`
|
||||
!!! tip "Testing and troubleshooting"
|
||||
|
||||
In addition, to verify certificate dates:
|
||||
If you need to test a connection without resolving DNS, `curl` can connect with `--resolve` option to map an FQDN + Port to an IP address, instead of the request address provided.
|
||||
|
||||
```sh
|
||||
docker exec mailserver openssl s_client \
|
||||
-connect 0.0.0.0:25 \
|
||||
-starttls smtp \
|
||||
-CApath /etc/ssl/certs/ \
|
||||
2>/dev/null | openssl x509 -noout -dates
|
||||
```
|
||||
```bash
|
||||
# NOTE: You may want to use `--insecure` if the cert was provisioned with a private CA not present on the curl client:
|
||||
# Use `--verbose` for additional insights on the connection.
|
||||
curl --resolve mail.example.com:443:127.0.0.1 https://mail.example.com
|
||||
```
|
||||
|
||||
Similarly with `openssl` you can connect to an IP as shown previously, but provide an explicit SNI if necessary with `-servername mail.example.com`.
|
||||
|
||||
---
|
||||
|
||||
Both `curl` and `openssl` also support `-4` and `-6` for enforcing IPv4 or IPv6 lookup.
|
||||
|
||||
This can be useful, such as when [DNS resolves the IP to different servers leading to different certificates returned][dms-discussion::gotcha-fqdn-bad-dns]. As shown in that link, `step certificate inspect` is also handy for viewing details of the cert returned or on disk.
|
||||
|
||||
## Plain-Text Access
|
||||
|
||||
|
@ -835,7 +873,7 @@ You can of course run the script by cron once a week or something. In that way y
|
|||
```sh
|
||||
# This script is run inside docker-mailserver via 'docker exec ...', using the 'mail' command to send alerts.
|
||||
## code below will alert if certificate expires in less than two weeks
|
||||
## please adjust varables!
|
||||
## please adjust variables!
|
||||
## make sure the 'mail -s' command works! Test!
|
||||
|
||||
export SITE_URL="mail.example.com"
|
||||
|
@ -870,15 +908,15 @@ fi
|
|||
|
||||
## Custom DH Parameters
|
||||
|
||||
By default `docker-mailserver` uses [`ffdhe4096`][ffdhe4096-src] from [IETF RFC 7919][ietf::rfc::ffdhe]. These are standardized pre-defined DH groups and the only available DH groups for TLS 1.3. It is [discouraged to generate your own DH parameters][dh-avoid-selfgenerated] as it is often less secure.
|
||||
By default DMS uses [`ffdhe4096`][ffdhe4096-src] from [IETF RFC 7919][ietf::rfc::ffdhe]. These are standardized pre-defined DH groups and the only available DH groups for TLS 1.3. It is [discouraged to generate your own DH parameters][dh-avoid-selfgenerated] as it is often less secure.
|
||||
|
||||
Despite this, if you must use non-standard DH parameters or you would like to swap `ffdhe4096` for a different group (eg `ffdhe2048`); Add your own PEM encoded DH params file via a volume to `/tmp/docker-mailserver/dhparams.pem`. This will replace DH params for both Dovecot and Postfix services during container startup.
|
||||
|
||||
[docs-env::ssl-type]: ../environment.md#ssl_type
|
||||
[docs-optional-config]: ../advanced/optional-config.md
|
||||
[docs::dms-volumes-config]: ../advanced/optional-config.md#volumes-config
|
||||
[docs-faq-baredomain]: ../../faq.md#can-i-use-a-nakedbare-domain-ie-no-hostname
|
||||
|
||||
[github-file-compose]: https://github.com/docker-mailserver/docker-mailserver/blob/master/docker-compose.yml
|
||||
[github-file-compose]: https://github.com/docker-mailserver/docker-mailserver/blob/master/compose.yaml
|
||||
[github-file::tls-readme]: https://github.com/docker-mailserver/docker-mailserver/blob/3b8059f2daca80d967635e04d8d81e9abb755a4d/test/test-files/ssl/example.test/README.md
|
||||
[hanscees-renewcerts]: https://github.com/hanscees/dockerscripts/blob/master/scripts/tomav-renew-certs
|
||||
|
||||
|
@ -902,6 +940,7 @@ Despite this, if you must use non-standard DH parameters or you would like to sw
|
|||
[certbot::standalone]: https://certbot.eff.org/docs/using.html#standalone
|
||||
[certbot::renew]: https://certbot.eff.org/docs/using.html#renewing-certificates
|
||||
[certbot::automated-renewal]: https://certbot.eff.org/docs/using.html#automated-renewals
|
||||
[certbot::automated-renewal::example-systemd-timer]: https://github.com/orgs/docker-mailserver/discussions/3917#discussioncomment-8661690
|
||||
[certbot::custom-ca]: https://certbot.eff.org/docs/using.htmlchanging-the-acme-server
|
||||
[certbot::webroot]: https://certbot.eff.org/docs/using.html#webroot
|
||||
|
||||
|
@ -915,3 +954,13 @@ Despite this, if you must use non-standard DH parameters or you would like to sw
|
|||
[acme-companion::standalone]: https://github.com/nginx-proxy/acme-companion/blob/main/docs/Standalone-certificates.md
|
||||
[acme-companion::standalone-changes]: https://github.com/nginx-proxy/acme-companion/blob/main/docs/Standalone-certificates.md#picking-up-changes-to-letsencrypt_user_data
|
||||
[acme-companion::service-loop]: https://github.com/nginx-proxy/acme-companion/blob/main/docs/Container-utilities.md
|
||||
|
||||
[web::caddy]: https://caddyserver.com
|
||||
[dockerhub::caddy]: https://hub.docker.com/_/caddy
|
||||
[github::caddy-docker-proxy]: https://github.com/lucaslorentz/caddy-docker-proxy
|
||||
[dms-pr-feedback::caddy-provisioning-gotcha]: https://github.com/docker-mailserver/docker-mailserver/pull/3485/files#r1297512818
|
||||
[caddy-docs::tls-internal]: https://caddyserver.com/docs/caddyfile/directives/tls#syntax
|
||||
[caddy-docs::key-type]: https://caddyserver.com/docs/caddyfile/options#key-type
|
||||
[caddy::restrict-acme-provisioner]: https://caddy.community/t/is-there-a-way-on-a-caddyfile-to-force-a-specific-acme-ca/14506
|
||||
|
||||
[dms-discussion::gotcha-fqdn-bad-dns]: https://github.com/docker-mailserver/docker-mailserver/issues/3955#issuecomment-2027882633
|
||||
|
|
|
@ -15,8 +15,8 @@ Prefer ports with Implicit [TLS][wikipedia-tls] ports, they're more secure than
|
|||
| POP3 | 110 | 995 | Retrieval | No |
|
||||
| IMAP4 | 143 | 993 | Retrieval | Yes |
|
||||
|
||||
1. A connection _may_ be secured over TLS when both ends support `STARTTLS`. On ports 110, 143 and 587, `docker-mailserver` will reject a connection that cannot be secured. Port 25 is [required][ref-port25-mandatory] to support insecure connections.
|
||||
2. Receives email, `docker-mailserver` additionally filters for spam and viruses. For submitting email to the server to be sent to third-parties, you should prefer the _submission_ ports (465, 587) - which require authentication. Unless a relay host is configured (eg: SendGrid), outgoing email will leave the server via port 25 (_thus outbound traffic must not be blocked by your provider or firewall_).
|
||||
1. A connection _may_ be secured over TLS when both ends support `STARTTLS`. On ports 110, 143 and 587, DMS will reject a connection that cannot be secured. Port 25 is [required][ref-port25-mandatory] to support insecure connections.
|
||||
2. Receives email, DMS additionally filters for spam and viruses. For submitting email to the server to be sent to third-parties, you should prefer the _submission_ ports (465, 587) - which require authentication. Unless a relay host is configured (eg: SendGrid), outgoing email will leave the server via port 25 (_thus outbound traffic must not be blocked by your provider or firewall_).
|
||||
3. A _submission_ port since 2018 ([RFC 8314][rfc-8314]).
|
||||
|
||||
??? warning "Beware of outdated advice on port 465"
|
||||
|
@ -29,7 +29,6 @@ Prefer ports with Implicit [TLS][wikipedia-tls] ports, they're more secure than
|
|||
|
||||
Understand that port 587 is more broadly supported due to this history and that lots of software in that time has been built or configured with that port in mind. [`STARTTLS` is known to have various CVEs discovered even in recent years][starttls-vulnerabilities], do not be misled by any advice implying it should be preferred over implicit TLS. Trust in more official sources, such as the [config Postfix has][postfix-upstream-config-mastercf] which acknowledges the `submissions` port (465).
|
||||
|
||||
|
||||
### What Ports Should I Use? (SMTP)
|
||||
|
||||
```mermaid
|
||||
|
@ -67,18 +66,18 @@ Mail arriving at your server will be processed and stored in a mailbox, or sent
|
|||
|
||||
- **Port 25:**
|
||||
- Think of this like a physical mailbox, anyone can deliver mail to you here. Typically most mail is delivered to you on this port.
|
||||
-`docker-mailserver` will actively filter email delivered on this port for spam or viruses, and refuse mail from known bad sources.
|
||||
- DMS will actively filter email delivered on this port for spam or viruses, and refuse mail from known bad sources.
|
||||
- Connections to this port may be secure through STARTTLS, but is not mandatory as [mail is allowed to arrive via an unencrypted connection][ref-port25-mandatory].
|
||||
- It is possible for internal clients to submit mail to be sent outbound (_without requiring authentication_), but that is discouraged. Prefer the _submission_ ports.
|
||||
- **Port 465 and 587:**
|
||||
- This is the equivalent of a post office box where you would send email to be delivered on your behalf (_`docker-mailserver` is that metaphorical post office, aka the MTA_).
|
||||
- This is the equivalent of a post office box where you would send email to be delivered on your behalf (_DMS is that metaphorical post office, aka the MTA_).
|
||||
- These two ports are known as the _submission_ ports, they enable mail to be sent outbound to another MTA (eg: Outlook or Gmail) but require authentication via a [mail account][docs-accounts].
|
||||
- For inbound traffic, this is relevant when you send mail from your MUA (eg: ThunderBird). It's also used when `docker-mailserver` is configured as a mail relay, or when you have a service sending transactional mail (_eg: order confirmations, password resets, notifications_) through `docker-mailserver`.
|
||||
- For inbound traffic, this is relevant when you send mail from your MUA (eg: ThunderBird). It's also used when DMS is configured as a mail relay, or when you have a service sending transactional mail (_eg: order confirmations, password resets, notifications_) through DMS.
|
||||
- _**Prefer port 465**_ over port 587, as 465 provides Implicit TLS.
|
||||
|
||||
!!! note
|
||||
|
||||
When submitting mail (inbound) to be sent (outbound), this involves two separate connections to negotiate and secure. There may be additional intermediary connections which `docker-mailserver` is not involved in, and thus unable to ensure encrypted transit throughout delivery.
|
||||
When submitting mail (inbound) to be sent (outbound), this involves two separate connections to negotiate and secure. There may be additional intermediary connections which DMS is not involved in, and thus unable to ensure encrypted transit throughout delivery.
|
||||
|
||||
#### Outbound Traffic (On the Right)
|
||||
|
||||
|
@ -94,7 +93,7 @@ Mail being sent from your server is either being relayed through another MTA (eg
|
|||
|
||||
!!! tip
|
||||
|
||||
`docker-mailserver` can function as a relay too, but professional relay services have a trusted reputation (_which increases success of delivery_).
|
||||
DMS can function as a relay too, but professional relay services have a trusted reputation (_which increases success of delivery_).
|
||||
|
||||
An MTA with low reputation can affect if mail is treated as junk, or even rejected.
|
||||
|
||||
|
@ -113,7 +112,7 @@ Sometimes a reverse-proxy is involved, but is misconfigured or lacks support for
|
|||
|
||||
!!! note
|
||||
|
||||
- By default, `docker-mailserver` is configured to reject connections that fail to establish a secure connection (_when authentication is required_), rather than allow an insecure connection.
|
||||
- By default, DMS is configured to reject connections that fail to establish a secure connection (_when authentication is required_), rather than allow an insecure connection.
|
||||
- Port 25 does not require authentication. If `STARTTLS` is unsuccessful, mail can be received over an unencrypted connection. You can better secure this port between trusted parties with the addition of MTA-STS, [STARTTLS Policy List][starttls-policy-list], DNSSEC and DANE.
|
||||
|
||||
!!! warning
|
||||
|
@ -140,13 +139,13 @@ While Explicit TLS can provide the same benefit (_when `STARTTLS` is successfull
|
|||
|
||||
A related section or page on ciphers used may be useful, although less important for users to be concerned about.
|
||||
|
||||
### TLS connections for a Mail-Server, compared to web browsers
|
||||
### TLS connections for a Mail Server, compared to web browsers
|
||||
|
||||
Unlike with HTTP where a web browser client communicates directly with the server providing a website, a secure TLS connection as discussed below does not provide the equivalent safety that HTTPS does when the transit of email (receiving or sending) is sent through third-parties, as the secure connection is only between two machines, any additional machines (MTAs) between the MUA and the MDA depends on them establishing secure connections between one another successfully.
|
||||
|
||||
Other machines that facilitate a connection that generally aren't taken into account can exist between a client and server, such as those where your connection passes through your ISP provider are capable of compromising a `cleartext` connection through interception.
|
||||
|
||||
[docs-accounts]: ../user-management.md#accounts
|
||||
[docs-accounts]: ../account-management/overview.md#accounts
|
||||
[docs-relays]: ../advanced/mail-forwarding/relay-hosts.md
|
||||
[iana-services-465]: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=465
|
||||
[starttls-policy-list]: https://github.com/EFForg/starttls-everywhere#email-security-database-starttls-policy-list
|
||||
|
|
|
@ -1,123 +1,28 @@
|
|||
---
|
||||
title: Your best friend setup.sh
|
||||
title: About setup.sh
|
||||
hide:
|
||||
- toc
|
||||
---
|
||||
|
||||
[`setup.sh`][github-file-setupsh] is an administration script that helps with the most common tasks, including initial configuration. It is intended to be run from the host machine, _not_ from inside your running container.
|
||||
!!! note
|
||||
|
||||
The latest version of the script is included in the `docker-mailserver` repository. You may retrieve it at any time by running this command in your console:
|
||||
`setup.sh` is not required. We encourage you to use `docker exec -ti <CONTAINER NAME> setup` instead.
|
||||
|
||||
!!! warning
|
||||
|
||||
This script assumes Docker or Podman is used. You will not be able to use `setup.sh` with other container orchestration tools.
|
||||
|
||||
[`setup.sh`][github-file-setupsh] is a script that is complimentary to the internal `setup` command in DMS.
|
||||
|
||||
It mostly provides the convenience of aliasing `docker exec -ti <CONTAINER NAME> setup`, inferring the container name of a running DMS instance or running a new instance and bind mounting necessary volumes implicitly.
|
||||
|
||||
It is intended to be run from the host machine, _not_ from inside your running container. The latest version of the script is included in the DMS repository. You may retrieve it at any time by running this command in your console:
|
||||
|
||||
```sh
|
||||
wget https://raw.githubusercontent.com/docker-mailserver/docker-mailserver/master/setup.sh
|
||||
chmod a+x ./setup.sh
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Run `./setup.sh help` and you'll get ~~all you have ever wanted~~ some usage information:
|
||||
|
||||
```TXT
|
||||
SETUP(1)
|
||||
|
||||
NAME
|
||||
setup.sh - docker-mailserver administration script
|
||||
|
||||
SYNOPSIS
|
||||
./setup.sh [ OPTIONS... ] COMMAND [ help | ARGUMENTS... ]
|
||||
|
||||
COMMAND := { email | alias | quota | config | relay | debug } SUBCOMMAND
|
||||
|
||||
DESCRIPTION
|
||||
This is the main administration script that you use for all your interactions with
|
||||
'docker-mailserver'. Setup, configuration and much more is done with this script.
|
||||
|
||||
Please note that the script executes most of the commands inside the container itself.
|
||||
If the image was not found, this script will pull the ':latest' tag of
|
||||
'docker.io/mailserver/docker-mailserver'. This tag refers to the latest release,
|
||||
see the tagging convention in the README under
|
||||
https://github.com/docker-mailserver/docker-mailserver/blob/master/README.md
|
||||
|
||||
You will be able to see detailed information about the script you're invoking and
|
||||
its arguments by appending help after your command. Currently, this
|
||||
does not work with all scripts.
|
||||
|
||||
[SUB]COMMANDS
|
||||
COMMAND email :=
|
||||
./setup.sh email add <EMAIL ADDRESS> [<PASSWORD>]
|
||||
./setup.sh email update <EMAIL ADDRESS> [<PASSWORD>]
|
||||
./setup.sh email del [ OPTIONS... ] <EMAIL ADDRESS> [ <EMAIL ADDRESS>... ]
|
||||
./setup.sh email restrict <add|del|list> <send|receive> [<EMAIL ADDRESS>]
|
||||
./setup.sh email list
|
||||
|
||||
COMMAND alias :=
|
||||
./setup.sh alias add <EMAIL ADDRESS> <RECIPIENT>
|
||||
./setup.sh alias del <EMAIL ADDRESS> <RECIPIENT>
|
||||
./setup.sh alias list
|
||||
|
||||
COMMAND quota :=
|
||||
./setup.sh quota set <EMAIL ADDRESS> [<QUOTA>]
|
||||
./setup.sh quota del <EMAIL ADDRESS>
|
||||
|
||||
COMMAND config :=
|
||||
./setup.sh config dkim [ ARGUMENTS... ]
|
||||
|
||||
COMMAND relay :=
|
||||
./setup.sh relay add-auth <DOMAIN> <USERNAME> [<PASSWORD>]
|
||||
./setup.sh relay add-domain <DOMAIN> <HOST> [<PORT>]
|
||||
./setup.sh relay exclude-domain <DOMAIN>
|
||||
|
||||
COMMAND fail2ban =
|
||||
./setup.sh fail2ban
|
||||
./setup.sh fail2ban ban <IP>
|
||||
./setup.sh fail2ban unban <IP>
|
||||
|
||||
COMMAND debug :=
|
||||
./setup.sh debug fetchmail
|
||||
./setup.sh debug login <COMMANDS>
|
||||
./setup.sh debug show-mail-logs
|
||||
|
||||
EXAMPLES
|
||||
./setup.sh email add test@example.com [password]
|
||||
Add the email account test@example.com. You will be prompted
|
||||
to input a password afterwards if no password was supplied.
|
||||
When supplying `[password]`, it should be in plaintext.
|
||||
|
||||
./setup.sh config dkim keysize 2048 domain 'example.com,not-example.com'
|
||||
Creates keys of length 2048 but in an LDAP setup where domains are not known to
|
||||
Postfix by default, so you need to provide them yourself in a comma-separated list.
|
||||
|
||||
./setup.sh config dkim help
|
||||
This will provide you with a detailed explanation on how to use the
|
||||
config dkim command, showing what arguments can be passed and what they do.
|
||||
|
||||
OPTIONS
|
||||
Config path, container or image adjustments
|
||||
-i IMAGE_NAME
|
||||
Provides the name of the 'docker-mailserver' image. The default value is
|
||||
'docker.io/mailserver/docker-mailserver:latest'
|
||||
|
||||
-c CONTAINER_NAME
|
||||
Provides the name of the running container.
|
||||
|
||||
-p PATH
|
||||
Provides the config folder path to the temporary container
|
||||
(does not work if a 'docker-mailserver' container already exists).
|
||||
|
||||
SELinux
|
||||
-z
|
||||
Allows container access to the bind mount content that is shared among
|
||||
multiple containers on a SELinux-enabled host.
|
||||
|
||||
-Z
|
||||
Allows container access to the bind mount content that is private and
|
||||
unshared with other containers on a SELinux-enabled host.
|
||||
|
||||
EXIT STATUS
|
||||
Exit status is 0 if the command was successful. If there was an unexpected error, an error
|
||||
message is shown describing the error. In case of an error, the script will exit with exit
|
||||
status 1.
|
||||
|
||||
```
|
||||
For more information on using the script run: `./setup.sh help`.
|
||||
|
||||
[github-file-setupsh]: https://github.com/docker-mailserver/docker-mailserver/blob/master/setup.sh
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
# User Management
|
||||
|
||||
## Accounts
|
||||
|
||||
Users (email accounts) are managed in `/tmp/docker-mailserver/postfix-accounts.cf`. The best way to manage accounts is to use the reliable `setup` command inside the container. Just run `docker exec <CONTAINER NAME> setup help` and have a look at the section about subcommands, specifically the `email` subcommand.
|
||||
|
||||
### Adding a new Account
|
||||
|
||||
#### Via `setup` inside the container
|
||||
|
||||
You can add an account by running `docker exec -ti <CONTAINER NAME> setup email add <NEW ADDRESS>`. This method is strongly preferred.
|
||||
|
||||
#### Manually
|
||||
|
||||
!!! warning
|
||||
|
||||
This method is discouraged!
|
||||
|
||||
Alternatively, you may directly add the full email address and its encrypted password, separated by a pipe. To generate a new mail account data, directly from your host, you could for example run the following:
|
||||
|
||||
```sh
|
||||
docker run --rm -it \
|
||||
--env MAIL_USER=user1@example.com \
|
||||
--env MAIL_PASS=mypassword \
|
||||
ghcr.io/docker-mailserver/docker-mailserver:latest \
|
||||
/bin/bash -c \
|
||||
'echo "${MAIL_USER}|$(doveadm pw -s SHA512-CRYPT -u ${MAIL_USER} -p ${MAIL_PASS})" >>docker-data/dms/config/postfix-accounts.cf'
|
||||
```
|
||||
|
||||
You will then be asked for a password, and be given back the data for a new account entry, as text. To actually _add_ this new account, just copy all the output text in `docker-data/dms/config/postfix-accounts.cf` file of your running container.
|
||||
|
||||
The result could look like this:
|
||||
|
||||
```cf
|
||||
user1@example.com|{SHA512-CRYPT}$6$2YpW1nYtPBs2yLYS$z.5PGH1OEzsHHNhl3gJrc3D.YMZkvKw/vp.r5WIiwya6z7P/CQ9GDEJDr2G2V0cAfjDFeAQPUoopsuWPXLk3u1
|
||||
```
|
||||
|
||||
### Quotas
|
||||
|
||||
- `imap-quota` is enabled and allow clients to query their mailbox usage.
|
||||
- When the mailbox is deleted, the quota directive is deleted as well.
|
||||
- Dovecot quotas support LDAP, **but it's not implemented** (_PRs are welcome!_).
|
||||
|
||||
## Aliases
|
||||
|
||||
The best way to manage aliases is to use the reliable `setup` script inside the container. Just run `docker exec <CONTAINER NAME> setup help` and have a look at the section about subcommands, specifically the `alias`-subcommand.
|
||||
|
||||
### About
|
||||
|
||||
You may read [Postfix's documentation on virtual aliases][postfix-docs-alias] first. Aliases are managed in `/tmp/docker-mailserver/postfix-virtual.cf`. An alias is a full email address that will either be:
|
||||
|
||||
- delivered to an existing account registered in `/tmp/docker-mailserver/postfix-accounts.cf`
|
||||
- redirected to one or more other email addresses
|
||||
|
||||
Alias and target are space separated. An example on a server with `example.com` as its domain:
|
||||
|
||||
```cf
|
||||
# Alias delivered to an existing account
|
||||
alias1@example.com user1@example.com
|
||||
|
||||
# Alias forwarded to an external email address
|
||||
alias2@example.com external-account@gmail.com
|
||||
```
|
||||
|
||||
### Configuring RegExp Aliases
|
||||
|
||||
Additional regexp aliases can be configured by placing them into `docker-data/dms/config/postfix-regexp.cf`. The regexp aliases get evaluated after the virtual aliases (container path: `/tmp/docker-mailserver/postfix-virtual.cf`). For example, the following `docker-data/dms/config/postfix-regexp.cf` causes all email sent to "test" users to be delivered to `qa@example.com` instead:
|
||||
|
||||
```cf
|
||||
/^test[0-9][0-9]*@example.com/ qa@example.com
|
||||
```
|
||||
|
||||
### Address Tags (Extension Delimiters) as an alternative to Aliases
|
||||
|
||||
Postfix supports so-called address tags, in the form of plus (+) tags - i.e. `address+tag@example.com` will end up at `address@example.com`. This is configured by default and the (configurable!) separator is set to `+`. For more info, see [Postfix's official documentation][postfix-docs-extension-delimiters].
|
||||
|
||||
!!! note
|
||||
|
||||
If you do decide to change the configurable separator, you must add the same line to *both* `docker-data/dms/config/postfix-main.cf` and `docker-data/dms/config/dovecot.cf`, because Dovecot is acting as the delivery agent. For example, to switch to `-`, add:
|
||||
|
||||
```cf
|
||||
recipient_delimiter = -
|
||||
```
|
||||
|
||||
[postfix-docs-alias]: http://www.postfix.org/VIRTUAL_README.html#virtual_alias
|
||||
[postfix-docs-extension-delimiters]: http://www.postfix.org/postconf.5.html#recipient_delimiter
|
|
@ -13,13 +13,22 @@ When refactoring, writing or altering scripts or other files, adhere to these ru
|
|||
|
||||
## Documentation
|
||||
|
||||
You will need to have Docker installed. Navigate into the `docs/` directory. Then run:
|
||||
Make sure to select `edge` in the dropdown menu at the top. Navigate to the page you would like to edit and click the edit button in the top right. This allows you to make changes and create a pull-request.
|
||||
|
||||
Alternatively you can make the changes locally. For that you'll need to have Docker installed and run:
|
||||
|
||||
```sh
|
||||
docker run --rm -it -p 8000:8000 -v "${PWD}:/docs" squidfunk/mkdocs-material
|
||||
# From the root directory of the git clone:
|
||||
docker run --rm -it -p 8000:8000 -v "./docs:/docs" squidfunk/mkdocs-material
|
||||
```
|
||||
|
||||
This serves the documentation on your local machine on port `8000`. Each change will be hot-reloaded onto the page you view, just edit, save and look at the result.
|
||||
|
||||
!!! note
|
||||
|
||||
The container logs will inform you of invalid links detected, but a [few are false-positives][gh-dms::mkdocs-link-error-false-positives] due to our usage of linking to specific [content tabs][mkdocs::content-tabs].
|
||||
|
||||
[get-docker]: https://docs.docker.com/get-docker/
|
||||
[docs-bats-parallel]: https://bats-core.readthedocs.io/en/v1.8.2/usage.html#parallel-execution
|
||||
[gh-dms::mkdocs-link-error-false-positives]: https://github.com/docker-mailserver/docker-mailserver/pull/4366
|
||||
[mkdocs::content-tabs]: https://squidfunk.github.io/mkdocs-material/reference/content-tabs/#anchor-links
|
||||
|
|
|
@ -10,7 +10,7 @@ This project is Open Source. That means that you can contribute on enhancements,
|
|||
|
||||
**Before opening an issue**, read the [`README`][github-file-readme] carefully, study the docs for your version (maybe [latest][docs-latest]), the Postfix/Dovecot documentation and your search engine you trust. The issue tracker is not meant to be used for unrelated questions!
|
||||
|
||||
When opening an issue, please provide details use case to let the community reproduce your problem. Please start `docker-mailserver` with the environment variable `LOG_LEVEL` set to `debug` or `trace` and paste the output into the issue.
|
||||
When opening an issue, please provide details use case to let the community reproduce your problem. Please start DMS with the environment variable `LOG_LEVEL` set to `debug` or `trace` and paste the output into the issue.
|
||||
|
||||
!!! attention
|
||||
|
||||
|
@ -20,6 +20,18 @@ By raising issues, I agree to these terms and I understand, that the rules set f
|
|||
|
||||
Maintainers take the time to improve on this project and help by solving issues together. It is therefore expected from others to make an effort and **comply with the rules**.
|
||||
|
||||
### Filing a Bug Report
|
||||
|
||||
Thank you for participating in this project and reporting a bug. Docker Mail Server (DMS) is a community-driven project, and each contribution counts!
|
||||
|
||||
Maintainers and moderators are volunteers. We greatly appreciate reports that take the time to provide detailed information via the template, enabling us to help you in the best and quickest way. Ignoring the template provided may seem easier, but discourages receiving any support (_via assignment of the label `meta/no template - no support`_).
|
||||
|
||||
Markdown formatting can be used in almost all text fields (_unless stated otherwise in the description_).
|
||||
|
||||
Be as precise as possible, and if in doubt, it's best to add more information that too few.
|
||||
|
||||
When an option is marked with "not officially supported" / "unsupported", then support is dependent on availability from specific maintainers.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
!!! question "Motivation"
|
||||
|
@ -33,15 +45,15 @@ The development workflow is the following:
|
|||
1. Fork the project and clone your fork with `git clone --recurse-submodules ...` or run `git submodule update --init --recursive` after you cloned your fork
|
||||
2. Write the code that is needed :D
|
||||
3. Add integration tests if necessary
|
||||
4. [Prepare your environment and run linting and tests][docs-general-tests]
|
||||
5. Document your improvements if necessary (e.g. if you introduced new environment variables, describe those in the [ENV documentation][docs-environment]) and add your changes the changelog under the "Unreleased" section
|
||||
4. [Prepare your environment and run linting and tests][docs::contributing::tests]
|
||||
5. Document your improvements if necessary (e.g. if you introduced new environment variables, describe those in the [ENV documentation][docs::env]) and add your changes the changelog under the "Unreleased" section
|
||||
6. [Commit][commit] (and [sign your commit][gpg]), push and create a pull-request to merge into `master`. Please **use the pull-request template** to provide a minimum of contextual information and make sure to meet the requirements of the checklist.
|
||||
|
||||
Pull requests are automatically tested against the CI and will be reviewed when tests pass. When your changes are validated, your branch is merged. CI builds the new `:edge` image immediately and your changes will be includes in the next version release.
|
||||
|
||||
[docs-latest]: https://docker-mailserver.github.io/docker-mailserver/latest
|
||||
[github-file-readme]: https://github.com/docker-mailserver/docker-mailserver/blob/master/README.md
|
||||
[docs-environment]: ../config/environment.md
|
||||
[docs-general-tests]: ./general.md#tests
|
||||
[docs::env]: ../config/environment.md
|
||||
[docs::contributing::tests]: ./tests.md
|
||||
[commit]: https://help.github.com/articles/closing-issues-via-commit-messages/
|
||||
[gpg]: https://docs.github.com/en/github/authenticating-to-github/generating-a-new-gpg-key
|
||||
|
|
|
@ -51,7 +51,7 @@ Parallel tests are further partitioned into smaller sets. If your system has the
|
|||
To run the test suite, you will need to:
|
||||
|
||||
1. [Install Docker][get-docker]
|
||||
2. Install `jq` and (GNU) `parallel` (under Ubuntu, use `sudo apt-get -y install jq parallel`)
|
||||
2. Install `jq` , (GNU) `parallel` and `file` (under Ubuntu, use `sudo apt-get -y install jq parallel file`)
|
||||
3. Execute `git submodule update --init --recursive` if you haven't already initialized the git submodules
|
||||
|
||||
### Executing Test(s)
|
||||
|
@ -78,6 +78,10 @@ We use `make` to run commands.
|
|||
|
||||
When writing tests, ensure that parallel set tests still pass when run in parallel. You need to account for other tests running in parallel that may interfere with your own tests logic.
|
||||
|
||||
!!! tip
|
||||
|
||||
You may use `make run-local-instance` to run a version of the image built locally to test and edit your changes in a running DMS instance.
|
||||
|
||||
### An Example
|
||||
|
||||
In this example, you've made a change to the Rspamd feature support (_or adjusted it's tests_). First verify no regressions have been introduced by running it's specific test file:
|
||||
|
@ -85,10 +89,10 @@ In this example, you've made a change to the Rspamd feature support (_or adjuste
|
|||
```console
|
||||
$ make clean generate-accounts test/rspamd
|
||||
rspamd.bats
|
||||
✓ [Rspamd] Postfix's main.cf was adjusted [12]
|
||||
✓ [Rspamd] normal mail passes fine [44]
|
||||
✓ [Rspamd] detects and rejects spam [122]
|
||||
✓ [Rspamd] detects and rejects virus [189]
|
||||
✓ [Rspamd] Postfix's main.cf was adjusted [12]
|
||||
✓ [Rspamd] normal mail passes fine [44]
|
||||
✓ [Rspamd] detects and rejects spam [122]
|
||||
✓ [Rspamd] detects and rejects virus [189]
|
||||
```
|
||||
|
||||
As your feature work progresses your change for Rspamd also affects ClamAV. As your change now spans more than just the Rspamd test file, you could run multiple test files serially:
|
||||
|
@ -96,16 +100,17 @@ As your feature work progresses your change for Rspamd also affects ClamAV. As y
|
|||
```console
|
||||
$ make clean generate-accounts test/rspamd,clamav
|
||||
rspamd.bats
|
||||
✓ [Rspamd] Postfix's main.cf was adjusted [12]
|
||||
✓ [Rspamd] normal mail passes fine [44]
|
||||
✓ [Rspamd] detects and rejects spam [122]
|
||||
✓ [Rspamd] detects and rejects virus [189]
|
||||
✓ [Rspamd] Postfix's main.cf was adjusted [12]
|
||||
✓ [Rspamd] normal mail passes fine [44]
|
||||
✓ [Rspamd] detects and rejects spam [122]
|
||||
✓ [Rspamd] detects and rejects virus [189]
|
||||
|
||||
clamav.bats
|
||||
✓ [ClamAV] log files exist at /var/log/mail directory [68]
|
||||
✓ [ClamAV] should be identified by Amavis [67]
|
||||
✓ [ClamAV] freshclam cron is enabled [76]
|
||||
✓ [ClamAV] env CLAMAV_MESSAGE_SIZE_LIMIT is set correctly [63]
|
||||
✓ [ClamAV] rejects virus [60]
|
||||
✓ [ClamAV] log files exist at /var/log/mail directory [68]
|
||||
✓ [ClamAV] should be identified by Amavis [67]
|
||||
✓ [ClamAV] freshclam cron is enabled [76]
|
||||
✓ [ClamAV] env CLAMAV_MESSAGE_SIZE_LIMIT is set correctly [63]
|
||||
✓ [ClamAV] rejects virus [60]
|
||||
```
|
||||
|
||||
You're almost finished with your change before submitting it as a PR. It's a good idea to run the full parallel set those individual tests belong to (_especially if you've modified any tests_):
|
||||
|
@ -113,13 +118,15 @@ You're almost finished with your change before submitting it as a PR. It's a goo
|
|||
```console
|
||||
$ make clean generate-accounts tests/parallel/set1
|
||||
default_relay_host.bats
|
||||
✓ [Relay] (ENV) 'DEFAULT_RELAY_HOST' should configure 'main.cf:relayhost' [88]
|
||||
✓ [Relay] (ENV) 'DEFAULT_RELAY_HOST' should configure 'main.cf:relayhost' [88]
|
||||
|
||||
spam_virus/amavis.bats
|
||||
✓ [Amavis] SpamAssassin integration should be active [1165]
|
||||
✓ [Amavis] SpamAssassin integration should be active [1165]
|
||||
|
||||
spam_virus/clamav.bats
|
||||
✓ [ClamAV] log files exist at /var/log/mail directory [73]
|
||||
✓ [ClamAV] should be identified by Amavis [67]
|
||||
✓ [ClamAV] freshclam cron is enabled [76]
|
||||
✓ [ClamAV] log files exist at /var/log/mail directory [73]
|
||||
✓ [ClamAV] should be identified by Amavis [67]
|
||||
✓ [ClamAV] freshclam cron is enabled [76]
|
||||
...
|
||||
```
|
||||
|
||||
|
@ -127,7 +134,6 @@ Even better, before opening a PR run the full test suite:
|
|||
|
||||
```console
|
||||
$ make clean tests
|
||||
...
|
||||
```
|
||||
|
||||
[BATS]: https://github.com/bats-core/bats-core
|
||||
|
|
|
@ -4,7 +4,7 @@ title: 'Tutorials | Basic Installation'
|
|||
|
||||
## A Basic Example With Relevant Environmental Variables
|
||||
|
||||
This example provides you only with a basic example of what a minimal setup could look like. We **strongly recommend** that you go through the configuration file yourself and adjust everything to your needs. The default [docker-compose.yml](https://github.com/docker-mailserver/docker-mailserver/blob/master/docker-compose.yml) can be used for the purpose out-of-the-box, see the [_Usage_ chapter](../../usage.md).
|
||||
This example provides you only with a basic example of what a minimal setup could look like. We **strongly recommend** that you go through the configuration file yourself and adjust everything to your needs. The default [compose.yaml](https://github.com/docker-mailserver/docker-mailserver/blob/master/compose.yaml) can be used for the purpose out-of-the-box, see the [_Usage_ chapter](../../usage.md).
|
||||
|
||||
``` YAML
|
||||
services:
|
||||
|
@ -86,7 +86,7 @@ services:
|
|||
|
||||
This guide is focused on only using [SMTP ports (not POP3 and IMAP)][docs-ports] with the intent to relay mail received from another service to an external email address (eg: `user@gmail.com`). It is not intended for mailbox storage of real users.
|
||||
|
||||
In this setup `docker-mailserver` is not intended to receive email from the outside world, so no anti-spam or anti-virus software is needed, making the service lighter to run.
|
||||
In this setup DMS is not intended to receive email from the outside world, so no anti-spam or anti-virus software is needed, making the service lighter to run.
|
||||
|
||||
!!! tip "`setup`"
|
||||
|
||||
|
@ -96,14 +96,14 @@ In this setup `docker-mailserver` is not intended to receive email from the outs
|
|||
|
||||
Adding the docker network's gateway to the list of trusted hosts (_eg: using the `network` or `connected-networks` option_), can create an [**open relay**](https://en.wikipedia.org/wiki/Open_mail_relay). For instance [if IPv6 is enabled on the host machine, but not in Docker][github-issue-1405-comment].
|
||||
|
||||
1. Create the file `docker-compose.yml` with a content like this:
|
||||
1. Create the file `compose.yaml` with a content like this:
|
||||
|
||||
!!! example
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mailserver:
|
||||
image: docker.io/mailserver/docker-mailserver:latest
|
||||
image: ghcr.io/docker-mailserver/docker-mailserver:latest
|
||||
container_name: mailserver
|
||||
# Provide the FQDN of your mail server here (Your DNS MX record should point to this value)
|
||||
hostname: mail.example.com
|
||||
|
@ -137,7 +137,7 @@ In this setup `docker-mailserver` is not intended to receive email from the outs
|
|||
??? tip "Firewalled ports"
|
||||
|
||||
If you have a firewall running, you may need to open ports `25`, `587` and `465`.
|
||||
|
||||
|
||||
For example, with the firewall `ufw`, run:
|
||||
|
||||
```sh
|
||||
|
@ -145,27 +145,27 @@ In this setup `docker-mailserver` is not intended to receive email from the outs
|
|||
ufw allow 587
|
||||
ufw allow 465
|
||||
```
|
||||
|
||||
|
||||
**Caution:** This may [not be sound advice][github-issue-ufw].
|
||||
|
||||
2. Configure your DNS service to use an MX record for the _hostname_ (eg: `mail`) you configured in the previous step and add the [SPF][docs-spf] TXT record.
|
||||
|
||||
!!! tip "If you manually manage the DNS zone file for the domain"
|
||||
|
||||
|
||||
It would look something like this:
|
||||
|
||||
|
||||
```txt
|
||||
$ORIGIN example.com
|
||||
@ IN A 10.11.12.13
|
||||
mail IN A 10.11.12.13
|
||||
|
||||
; mail-server for example.com
|
||||
|
||||
; mail server for example.com
|
||||
@ IN MX 10 mail.example.com.
|
||||
|
||||
|
||||
; Add SPF record
|
||||
@ IN TXT "v=spf1 mx -all"
|
||||
```
|
||||
|
||||
|
||||
Then don't forget to change the `SOA` serial number, and to restart the service.
|
||||
|
||||
3. [Generate DKIM keys][docs-dkim] for your domain via `setup config dkim`.
|
||||
|
@ -182,7 +182,7 @@ In this setup `docker-mailserver` is not intended to receive email from the outs
|
|||
|
||||
4. Get an SSL certificate, [we have a guide for you here][docs-ssl] (_Let's Encrypt_ is a popular service to get free SSL certificates).
|
||||
|
||||
5. Start `docker-mailserver` and check the terminal output for any errors: `docker-compose up`.
|
||||
5. Start DMS and check the terminal output for any errors: `docker compose up`.
|
||||
|
||||
6. Create email accounts and aliases:
|
||||
|
||||
|
@ -214,12 +214,12 @@ In this setup `docker-mailserver` is not intended to receive email from the outs
|
|||
|
||||
This extra step is required to avoid the `553 5.7.1 Sender address rejected: not owned by user` error (_the accounts used for submitting mail to Gmail are `admin.gmail@example.com` and `info.gmail@example.com`_)
|
||||
|
||||
7. Send some test emails to these addresses and make other tests. Once everything is working well, stop the container with `ctrl+c` and start it again as a daemon: `docker-compose up -d`.
|
||||
7. Send some test emails to these addresses and make other tests. Once everything is working well, stop the container with `ctrl+c` and start it again as a daemon: `docker compose up -d`.
|
||||
|
||||
[docs-ports]: ../../config/security/understanding-the-ports.md
|
||||
[docs-environment]: ../../config/environment.md
|
||||
[docs-spf]: ../../config/best-practices/spf.md
|
||||
[docs-dkim]: ../../config/best-practices/dkim.md
|
||||
[docs-spf]: ../../config/best-practices/dkim_dmarc_spf.md#spf
|
||||
[docs-dkim]: ../../config/best-practices/dkim_dmarc_spf.md#dkim
|
||||
[docs-ssl]: ../../config/security/ssl.md#lets-encrypt-recommended
|
||||
[docs-usage]: ../../usage.md#get-up-and-running
|
||||
[github-issue-ufw]: https://github.com/docker-mailserver/docker-mailserver/issues/3151
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
title: 'Tutorials | Blog Posts'
|
||||
---
|
||||
|
||||
This site lists blog entries that write about the project. If you blogged about `docker-mailserver` let us know so we can add it here!
|
||||
This site lists blog entries that write about the project. If you blogged about DMS let us know so we can add it here!
|
||||
|
||||
- [Installing docker-mailserver](https://lowtek.ca/roo/2021/installing-docker-mailserver/) by [@andrewlow](https://github.com/andrewlow)
|
||||
- [Self hosted mail-server](https://www.ifthenel.se/self-hosted-mail-server/) by [@matrixes](https://github.com/matrixes)
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
---
|
||||
title: 'Tutorials | Crowdsec'
|
||||
---
|
||||
|
||||
!!! quote "What is Crowdsec?"
|
||||
|
||||
Crowdsec is an open source software that detects and blocks attackers using log analysis.
|
||||
It has access to a global community-wide IP reputation database.
|
||||
|
||||
[Source](https://www.crowdsec.net)
|
||||
|
||||
## Installation
|
||||
|
||||
Crowdsec supports multiple [installation methods][crowdsec-installation-docs], however this page will use the docker installation.
|
||||
|
||||
|
||||
### Docker mailserver
|
||||
|
||||
In your `compose.yaml` for the DMS service, add a bind mount volume for `/var/log/mail`. This is to share the DMS logs to a separate crowdsec container.
|
||||
|
||||
!!! example
|
||||
```yaml
|
||||
services:
|
||||
mailserver:
|
||||
- /docker-data/dms/mail-logs/:/var/log/mail/
|
||||
```
|
||||
|
||||
### Crowdsec
|
||||
|
||||
The crowdsec container should also bind mount the same host path for the DMS logs that was added in the DMS example above.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
image: crowdsecurity/crowdsec
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "6060:6060"
|
||||
volumes:
|
||||
- /docker-data/dms/mail-logs/:/var/log/dms:ro
|
||||
- ./acquis.d:/etc/crowdsec/acquis.d
|
||||
- crowdsec-db:/var/lib/crowdsec/data/
|
||||
environment:
|
||||
# These collection contains parsers and scenarios for postfix and dovecot
|
||||
COLLECTIONS: crowdsecurity/postfix crowdsecurity/dovecot
|
||||
TZ: Europe/Paris
|
||||
volumes:
|
||||
crowdsec-db:
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Configure crowdsec to read and parse DMS logs file.
|
||||
|
||||
!!! example
|
||||
|
||||
Create the file `dms.yml` in `./acquis.d/`
|
||||
|
||||
```yaml
|
||||
---
|
||||
source: file
|
||||
filenames:
|
||||
- /var/log/dms/mail.log
|
||||
labels:
|
||||
type: syslog
|
||||
```
|
||||
|
||||
!!! warning Bouncers
|
||||
|
||||
Crowdsec on its own is just a detection software, the remediation is done by components called bouncers.
|
||||
This page does not explain how to install or configure a bouncer. It can be found in [crowdsec documentation][crowdsec-bouncer-docs].
|
||||
|
||||
[crowdsec-installation-docs]: https://doc.crowdsec.net/docs/getting_started/install_crowdsec
|
||||
[crowdsec-bouncer-docs]: https://doc.crowdsec.net/docs/bouncers/intro
|
|
@ -10,7 +10,7 @@ You'll need to retrieve the git submodules prior to building your own Docker ima
|
|||
|
||||
```sh
|
||||
git submodule update --init --recursive
|
||||
docker build -t <YOUR CUSTOM IMAGE NAME> .
|
||||
docker build --tag <YOUR CUSTOM IMAGE NAME> .
|
||||
```
|
||||
|
||||
Or, you can clone and retrieve the submodules in one command:
|
||||
|
@ -21,19 +21,26 @@ git clone --recurse-submodules https://github.com/docker-mailserver/docker-mails
|
|||
|
||||
### About Docker
|
||||
|
||||
#### Version
|
||||
#### Minimum supported version
|
||||
|
||||
We make use of build-features that require a recent version of Docker. Depending on your distribution, please have a look at [the official installation documentation for Docker](https://docs.docker.com/engine/install/) to get the latest version. Otherwise, you may encounter issues, for example with the `--link` flag for a [`#!dockerfile COPY`](https://docs.docker.com/engine/reference/builder/#copy) command.
|
||||
We make use of build features that require a recent version of Docker. v23.0 or newer is advised, but earlier releases may work.
|
||||
|
||||
#### Environment
|
||||
- To get the latest version for your distribution, please have a look at [the official installation documentation for Docker](https://docs.docker.com/engine/install/).
|
||||
- If you are using a version of Docker prior to v23.0, you will need to enable BuildKit via the ENV [`DOCKER_BUILDKIT=1`](https://docs.docker.com/build/buildkit/#getting-started).
|
||||
|
||||
If you are not using `make` to build the image, note that you will need to provide `DOCKER_BUILDKIT=1` to the `docker build` command for the build to succeed.
|
||||
#### Build Arguments (Optional)
|
||||
|
||||
#### Build Arguments
|
||||
The `Dockerfile` includes several build [`ARG`][docker-docs::builder-arg] instructions that can be configured:
|
||||
|
||||
The `Dockerfile` takes additional, so-called build arguments. These are
|
||||
- `DOVECOT_COMMUNITY_REPO`: Install Dovecot from the community repo instead of from Debian (default = 0)
|
||||
- `DMS_RELEASE`: The image version (default = edge)
|
||||
- `VCS_REVISION`: The git commit hash used for the build (default = unknown)
|
||||
|
||||
1. `VCS_VERSION`: the image version (default = edge)
|
||||
2. `VCS_REVISION`: the image revision (default = unknown)
|
||||
!!! note
|
||||
|
||||
When using `make` to build the image, these are filled with proper values. You can build the image without supplying these arguments just fine though.
|
||||
- `DMS_RELEASE` (_when not `edge`_) will be used to check for updates from our GH releases page at runtime due to the default feature [`ENABLE_UPDATE_CHECK=1`][docs::env-update-check].
|
||||
- Both `DMS_RELEASE` and `VCS_REVISION` are also used with `opencontainers` metadata [`LABEL`][docker-docs::builder-label] instructions.
|
||||
|
||||
[docs::env-update-check]: https://docker-mailserver.github.io/docker-mailserver/latest/config/environment/#enable_update_check
|
||||
[docker-docs::builder-arg]: https://docs.docker.com/engine/reference/builder/#using-arg-variables
|
||||
[docker-docs::builder-label]: https://docs.docker.com/engine/reference/builder/#label
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
# Dovecot Full Text Search (FTS) using the Solr Backend
|
||||
|
||||
Dovecot supports several FTS backends for providing fast and efficient full text searching of e-mails directly from the IMAP server.
|
||||
|
||||
As the size of your mail storage grows, the benefits of FTS are especially notable:
|
||||
|
||||
- Without FTS, Dovecot would perform a search query by checking each individual email stored for a match, and then repeat this process again from scratch for the exact same query in future.
|
||||
- Some mail clients (_like Thunderbird_) may provide their own indexing and search features when all mail to search is stored locally, otherwise Dovecot needs to handle the search query (_for example webmail and mobile clients, like Gmail_).
|
||||
- FTS indexes each mail into a database for querying instead, where it can skip the cost of inspecting irrelevant emails for a query.
|
||||
|
||||
!!! warning "This is a community contributed guide"
|
||||
|
||||
It extends [our official docs for Dovecot FTS][docs::dovecot::full-text-search] with a focus on Apache Solr. DMS does not officially support this integration.
|
||||
|
||||
## Setup Solr for DMS
|
||||
|
||||
An FTS backend supported by Dovecot is [Apache Solr][github-solr], a fast and efficient multi-purpose search indexer.
|
||||
|
||||
### Add the required `dovecot-solr` package
|
||||
|
||||
As the official DMS image does not provide `dovecot-solr`, you'll need to include the package in your own image (_extending a DMS release as a base image_), or via our [`user-patches.sh` feature][docs::user-patches]:
|
||||
|
||||
<!-- This empty quote block is purely for a visual border -->
|
||||
!!! quote ""
|
||||
|
||||
=== "`user-patches.sh`"
|
||||
|
||||
If you'd prefer to avoid a custom image build. This approach is simpler but with the caveat that any time the container is restarted, you'll have a delay as the package is installed each time.
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
apt-get update && apt-get install dovecot-solr
|
||||
```
|
||||
|
||||
=== "`compose.yaml`"
|
||||
|
||||
A custom DMS image does not add much friction. You do not need a separate `Dockerfile` as Docker Compose supports building from an inline `Dockerfile` in your `compose.yaml`.
|
||||
|
||||
The `image` key of the service is swapped for the `build` key instead, as shown below:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mailserver:
|
||||
hostname: mail.example.com
|
||||
# The `image` setting now represents the tag for the local build configured below:
|
||||
image: local/dms:${DMS_TAG?Must set DMS image tag}
|
||||
# Local build (no need to try pull `image` remotely):
|
||||
pull_policy: build
|
||||
# Add this `build` section to your real `compose.yaml` for your DMS service:
|
||||
build:
|
||||
dockerfile_inline: |
|
||||
FROM docker.io/mailserver/docker-mailserver:${DMS_TAG?Must set DMS image tag}
|
||||
RUN apt-get update && apt-get install dovecot-solr
|
||||
```
|
||||
|
||||
This approach only needs to install the package once with the image build itself which minimizes the delay of container startup.
|
||||
|
||||
- Just run `DMS_TAG='14.0' docker compose up` and it will pull the DMS image, then build your custom DMS image to run a new container instance.
|
||||
- Updating to a new DMS release is straight-forward, just adjust the `DMS_TAG` ENV value or change the image tag directly in `compose.yaml` as you normally would to upgrade an image.
|
||||
- If you make future changes to the `dockerfile_inline` that don't seem to be applied, you may need to force a rebuild with `DMS_TAG='14.0' docker compose up --build`.
|
||||
|
||||
!!! note "Why doesn't DMS include `dovecot-solr`?"
|
||||
|
||||
This integration is not officially supported in DMS as no maintainer is able to provide troubleshooting support.
|
||||
|
||||
Prior to v14, the package was included but the community contributed guide had been outdated for several years that it was non-functional. It was decided that it was better to drop support and docs, however some DMS users voiced active use of Solr and it's benefits over Xapian for FTS which led to these revised docs.
|
||||
|
||||
**ARM64 builds do not have support for `dovecot-solr`**. Additionally the [user demand for including `dovecot-solr` is presently too low][gh-dms::feature-request::dovecot-solr-package] to justify vs the minimal effort to add additional packages as shown above.
|
||||
|
||||
### `compose.yaml` config
|
||||
|
||||
Firstly you need a working Solr container, for this the [official docker image][dockerhub-solr] will do:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
solr:
|
||||
image: solr:latest
|
||||
container_name: dms-solr
|
||||
environment:
|
||||
# As Solr can be quite resource hungry, raise the memory limit to 2GB.
|
||||
# The default is 512MB, which may be exhausted quickly.
|
||||
SOLR_JAVA_MEM: "-Xms2g -Xmx2g"
|
||||
volumes:
|
||||
- ./docker-data/solr:/var/solr
|
||||
restart: always
|
||||
```
|
||||
|
||||
DMS will connect internally to the `solr` service above. Either have both services in the same `compose.yaml` file, or ensure that the containers are connected to the same docker network.
|
||||
|
||||
### Configure Solr for Dovecot
|
||||
|
||||
1. Once the Solr container is started, you need to configure a "Solr core" for Dovecot:
|
||||
|
||||
```bash
|
||||
docker exec -it dms-solr /bin/sh
|
||||
solr create -c dovecot
|
||||
cp -R /opt/solr/contrib/analysis-extras/lib /var/solr/data/dovecot
|
||||
```
|
||||
|
||||
Stop the `dms-solr` container and you should now have a `./data/dovecot` folder in the local bind mount volume.
|
||||
|
||||
2. Solr needs a schema that is specifically tailored for Dovecot FTS.
|
||||
|
||||
As of writing of this guide, Solr 9 is the current release. [Dovecot provides the required schema configs][github-dovecot::core-docs] for Solr, copy the following two v9 config files to `./data/dovecot` and rename them accordingly:
|
||||
|
||||
- `solr-config-9.xml` (_rename to `solrconfig.xml`_)
|
||||
- `solr-schema-9.xml` (_rename to `schema.xml`_)
|
||||
|
||||
Additionally, remove the `managed-schema.xml` file from `./data/dovecot` and ensure the two files you copied have a [UID and GID of `8983`][dockerfile-solr-uidgid] assigned.
|
||||
|
||||
Start the Solr container once again, you should now have a working Solr core specifically for Dovecot FTS.
|
||||
|
||||
3. Configure Dovecot in DMS to connect to this Solr core:
|
||||
|
||||
Create a `10-plugin.conf` file in your `./config/dovecot` folder with this contents:
|
||||
|
||||
```config
|
||||
mail_plugins = $mail_plugins fts fts_solr
|
||||
|
||||
plugin {
|
||||
fts = solr
|
||||
fts_autoindex = yes
|
||||
fts_solr = url=http://dms-solr:8983/solr/dovecot/
|
||||
}
|
||||
```
|
||||
|
||||
Add a volume mount for that config to your DMS service in `compose.yaml`:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mailserver:
|
||||
volumes:
|
||||
- ./docker-data/config/dovecot/10-plugin.conf:/etc/dovecot/conf.d/10-plugin.conf:ro
|
||||
```
|
||||
|
||||
### Trigger Dovecot FTS indexing
|
||||
|
||||
After following the previous steps, restart DMS and run this command to have Dovecot re-index all mail:
|
||||
|
||||
```bash
|
||||
docker compose exec mailserver doveadm fts rescan -A
|
||||
```
|
||||
|
||||
!!! info "Indexing will take a while depending on how large your mail folders"
|
||||
|
||||
Usually within 15 minutes or so, you should be able to search your mail using the Dovecot FTS feature! :tada:
|
||||
|
||||
### Compatibility
|
||||
|
||||
Since Solr 9.8.0 was released (Jan 2025), a breaking change [deprecates support for `<lib>` directives][solr::9.8::lib-directive] which is presently used by the Dovecot supplied Solr config (`solr-config-9.xml`) to automatically load additional jars required.
|
||||
|
||||
To enable support for `<lib>` directives, add the following ENV to your `solr` container:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
solr:
|
||||
environment:
|
||||
SOLR_CONFIG_LIB_ENABLED: true
|
||||
```
|
||||
|
||||
!!! warning "Solr 10"
|
||||
|
||||
From the Solr 10 release onwards, this opt-in ENV will no longer be available.
|
||||
|
||||
If Dovecot has not updated their example Solr config ([upstream PR][dovecot::pr::solr-config-lib]), you will need to manually modify the Solr XML config to remove the `<lib>` directives and replace the suggested ENV `SOLR_CONFIG_LIB_ENABLED=true` with `SOLR_MODULES=analysis-extras`.
|
||||
|
||||
[docs::user-patches]: ../../config/advanced/override-defaults/user-patches.md
|
||||
[docs::dovecot::full-text-search]: ../../config/advanced/full-text-search.md
|
||||
[gh-dms::feature-request::dovecot-solr-package]: https://github.com/docker-mailserver/docker-mailserver/issues/4052
|
||||
|
||||
[dockerhub-solr]: https://hub.docker.com/_/solr
|
||||
[dockerfile-solr-uidgid]: https://github.com/apache/solr-docker/blob/9cd850b72309de05169544395c83a85b329d6b86/9.6/Dockerfile#L89-L92
|
||||
[github-solr]: https://github.com/apache/solr
|
||||
[github-dovecot::core-docs]: https://github.com/dovecot/core/tree/main/doc
|
||||
|
||||
[solr::9.8::lib-directive]: https://issues.apache.org/jira/browse/SOLR-16781
|
||||
[dovecot::pr::solr-config-lib]: https://github.com/dovecot/core/pull/238
|
|
@ -1,128 +1,422 @@
|
|||
---
|
||||
title: 'Tutorials | Mail-Server behind a Proxy'
|
||||
title: 'Tutorials | Mail Server behind a Proxy'
|
||||
---
|
||||
|
||||
## Using `docker-mailserver` behind a Proxy
|
||||
## Using a Reverse Proxy
|
||||
|
||||
### Information
|
||||
Guidance is provided via a Traefik config example, however if you're only familiar with configuring a reverse proxy for web services there are some differences to keep in mind.
|
||||
|
||||
If you are hiding your container behind a proxy service you might have discovered that the proxied requests from now on contain the proxy IP as the request origin. Whilst this behavior is technical correct it produces certain problems on the containers behind the proxy as they cannot distinguish the real origin of the requests anymore.
|
||||
- A security concern where preserving the client IP is important but needs to be handled at Layer 4 (TCP).
|
||||
- TLS will be handled differently due protocols like STARTTLS and the need to comply with standards for interoperability with other MTAs.
|
||||
- The ability to route the same port to different containers by FQDN can be limited.
|
||||
|
||||
To solve this problem on TCP connections we can make use of the [proxy protocol](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt). Compared to other workarounds that exist (`X-Forwarded-For` which only works for HTTP requests or `Tproxy` that requires you to recompile your kernel) the proxy protocol:
|
||||
This reduces many of the benefits for why you might use a reverse proxy, but they can still be useful.
|
||||
|
||||
- It is protocol agnostic (can work with any layer 7 protocols, even when encrypted).
|
||||
- It does not require any infrastructure changes.
|
||||
- NAT-ing firewalls have no impact it.
|
||||
- It is scalable.
|
||||
Some deployments may require a service to route traffic (kubernetes) when deploying, in which case the below advice is important to understand well.
|
||||
|
||||
There is only one condition: **both endpoints** of the connection MUST be compatible with proxy protocol.
|
||||
The guide here has also been adapted for [our Kubernetes docs][docs::kubernetes].
|
||||
|
||||
Luckily `dovecot` and `postfix` are both Proxy-Protocol ready softwares so it depends only on your used reverse-proxy / loadbalancer.
|
||||
## What can go wrong?
|
||||
|
||||
### Configuration of the used Proxy Software
|
||||
Without a reverse proxy involved, a service is typically aware of the client IP for a connection.
|
||||
|
||||
The configuration depends on the used proxy system. I will provide the configuration examples of [traefik v2](https://traefik.io/) using IMAP and SMTP with implicit TLS.
|
||||
However when a reverse proxy routes the connection this information can be lost, and the proxied service mistakenly treats the client IP as the reverse proxy handling the connection.
|
||||
|
||||
Feel free to add your configuration if you achieved the same goal using different proxy software below:
|
||||
- That can be problematic when the client IP is meaningful information for the proxied service to act upon, especially when it [impacts security](#security-concerns).
|
||||
- The [PROXY protocol][networking::spec:proxy-protocol] is a well established solution to preserve the client IP when both the proxy and service have enabled the support.
|
||||
|
||||
??? "Traefik v2"
|
||||
??? abstract "Technical Details - HTTP vs TCP proxying"
|
||||
|
||||
Truncated configuration of traefik itself:
|
||||
A key difference for how the network is proxied relates to the [OSI Model][networking::osi-model]:
|
||||
|
||||
```yaml
|
||||
- Layer 7 (_Application layer protocols: SMTP / IMAP / HTTP / etc_)
|
||||
- Layer 4 (_Transport layer protocols: TCP / UDP_)
|
||||
|
||||
When working with Layer 7 and a protocol like HTTP, it is possible to inspect a protocol header like [`Forwarded`][networking::http-header::forwarded] (_or it's predecessor: [`X-Forwarded-For`][networking::http-header::x-forwarded-for]_). At a lower level with Layer 4, that information is not available and we are routing traffic agnostic to the application protocol being proxied.
|
||||
|
||||
A proxy can prepend the [PROXY protocol][networking::spec:proxy-protocol] header to the TCP/UDP connection as it is routed to the service, which must be configured to be compatible with PROXY protocol (_often this adds a restriction that connections must provide the header, otherwise they're rejected_).
|
||||
|
||||
Beyond your own proxy, traffic may be routed in the network by other means that would also rewrite this information such as Docker's own network management via `iptables` and `userland-proxy` (NAT). The PROXY header ensures the original source and destination IP addresses, along with their ports is preserved across transit.
|
||||
|
||||
## Configuration
|
||||
|
||||
### Reverse Proxy
|
||||
|
||||
The below guidance is focused on configuring [Traefik][traefik-web], but the advice should be roughly applicable elsewhere (_eg: [NGINX][nginx-docs::proxyprotocol], [Caddy][caddy::plugin::l4]_).
|
||||
|
||||
- Support requires the capability to proxy TCP (Layer 4) connections with PROXY protocol enabled for the upstream (DMS). The upstream must also support enabling PROXY protocol (_which for DMS services rejects any connection not using the protocol_).
|
||||
- TLS should not be terminated at the proxy, that should be delegated to DMS (_which should be configured with the TLS certs_). Reasoning is covered under the [ports section](#ports).
|
||||
|
||||
???+ example "Traefik service"
|
||||
|
||||
The Traefik service config is fairly standard, just define the necessary entrypoints:
|
||||
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
reverse-proxy:
|
||||
image: docker.io/traefik:latest # v2.5
|
||||
container_name: docker-traefik
|
||||
restart: always
|
||||
image: docker.io/traefik:latest # 2.10 / 3.0
|
||||
# CAUTION: In production you should configure the Docker API endpoint securely:
|
||||
# https://doc.traefik.io/traefik/providers/docker/#docker-api-access
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
command:
|
||||
- "--providers.docker"
|
||||
- "--providers.docker.exposedbydefault=false"
|
||||
- "--providers.docker.network=proxy"
|
||||
- "--entrypoints.web.address=:80"
|
||||
- "--entryPoints.websecure.address=:443"
|
||||
- "--entryPoints.smtp.address=:25"
|
||||
- "--entryPoints.smtp-ssl.address=:465"
|
||||
- "--entryPoints.imap-ssl.address=:993"
|
||||
- "--entryPoints.sieve.address=:4190"
|
||||
# Docker provider config:
|
||||
- --providers.docker=true
|
||||
- --providers.docker.exposedbydefault=false
|
||||
# DMS ports you want to proxy:
|
||||
- --entryPoints.mail-smtp.address=:25
|
||||
- --entryPoints.mail-submission.address=:587
|
||||
- --entryPoints.mail-submissions.address=:465
|
||||
- --entryPoints.mail-imap.address=:143
|
||||
- --entryPoints.mail-imaps.address=:993
|
||||
- --entryPoints.mail-pop3.address=:110
|
||||
- --entryPoints.mail-pop3s.address=:995
|
||||
- --entryPoints.mail-managesieve.address=:4190
|
||||
# Publish external access ports mapped to traefik entrypoint ports:
|
||||
ports:
|
||||
- "25:25"
|
||||
- "587:587"
|
||||
- "465:465"
|
||||
- "143:143"
|
||||
- "993:993"
|
||||
- "110:110"
|
||||
- "995:995"
|
||||
- "4190:4190"
|
||||
[...]
|
||||
```
|
||||
|
||||
Truncated list of necessary labels on the `docker-mailserver` container:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mailserver:
|
||||
image: ghcr.io/docker-mailserver/docker-mailserver:latest
|
||||
container_name: mailserver
|
||||
hostname: mail.example.com
|
||||
restart: always
|
||||
# An IP is assigned here for other services (Dovecot) to trust for PROXY protocol:
|
||||
networks:
|
||||
- proxy
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.tcp.routers.smtp.rule=HostSNI(`*`)"
|
||||
- "traefik.tcp.routers.smtp.entrypoints=smtp"
|
||||
- "traefik.tcp.routers.smtp.service=smtp"
|
||||
- "traefik.tcp.services.smtp.loadbalancer.server.port=25"
|
||||
- "traefik.tcp.services.smtp.loadbalancer.proxyProtocol.version=1"
|
||||
- "traefik.tcp.routers.smtp-ssl.rule=HostSNI(`*`)"
|
||||
- "traefik.tcp.routers.smtp-ssl.tls=false"
|
||||
- "traefik.tcp.routers.smtp-ssl.entrypoints=smtp-ssl"
|
||||
- "traefik.tcp.routers.smtp-ssl.service=smtp-ssl"
|
||||
- "traefik.tcp.services.smtp-ssl.loadbalancer.server.port=465"
|
||||
- "traefik.tcp.services.smtp-ssl.loadbalancer.proxyProtocol.version=1"
|
||||
- "traefik.tcp.routers.imap-ssl.rule=HostSNI(`*`)"
|
||||
- "traefik.tcp.routers.imap-ssl.entrypoints=imap-ssl"
|
||||
- "traefik.tcp.routers.imap-ssl.service=imap-ssl"
|
||||
- "traefik.tcp.services.imap-ssl.loadbalancer.server.port=10993"
|
||||
- "traefik.tcp.services.imap-ssl.loadbalancer.proxyProtocol.version=2"
|
||||
- "traefik.tcp.routers.sieve.rule=HostSNI(`*`)"
|
||||
- "traefik.tcp.routers.sieve.entrypoints=sieve"
|
||||
- "traefik.tcp.routers.sieve.service=sieve"
|
||||
- "traefik.tcp.services.sieve.loadbalancer.server.port=4190"
|
||||
[...]
|
||||
default:
|
||||
ipv4_address: 172.16.42.2
|
||||
|
||||
# Specifying a subnet to assign a fixed container IP to the reverse proxy:
|
||||
networks:
|
||||
default:
|
||||
name: my-network
|
||||
ipam:
|
||||
config:
|
||||
- subnet: "172.16.42.0/24"
|
||||
```
|
||||
|
||||
Keep in mind that it is necessary to use port `10993` here. More information below at `dovecot` configuration.
|
||||
!!! note "Extra considerations"
|
||||
|
||||
### Configuration of the Backend (`dovecot` and `postfix`)
|
||||
- [`--providers.docker.network=my-network`][traefik-docs::provider-docker::network] is useful when there is more than one network to consider.
|
||||
- If your deployment has any other hops (an edge proxy, load balancer, etc) between the reverse proxy and the client, you'll need PROXY protocol support throughout that chain. For Traefik this additionally requires [enabling PROXY protocol on your entry points][traefik-docs::entrypoint::proxyprotocol].
|
||||
|
||||
The following changes can be achieved completely by adding the content to the appropriate files by using the projects [function to overwrite config files][docs-optionalconfig].
|
||||
???+ example "Traefik labels for DMS"
|
||||
|
||||
Changes for `postfix` can be applied by adding the following content to `docker-data/dms/config/postfix-main.cf`:
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
dms:
|
||||
image: ghcr.io/docker-mailserver/docker-mailserver:latest
|
||||
hostname: mail.example.com
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
|
||||
```cf
|
||||
postscreen_upstream_proxy_protocol = haproxy
|
||||
```
|
||||
# These are examples, configure the equivalent for any additional ports you proxy.
|
||||
# Explicit TLS (STARTTLS):
|
||||
- traefik.tcp.routers.mail-smtp.rule=HostSNI(`*`)
|
||||
- traefik.tcp.routers.mail-smtp.entrypoints=smtp
|
||||
- traefik.tcp.routers.mail-smtp.service=smtp
|
||||
- traefik.tcp.services.mail-smtp.loadbalancer.server.port=25
|
||||
- traefik.tcp.services.mail-smtp.loadbalancer.proxyProtocol.version=2
|
||||
|
||||
and to `docker-data/dms/config/postfix-master.cf`:
|
||||
# Implicit TLS is no different, except for optional HostSNI support:
|
||||
- traefik.tcp.routers.mail-submissions.rule=HostSNI(`*`)
|
||||
- traefik.tcp.routers.mail-submissions.entrypoints=smtp-submissions
|
||||
- traefik.tcp.routers.mail-submissions.service=smtp-submissions
|
||||
- traefik.tcp.services.mail-submissions.loadbalancer.server.port=465
|
||||
- traefik.tcp.services.mail-submissions.loadbalancer.proxyProtocol.version=2
|
||||
# NOTE: Optionally match by SNI rule, this requires TLS passthrough (not compatible with STARTTLS):
|
||||
#- traefik.tcp.routers.mail-submissions.rule=HostSNI(`mail.example.com`)
|
||||
#- traefik.tcp.routers.mail-submissions.tls.passthrough=true
|
||||
```
|
||||
|
||||
```cf
|
||||
submission/inet/smtpd_upstream_proxy_protocol=haproxy
|
||||
smtps/inet/smtpd_upstream_proxy_protocol=haproxy
|
||||
```
|
||||
!!! note "PROXY protocol compatibility"
|
||||
|
||||
Changes for `dovecot` can be applied by adding the following content to `docker-data/dms/config/dovecot.cf`:
|
||||
Only TCP routers support enabling PROXY Protocol (via [`proxyProtocol.version=2`][traefik-docs::service-tcp::proxyprotocol])
|
||||
|
||||
```cf
|
||||
haproxy_trusted_networks = <your-proxy-ip>, <optional-cidr-notation>
|
||||
haproxy_timeout = 3 secs
|
||||
service imap-login {
|
||||
inet_listener imaps {
|
||||
haproxy = yes
|
||||
ssl = yes
|
||||
port = 10993
|
||||
}
|
||||
}
|
||||
```
|
||||
Postfix and Dovecot are both compatible with PROXY protocol v1 and v2.
|
||||
|
||||
!!! note
|
||||
Port `10993` is used here to avoid conflicts with internal systems like `postscreen` and `amavis` as they will exchange messages on the default port and obviously have a different origin then compared to the proxy.
|
||||
#### Ports
|
||||
|
||||
[docs-optionalconfig]: ../../config/advanced/optional-config.md
|
||||
??? abstract "Technical Details - Ports (Traefik config)"
|
||||
|
||||
!!! info "Explicit TLS (STARTTLS)"
|
||||
|
||||
**Service Ports:** `mail-smtp` (25), `mail-submission` (587), `mail-imap` (143), `mail-pop3` (110), `mail-managesieve` (4190)
|
||||
|
||||
---
|
||||
|
||||
- [Traefik expects the TCP router to not enable TLS][traefik-docs::router-tcp::server-first-protocols] (_see "Server First protocols"_) for these connections. They begin in plaintext and potentially upgrade the connection to TLS, Traefik has no involvement in STARTTLS.
|
||||
- Without an initial TLS connection, the [`HostSNI` router rule is not usable][traefik-docs::router-tcp::host-sni] (_see "HostSNI & TLS"_). This limits routing flexibility for these ports (_eg: routing these ports by the FQDN to different DMS containers_).
|
||||
|
||||
!!! info "Implicit TLS"
|
||||
|
||||
**Service Ports:** `mail-submissions` (465), `mail-imaps` (993), `mail-pop3s` (995)
|
||||
|
||||
---
|
||||
|
||||
The `HostSNI` router rule could specify the DMS FQDN instead of `*`:
|
||||
|
||||
- This requires the router to have TLS enabled, so that Traefik can inspect the server name sent by the client.
|
||||
- Traefik can only match the SNI to `*` when the client does not provide a server name. Some clients must explicitly opt-in, such as CLI clients `openssl` (`-servername`) and `swaks` (`--tls-sni`).
|
||||
- Add [`tls.passthrough=true` to the router][traefik-docs::router-tcp::passthrough] (_this implicitly enables TLS_).
|
||||
- Traefik should not terminate TLS, decryption should occur within DMS instead when proxying to the same implicit TLS ports.
|
||||
- Passthrough ignores any certificates configured for Traefik; DMS must be configured with the certificates instead (_[DMS can use `acme.json` from Traefik][docs::tls::traefik]_).
|
||||
|
||||
Unlike proxying HTTPS (port 443) to a container via HTTP (port 80), the equivalent for DMS service ports is not supported:
|
||||
|
||||
- Port 25 must secure the connection via STARTTLS to be reached publicly.
|
||||
- STARTTLS ports requiring authentication for Postfix (587) and Dovecot (110, 143, 4190) are configured to only permit authentication over an encrypted connection.
|
||||
- Support would require routing the implicit TLS ports to their explicit TLS equivalent ports with auth restrictions removed. `tls.passthrough.true` would not be required, additionally port 25 would always be unencrypted (_if the proxy exclusively manages TLS/certs_), or unreachable by public MTAs attempting delivery if the proxy enables implicit TLS for this port.
|
||||
|
||||
### DMS (Postfix + Dovecot)
|
||||
|
||||
???+ example "Enable PROXY protocol on existing service ports"
|
||||
|
||||
This can be handled via our config override support.
|
||||
|
||||
---
|
||||
|
||||
Postfix via [`postfix-master.cf`][docs::overrides::postfix]:
|
||||
|
||||
```cf title="docker-data/dms/config/postfix-master.cf"
|
||||
smtp/inet/postscreen_upstream_proxy_protocol=haproxy
|
||||
submission/inet/smtpd_upstream_proxy_protocol=haproxy
|
||||
submissions/inet/smtpd_upstream_proxy_protocol=haproxy
|
||||
```
|
||||
|
||||
[`postscreen_upstream_proxy_protocol`][postfix-docs::settings::postscreen_upstream_proxy_protocol] and [`smtpd_upstream_proxy_protocol`][postfix-docs::settings::smtpd_upstream_proxy_protocol] both specify the protocol type used by a proxy. `haproxy` represents the PROXY protocol.
|
||||
|
||||
---
|
||||
|
||||
Dovecot via [`dovecot.cf`][docs::overrides::dovecot]:
|
||||
|
||||
```cf title="docker-data/dms/config/dovecot.cf"
|
||||
haproxy_trusted_networks = 172.16.42.2
|
||||
|
||||
service imap-login {
|
||||
inet_listener imap {
|
||||
haproxy = yes
|
||||
}
|
||||
|
||||
inet_listener imaps {
|
||||
haproxy = yes
|
||||
}
|
||||
}
|
||||
|
||||
service pop3-login {
|
||||
inet_listener pop3 {
|
||||
haproxy = yes
|
||||
}
|
||||
|
||||
inet_listener pop3s {
|
||||
haproxy = yes
|
||||
}
|
||||
}
|
||||
|
||||
service managesieve-login {
|
||||
inet_listener sieve {
|
||||
haproxy = yes
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- [`haproxy_trusted_networks`][dovecot-docs::settings::haproxy-trusted-networks] must reference the reverse proxy IP, or a wider subnet using CIDR notation.
|
||||
- [`haproxy = yes`][dovecot-docs::service-config::haproxy] for the TCP listeners of each login service.
|
||||
|
||||
!!! warning "Internal traffic (_within the network or DMS itself_)"
|
||||
|
||||
- Direct connections to DMS from other containers within the internal network will be rejected when they don't provide the required PROXY header.
|
||||
- This can also affect services running within the DMS container itself if they attempt to make a connection and aren't PROXY protocol capable.
|
||||
|
||||
---
|
||||
|
||||
A solution is to configure alternative service ports that offer PROXY protocol support (as shown next).
|
||||
|
||||
Alternatively routing connections to DMS through the local reverse proxy via [DNS query rewriting][gh-dms::dns-rewrite-example] can work too.
|
||||
|
||||
??? example "Configuring services with separate ports for PROXY protocol"
|
||||
|
||||
In this example we'll take the original service ports and add `10000` for the new PROXY protocol service ports.
|
||||
|
||||
Traefik labels will need to update their service ports accordingly (eg: `.loadbalancer.server.port=10465`).
|
||||
|
||||
---
|
||||
|
||||
Postfix config now requires [our `user-patches.sh` support][docs::overrides::user-patches] to add new services in `/etc/postfix/master.cf`:
|
||||
|
||||
```bash title="docker-data/dms/config/user-patches.sh"
|
||||
#!/bin/bash
|
||||
|
||||
# Duplicate the config for the submission(s) service ports (587 / 465) with adjustments for the PROXY ports (10587 / 10465) and `syslog_name` setting:
|
||||
postconf -Mf submission/inet | sed -e s/^submission/10587/ -e 's/submission/submission-proxyprotocol/' >> /etc/postfix/master.cf
|
||||
postconf -Mf submissions/inet | sed -e s/^submissions/10465/ -e 's/submissions/submissions-proxyprotocol/' >> /etc/postfix/master.cf
|
||||
# Enable PROXY Protocol support for these new service variants:
|
||||
postconf -P 10587/inet/smtpd_upstream_proxy_protocol=haproxy
|
||||
postconf -P 10465/inet/smtpd_upstream_proxy_protocol=haproxy
|
||||
|
||||
# Create a variant for port 25 too (NOTE: Port 10025 is already assigned in DMS to Amavis):
|
||||
postconf -Mf smtp/inet | sed -e s/^smtp/12525/ >> /etc/postfix/master.cf
|
||||
# Enable PROXY Protocol support (different setting as port 25 is handled via postscreen), optionally configure a `syslog_name` to distinguish in logs:
|
||||
postconf -P 12525/inet/postscreen_upstream_proxy_protocol=haproxy 12525/inet/syslog_name=smtp-proxyprotocol
|
||||
```
|
||||
|
||||
Supporting port 25 with an additional PROXY protocol port will also require a `postfix-main.cf` override line for `postscreen` to work correctly:
|
||||
|
||||
```cf title="docker-data/dms/config/postfix-main.cf"
|
||||
postscreen_cache_map = proxy:btree:$data_directory/postscreen_cache
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Dovecot is mostly the same as before:
|
||||
|
||||
- A new service name instead of targeting one to modify.
|
||||
- Add the new port assignment.
|
||||
- Set [`ssl = yes`][dovecot-docs::service-config::ssl] when implicit TLS is needed.
|
||||
|
||||
```cf title="docker-data/dms/config/dovecot.cf"
|
||||
haproxy_trusted_networks = 172.16.42.2
|
||||
|
||||
service imap-login {
|
||||
inet_listener imap-proxied {
|
||||
haproxy = yes
|
||||
port = 10143
|
||||
}
|
||||
|
||||
inet_listener imaps-proxied {
|
||||
haproxy = yes
|
||||
port = 10993
|
||||
ssl = yes
|
||||
}
|
||||
}
|
||||
|
||||
service pop3-login {
|
||||
inet_listener pop3-proxied {
|
||||
haproxy = yes
|
||||
port = 10110
|
||||
}
|
||||
|
||||
inet_listener pop3s-proxied {
|
||||
haproxy = yes
|
||||
port = 10995
|
||||
ssl = yes
|
||||
}
|
||||
}
|
||||
|
||||
service managesieve-login {
|
||||
inet_listener sieve-proxied {
|
||||
haproxy = yes
|
||||
port = 14190
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Verification
|
||||
|
||||
Send an email through the reverse proxy. If you do not use the DNS query rewriting approach, you'll need to do this from an external client.
|
||||
|
||||
??? example "Sending a generic test mail through `swaks` CLI"
|
||||
|
||||
Run a `swaks` command and then check your DMS logs for the expected client IP, it should no longer be using the reverse proxy IP.
|
||||
|
||||
```bash
|
||||
# NOTE: It is common to find port 25 is blocked from outbound connections, you may only be able to test the submission(s) ports.
|
||||
swaks --helo not-relevant.test --server mail.example.com --port 25 -tls --from hello@not-relevant.test --to user@example.com
|
||||
```
|
||||
|
||||
- You can specify the `--server` as the DMS FQDN or an IP address, where either should connect to the reverse proxy service.
|
||||
- `not-relevant.test` technically may be subject to some tests, at least for port 25. With the submission(s) ports those should be exempt.
|
||||
- `-tls` will use STARTTLS on port 25, you can exclude it to send unencrypted, but it would still go through the same port/route being tested.
|
||||
- To test the submission ports use `--port 587 -tls` or `--port 465 -tlsc` with your credentials `--auth-user user@example.com --auth-password secret`
|
||||
- Add `--tls-sni mail.example.com` if you have configured `HostSNI` in Traefik router rules (_SNI routing is only valid for implicit TLS ports_).
|
||||
|
||||
??? warning "Do not rely on local testing alone"
|
||||
|
||||
Testing from the Docker host technically works, however the IP is likely subject to more manipulation via `iptables` than an external client.
|
||||
|
||||
The IP will likely appear as from the gateway IP of the Docker network associated to the reverse proxy, where that gateway IP then becomes the client IP when writing the PROXY protocol header.
|
||||
|
||||
## Security concerns
|
||||
|
||||
### Forgery
|
||||
|
||||
Since the PROXY protocol sends a header with the client IP rewritten for software to use instead, this could be abused by bad actors.
|
||||
|
||||
Software on the receiving end of the connection often supports configuring an IP or CIDR range of clients to trust receiving the PROXY protocol header from.
|
||||
|
||||
??? warning "Risk exposure"
|
||||
|
||||
If you trust more than the reverse proxy IP, you must consider the risk exposure:
|
||||
|
||||
- Any container within the network that is compromised could impersonate another IP (_container or external client_) which may have been configured to have additional access/exceptions granted.
|
||||
- If the reverse proxy is on a separate network/host than DMS, exposure of the PROXY protocol enabled ports outside the network increases the importance of narrowing trust. For example with the [known IPv6 to subnet Gateway IP routing gotcha][docs::ipv6::security-risks] in Docker, trusting the entire subnet DMS belongs to would wrongly trust external clients that have the subnet Gateway IP to impersonate any client IP.
|
||||
- There is a [known risk with Layer 2 switching][docker::networking::l2-switch-gotcha] (_applicable to VPC networks, impact varies by cloud vendor_):
|
||||
- Neighbouring hosts can indirectly route to ports published on the interfaces of a separate host system that shouldn't be reachable (_eg: localhost `127.0.0.1`, or a private subnet `172.16.0.0/12`_).
|
||||
- The scope of this in Docker is limited to published ports only when Docker uses `iptables` with the kernel tunable `sysctl net.ipv4.ip_forward=1` (enabled implicitly). Port access is via `HOST:CONTAINER` ports published to their respective interface(s), that includes the container IP + port.
|
||||
|
||||
While some concerns raised above are rather specific, these type of issues aren't exclusive to Docker and difficult to keep on top of as software is constantly changing. Limit the trusted networks where possible.
|
||||
|
||||
??? warning "Postfix has no concept of trusted proxies"
|
||||
|
||||
Postfix does not appear to have a way to configure trusted proxies like Dovecot does (`haproxy_trusted_networks`).
|
||||
|
||||
[`postscreen_access_list`][postfix-docs::settings::postscreen_access_list] (_or [`smtpd_client_restrictions`][postfix-docs::settings::smtpd_client_restrictions] with [`check_client_access`][postfix-docs::settings::check_client_access] for ports 587/465_) can both restrict access by IP via a [CIDR lookup table][postfix-docs::config-table::cidr], however the client IP is already rewritten at this point via PROXY protocol.
|
||||
|
||||
Thus those settings cannot be used for restricting access to only trusted proxies, only to the actual clients.
|
||||
|
||||
A similar setting [`mynetworks`][postfix-docs::settings::mynetworks] / [`PERMIT_DOCKER`][docs::env::permit_docker] manages elevated trust for bypassing security restrictions. While it is intended for trusted clients, it has no relevance to trusting proxies for the same reasons.
|
||||
|
||||
### Monitoring
|
||||
|
||||
While PROXY protocol works well with the reverse proxy, you may have some containers internally that interact with DMS on behalf of multiple clients.
|
||||
|
||||
??? example "Roundcube + Fail2Ban"
|
||||
|
||||
You may have other services with functionality like an API to send mail through DMS that likewise delegates credentials through DMS.
|
||||
|
||||
Roundcube is an example of this where authentication is delegated to DMS, which introduces the same concern with loss of client IP.
|
||||
|
||||
- While this service does implement some support for preserving the client IP, it is limited.
|
||||
- This may be problematic when monitoring services like Fail2Ban are enabled that scan logs for multiple failed authentication attempts which triggers a ban on the shared IP address.
|
||||
|
||||
You should adjust configuration of these monitoring services to monitor for auth failures from those services directly instead, adding an exclusion for that service IP from any DMS logs monitored (_but be mindful of PROXY header forgery risks_).
|
||||
|
||||
[docs::kubernetes]: ../../config/advanced/kubernetes.md#using-the-proxy-protocol
|
||||
|
||||
[docs::overrides::dovecot]: ../../config/advanced/override-defaults/dovecot.md
|
||||
[docs::overrides::postfix]: ../../config/advanced/override-defaults/postfix.md
|
||||
[docs::overrides::user-patches]: ../../config/advanced/override-defaults/user-patches.md
|
||||
[docs::ipv6::security-risks]: ../../config/advanced/ipv6.md#what-can-go-wrong
|
||||
[docs::tls::traefik]: ../../config/security/ssl.md#traefik
|
||||
[docs::env::permit_docker]: ../../config/environment.md#permit_docker
|
||||
[gh-dms::dns-rewrite-example]: https://github.com/docker-mailserver/docker-mailserver/issues/3866#issuecomment-1928877236
|
||||
|
||||
[nginx-docs::proxyprotocol]: https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol
|
||||
[caddy::plugin::l4]: https://github.com/mholt/caddy-l4
|
||||
|
||||
[traefik-web]: https://traefik.io
|
||||
[traefik-docs::entrypoint::proxyprotocol]: https://doc.traefik.io/traefik/routing/entrypoints/#proxyprotocol
|
||||
[traefik-docs::provider-docker::network]: https://doc.traefik.io/traefik/providers/docker/#network
|
||||
[traefik-docs::router-tcp::server-first-protocols]: https://doc.traefik.io/traefik/routing/routers/#entrypoints_1
|
||||
[traefik-docs::router-tcp::host-sni]: https://doc.traefik.io/traefik/routing/routers/#rule_1
|
||||
[traefik-docs::router-tcp::passthrough]: https://doc.traefik.io/traefik/routing/routers/#passthrough
|
||||
[traefik-docs::service-tcp::proxyprotocol]:https://doc.traefik.io/traefik/routing/services/#proxy-protocol
|
||||
|
||||
[dovecot-docs::settings::haproxy-trusted-networks]: https://doc.dovecot.org/settings/core/#core_setting-haproxy_trusted_networks
|
||||
[dovecot-docs::service-config::haproxy]: https://doc.dovecot.org/configuration_manual/service_configuration/#haproxy-v2-2-19
|
||||
[dovecot-docs::service-config::ssl]: https://doc.dovecot.org/configuration_manual/service_configuration/#ssl
|
||||
|
||||
[postfix-docs::config-table::cidr]: https://www.postfix.org/cidr_table.5.html
|
||||
[postfix-docs::settings::check_client_access]: https://www.postfix.org/postconf.5.html#check_client_access
|
||||
[postfix-docs::settings::mynetworks]: https://www.postfix.org/postconf.5.html#mynetworks
|
||||
[postfix-docs::settings::postscreen_access_list]: https://www.postfix.org/postconf.5.html#postscreen_access_list
|
||||
[postfix-docs::settings::postscreen_upstream_proxy_protocol]: https://www.postfix.org/postconf.5.html#postscreen_upstream_proxy_protocol
|
||||
[postfix-docs::settings::smtpd_client_restrictions]: https://www.postfix.org/postconf.5.html#smtpd_client_restrictions
|
||||
[postfix-docs::settings::smtpd_upstream_proxy_protocol]: https://www.postfix.org/postconf.5.html#smtpd_upstream_proxy_protocol
|
||||
|
||||
[docker::networking::l2-switch-gotcha]: https://github.com/moby/moby/issues/45610
|
||||
[networking::spec:proxy-protocol]: https://github.com/haproxy/haproxy/blob/master/doc/proxy-protocol.txt
|
||||
[networking::http-header::x-forwarded-for]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For
|
||||
[networking::http-header::forwarded]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded
|
||||
[networking::osi-model]: https://www.cloudflare.com/learning/ddos/glossary/open-systems-interconnection-model-osi/
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
---
|
||||
title: 'Examples | Use Cases | Lua Authentication'
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
Dovecot has the ability to let users create their own custom user provisioning and authentication providers in [Lua](https://en.wikipedia.org/wiki/Lua_(programming_language)#Syntax). This allows any data source that can be approached from Lua to be used for authentication, including web servers. It is possible to do more with Dovecot and Lua, but other use cases fall outside of the scope of this documentation page.
|
||||
|
||||
!!! warning "Community contributed guide"
|
||||
Dovecot authentication via Lua scripting is not officially supported in DMS. No assistance will be provided should you encounter any issues.
|
||||
|
||||
DMS provides the required packages to support this guide. Note that these packages will be removed should they introduce any future maintenance burden.
|
||||
|
||||
The example in this guide relies on the current way in which DMS works with Dovecot configuration files. Changes to this to accommodate new authentication methods such as OpenID Connect will likely break this example in the future. This guide is updated on a best-effort base.
|
||||
|
||||
Dovecot's Lua support can be used for user provisioning (userdb functionality) and/or password verification (passdb functionality). Consider using other userdb and passdb options before considering Lua, since Lua does require the use of additional (unsupported) program code that might require maintenance when updating DMS.
|
||||
|
||||
Each implementation of Lua-based authentication is custom. Therefore it is impossible to write documentation that covers every scenario. Instead, this page describes a single example scenario. If that scenario is followed, you will learn vital aspects that are necessary to kickstart your own Lua development:
|
||||
|
||||
- How to override Dovecot's default configuration to disable parts that conflict with your scenario.
|
||||
- How to make Dovecot use your Lua script.
|
||||
- How to add your own Lua script and any libraries it uses.
|
||||
- How to debug your Lua script.
|
||||
|
||||
## The example scenario
|
||||
|
||||
This scenario starts with [DMS being configured to use LDAP][docs::auth-ldap] for mailbox identification, user authorization and user authentication. In this scenario, [Nextcloud](https://nextcloud.com/) is also a service that uses the same LDAP server for user identification, authorization and authentication.
|
||||
|
||||
The goal of this scenario is to have Dovecot not authenticate the user against LDAP, but against Nextcloud using an [application password](https://docs.nextcloud.com/server/latest/user_manual/en/session_management.html#managing-devices). The idea behind this is that a compromised mailbox password does not compromise the user's account entirely. To make this work, Nextcloud is configured to [deny the use of account passwords by clients](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#token-auth-enforced) and to [disable account password reset through mail verification](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#lost-password-link).
|
||||
|
||||
If the application password is configured correctly, an adversary can only use it to access the user's mailbox on DMS, and CalDAV and CardDAV data on Nextcloud. File access through WebDAV can be disabled for the application password used to access mail. Having CalDAV and CardDAV compromised by the same password is a minor setback. If an adversary gets access to a Nextcloud application password through a device of the user, it is likely that the adversary also gets access to the user's calendars and contact lists anyway (locally or through the same account settings used for mail and CalDAV/CardDAV synchronization). The user's stored files in Nextcloud, the LDAP account password and any other services that rely on it would still be protected. A bonus is that a user is able to revoke and renew the mailbox password in Nextcloud for whatever reason, through a friendly user interface with all the security measures with which the Nextcloud instance is configured (e.g. verification of the current account password).
|
||||
|
||||
A drawback of this method is that any (compromised) Nextcloud application password can be used to access the user's mailbox. This introduces a risk that a Nextcloud application password used for something else (e.g. WebDAV file access) is compromised and used to access the user's mailbox. Discussion of that risk and possible mitigations fall outside of the scope of this scenario.
|
||||
|
||||
To answer the questions asked earlier for this specific scenario:
|
||||
|
||||
1. Do I want to use Lua to identify mailboxes and verify that users are authorized to use mail services? **No. Provisioning is done through LDAP.**
|
||||
1. Do I want to use Lua to verify passwords that users authenticate with for IMAP/POP3/SMTP in their mail clients? **Yes. Password authentication is done through Lua against Nextcloud.**
|
||||
1. If the answer is 'yes' to question 1 or 2: are there other methods that better facilitate my use case instead of custom scripts which rely on me being a developer and not just a user? **No. Only HTTP can be used to authenticate against Nextcloud, which is not supported natively by Dovecot or DMS.**
|
||||
|
||||
While it is possible to extend the authentication methods which Nextcloud can facilitate with [Nextcloud apps](https://apps.nextcloud.com/), there is currently a mismatch between what DMS supports and what Nextcloud applications can provide. This might change in the future. For now, Lua will be used to bridge the gap between DMS and Nextcloud for authentication only (Dovecot passdb), while LDAP will still be used to identify mailboxes and verify authorization (Dovecot userdb).
|
||||
|
||||
## Modify Dovecot's configuration
|
||||
|
||||
???+ example "Add to DMS volumes in `compose.yaml`"
|
||||
|
||||
```yaml
|
||||
# All new volumes are marked :ro to configure them as read-only, since their contents are not changed from inside the container
|
||||
volumes:
|
||||
# Configuration override to disable LDAP authentication
|
||||
- ./docker-data/dms/config/dovecot/auth-ldap.conf.ext:/etc/dovecot/conf.d/auth-ldap.conf.ext:ro
|
||||
# Configuration addition to enable Lua authentication
|
||||
- ./docker-data/dms/config/dovecot/auth-lua-httpbasic.conf:/etc/dovecot/conf.d/auth-lua-httpbasic.conf:ro
|
||||
# Directory containing Lua scripts
|
||||
- ./docker-data/dms/config/dovecot/lua/:/etc/dovecot/lua/:ro
|
||||
```
|
||||
|
||||
Create a directory for Lua scripts:
|
||||
```bash
|
||||
mkdir -p ./docker-data/dms/config/dovecot/lua
|
||||
```
|
||||
|
||||
Create configuration file `./docker-data/dms/config/dovecot/auth-ldap.conf.ext` for LDAP user provisioning:
|
||||
```
|
||||
userdb {
|
||||
driver = ldap
|
||||
args = /etc/dovecot/dovecot-ldap.conf.ext
|
||||
}
|
||||
```
|
||||
|
||||
Create configuration file `./docker-data/dms/config/dovecot/auth-lua-httpbasic.conf` for Lua user authentication:
|
||||
```
|
||||
passdb {
|
||||
driver = lua
|
||||
args = file=/etc/dovecot/lua/auth-httpbasic.lua blocking=yes
|
||||
}
|
||||
```
|
||||
|
||||
That is all for configuring Dovecot.
|
||||
|
||||
## Create the Lua script
|
||||
|
||||
Create Lua file `./docker-data/dms/config/dovecot/lua/auth-httpbasic.lua` with contents:
|
||||
|
||||
```lua
|
||||
local http_url = "https://nextcloud.example.com/remote.php/dav/"
|
||||
local http_method = "PROPFIND"
|
||||
local http_status_ok = 207
|
||||
local http_status_failure = 401
|
||||
local http_header_forwarded_for = "X-Forwarded-For"
|
||||
|
||||
package.path = package.path .. ";/etc/dovecot/lua/?.lua"
|
||||
local base64 = require("base64")
|
||||
|
||||
local http_client = dovecot.http.client {
|
||||
timeout = 1000;
|
||||
max_attempts = 1;
|
||||
debug = false;
|
||||
}
|
||||
|
||||
function script_init()
|
||||
return 0
|
||||
end
|
||||
|
||||
function script_deinit()
|
||||
end
|
||||
|
||||
function auth_passdb_lookup(req)
|
||||
local auth_request = http_client:request {
|
||||
url = http_url;
|
||||
method = http_method;
|
||||
}
|
||||
auth_request:add_header("Authorization", "Basic " .. (base64.encode(req.user .. ":" .. req.password)))
|
||||
auth_request:add_header(http_header_forwarded_for, req.remote_ip)
|
||||
local auth_response = auth_request:submit()
|
||||
local resp_status = auth_response:status()
|
||||
local reason = auth_response:reason()
|
||||
|
||||
local returnStatus = dovecot.auth.PASSDB_RESULT_INTERNAL_FAILURE
|
||||
local returnDesc = http_method .. " - " .. http_url .. " - " .. resp_status .. " " .. reason
|
||||
if resp_status == http_status_ok
|
||||
then
|
||||
returnStatus = dovecot.auth.PASSDB_RESULT_OK
|
||||
returnDesc = "nopassword=y"
|
||||
elseif resp_status == http_status_failure
|
||||
then
|
||||
returnStatus = dovecot.auth.PASSDB_RESULT_PASSWORD_MISMATCH
|
||||
returnDesc = ""
|
||||
end
|
||||
return returnStatus, returnDesc
|
||||
end
|
||||
```
|
||||
|
||||
Replace the hostname in the URL to the actual hostname of Nextcloud.
|
||||
|
||||
Dovecot [provides an HTTP client for use in Lua](https://doc.dovecot.org/admin_manual/lua/#dovecot.http.client). Aside of that, Lua by itself is pretty barebones. It chooses library compactness over included functionality. You can see that in that a separate library is referenced to add support for Base64 encoding, which is required for [HTTP basic access authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). This library (also a Lua script) is not included. It must be downloaded and stored in the same directory:
|
||||
|
||||
```bash
|
||||
cd ./docker-data/dms/config/dovecot/lua
|
||||
curl -JLO https://raw.githubusercontent.com/iskolbin/lbase64/master/base64.lua
|
||||
```
|
||||
|
||||
Only use native (pure Lua) libraries as dependencies if possible, such as `base64.lua` from the example. This ensures maximum compatibility. Performance is less of an issue since Lua scripts written for Dovecot probably won't be long or complex, and there won't be a lot of data processing by Lua itself.
|
||||
|
||||
## Debugging a Lua script
|
||||
|
||||
To see which Lua version is used by Dovecot if you plan to do something that is version dependent, run:
|
||||
|
||||
```bash
|
||||
docker exec CONTAINER_NAME strings /usr/lib/dovecot/libdovecot-lua.so|grep '^LUA_'
|
||||
```
|
||||
|
||||
While Dovecot logs the status of authentication attempts for any passdb backend, Dovecot will also log Lua scripting errors and messages sent to Dovecot's [Lua API log functions](https://doc.dovecot.org/admin_manual/lua/#dovecot.i_debug). The combined DMS log (including that of Dovecot) can be viewed using `docker logs CONTAINER_NAME`. If the log is too noisy (_due to other processes in the container also logging to it_), `docker exec CONTAINER_NAME cat /var/log/mail/mail.log` can be used to view the log of Dovecot and Postfix specifically.
|
||||
|
||||
If working with HTTP in Lua, setting `debug = true;` when initiating `dovecot.http.client` will create debug log messages for every HTTP request and response.
|
||||
|
||||
Note that Lua runs compiled bytecode, and that scripts will be compiled when they are initially started. Once compiled, the bytecode is cached and changes in the Lua script will not be processed automatically. Dovecot will reload its configuration and clear its cached Lua bytecode when running `docker exec CONTAINER_NAME dovecot reload`. A (changed) Lua script will be compiled to bytecode the next time it is executed after running the Dovecot reload command.
|
||||
|
||||
[docs::auth-ldap]: ../../config/account-management/provisioner/ldap.md
|
||||
[docs::dovecot-override-configuration]: ../../config/advanced/override-defaults/dovecot.md#override-configuration
|
||||
[docs::dovecot-add-configuration]: ../../config/advanced/override-defaults/dovecot.md#add-configuration
|
||||
[docs::faq-alter-running-dms-instance-without-container-relaunch]: ../../faq.md#how-to-alter-a-running-dms-instance-without-relaunching-the-container
|
|
@ -0,0 +1,106 @@
|
|||
---
|
||||
title: 'Use Cases | Binding outbound SMTP to a specific network'
|
||||
hide:
|
||||
- toc
|
||||
---
|
||||
|
||||
!!! warning "Advice not extensively tested"
|
||||
|
||||
This configuration advice is a community contribution which has only been verified as a solution when using `network: host`, where you have direct access to the host interfaces.
|
||||
|
||||
It may be applicable in other network modes if the container has control of the outbound IPs to bind to. This is not the case with bridge networks that typically bind to a private range network for containers which are bridged to a public interface via Docker.
|
||||
|
||||
If your Docker host is running multiple IPv4 and IPv6 IP-addresses, it may be beneficial to bind outgoing SMTP connections to specific IP-address / interface.
|
||||
|
||||
- When a mail is sent outbound from DMS, it greets the MTA it is connecting to with a EHLO (DMS FQDN) which might be verified against the IP resolved, and that a `PTR` record for that IP resolves an address back to the same IP.
|
||||
- A similar check with SPF can be against the envelope-sender address which may verify a DNS record like MX / A is valid (_or a similar restriction check from an MTA like [Postfix has with `reject_unknown_sender`][gh-pr::3465::comment-restrictions]_).
|
||||
- If the IP address is inconsistent for those connections from DMS, these DNS checks are likely to fail.
|
||||
|
||||
This can be configured by [overriding the default Postfix configurations][docs::overrides-postfix] DMS provides. Create `postfix-master.cf` and `postfix-main.cf` files for your config volume (`docker-data/dms/config`).
|
||||
|
||||
In `postfix-main.cf` you'll have to set the [`smtp_bind_address`][postfix-docs::smtp-bind-address-ipv4] and [`smtp_bind_address6`][postfix-docs::smtp-bind-address-ipv6]
|
||||
to the respective IP-address on the server you want to use.
|
||||
|
||||
!!! example
|
||||
|
||||
=== "Contributed solution"
|
||||
|
||||
```title="postfix-main.cf"
|
||||
smtp_bind_address = 198.51.100.42
|
||||
smtp_bind_address6 = 2001:DB8::42
|
||||
```
|
||||
|
||||
!!! bug "Inheriting the bind from `main.cf` can misconfigure services"
|
||||
|
||||
One problem when setting `smtp_bind_address` in `main.cf` is that it will be inherited by any services in `master.cf` that extend the `smtp` transport. One of these is `smtp-amavis`, which is explicitly configured to listen / connect via loopback (localhost / `127.0.0.1`).
|
||||
|
||||
A `postfix-master.cf` override can workaround that issue by ensuring `smtp-amavis` binds to the expected internal IP:
|
||||
|
||||
```title="postfix-master.cf"
|
||||
smtp-amavis/unix/smtp_bind_address=127.0.0.1
|
||||
smtp-amavis/unix/smtp_bind_address6=::1
|
||||
```
|
||||
|
||||
=== "Alternative (unverified)"
|
||||
|
||||
A potentially better solution might be to instead [explicitly set the `smtp_bind_address` override on the `smtp` transport service][gh-pr::3465::alternative-solution]:
|
||||
|
||||
```title="postfix-master.cf"
|
||||
smtp/inet/smtp_bind_address = 198.51.100.42
|
||||
smtp/inet/smtp_bind_address6 = 2001:DB8::42
|
||||
```
|
||||
|
||||
If that avoids the concern with `smtp-amavis`, you may still need to additionally override for the [`relay` transport][gh-src::postfix-master-cf::relay-transport] as well if you have configured DMS to relay mail.
|
||||
|
||||
=== "Bridged Networks"
|
||||
|
||||
When your DMS container is using a bridge network, you'll instead need to restrict which IP address inbound and outbound traffic is routed through via the bridged interface.
|
||||
|
||||
For **inbound** traffic, you may configure this at whatever scope is most appropriate for you:
|
||||
|
||||
- **Daemon:** Change the [default bind address][inbound-ip::docker-docs::daemon] configured in `/etc/docker/daemon.json` (default `0.0.0.0`)
|
||||
- **Network:** Assign the [`host_binding_ipv4` bridge driver option][inbound-ip::docker-docs::network] as shown in the below `compose.yaml` snippet.
|
||||
- **Container:** Provide an explicit host IP address when [publishing a port][inbound-ip::docker-docs::container].
|
||||
|
||||
For **outbound** traffic, the bridge network will use the default route. You can change this by either:
|
||||
|
||||
- [Manually routing networks][outbound-ip::route-manually] on the host.
|
||||
- Use the [`host_ipv4` driver option][outbind-ip::host-ipv4] for Docker networks to force the SNAT (source IP) that the bridged network will route outbound traffic through.
|
||||
- This IP address must belong to a network interface to be routed through it.
|
||||
- IPv6 support via `host_ipv6` [requires at least Docker v25][outbind-ip::host-ipv6].
|
||||
|
||||
---
|
||||
|
||||
Here is a `compose.yaml` snippet that applies the inbound + outbound settings to the default bridge network Docker Compose creates (_if it already exists, you will need to ensure it's re-created to apply the updated settings_):
|
||||
|
||||
```yaml title="compose.yaml"
|
||||
networks:
|
||||
default:
|
||||
driver_opts:
|
||||
# Inbound IP (sets the host IP that published ports receive traffic from):
|
||||
com.docker.network.bridge.host_binding_ipv4: 198.51.100.42
|
||||
# Outbound IP (sets the host IP that external hosts will receive connections from):
|
||||
com.docker.network.host_ipv4: 198.51.100.42
|
||||
```
|
||||
|
||||
!!! note "IP addresses for documentation"
|
||||
|
||||
IP addresses shown in above examples (`198.51.100.42` + `2001:DB8::42`) are placeholders, they are IP addresses reserved for documentation by IANA (_[RFC-5737 (IPv4)][rfc-5737] and [RFC-3849 (IPv6)][rfc-3849]_). Replace them with the IP addresses you want DMS to send mail through.
|
||||
|
||||
[docs::overrides-postfix]: ../../config/advanced/override-defaults/postfix.md
|
||||
[postfix-docs::smtp-bind-address-ipv4]: https://www.postfix.org/postconf.5.html#smtp_bind_address
|
||||
[postfix-docs::smtp-bind-address-ipv6]: https://www.postfix.org/postconf.5.html#smtp_bind_address6
|
||||
|
||||
[rfc-5737]: https://datatracker.ietf.org/doc/html/rfc5737
|
||||
[rfc-3849]: https://datatracker.ietf.org/doc/html/rfc3849
|
||||
|
||||
[gh-pr::3465::comment-restrictions]: https://github.com/docker-mailserver/docker-mailserver/pull/3465#discussion_r1458114528
|
||||
[gh-pr::3465::alternative-solution]: https://github.com/docker-mailserver/docker-mailserver/pull/3465#issuecomment-1678107233
|
||||
[gh-src::postfix-master-cf::relay-transport]: https://github.com/docker-mailserver/docker-mailserver/blob/9cdbef2b369fb4fb0f1b4e534da8703daf92abc9/target/postfix/master.cf#L65
|
||||
|
||||
[inbound-ip::docker-docs::daemon]: https://docs.docker.com/reference/cli/dockerd/#default-network-options
|
||||
[inbound-ip::docker-docs::network]: https://docs.docker.com/engine/network/drivers/bridge/#default-host-binding-address
|
||||
[inbound-ip::docker-docs::container]: https://docs.docker.com/reference/compose-file/services/#ports
|
||||
[outbound-ip::route-manually]: https://github.com/moby/moby/issues/30053#issuecomment-1077041045
|
||||
[outbind-ip::host-ipv4]: https://github.com/moby/libnetwork/pull/2454
|
||||
[outbind-ip::host-ipv6]: https://github.com/moby/moby/issues/46469
|
|
@ -0,0 +1,233 @@
|
|||
---
|
||||
title: 'Use Cases | Relay inbound and outbound mail for an internal DMS'
|
||||
hide:
|
||||
- toc
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
!!! info "Community contributed guide"
|
||||
|
||||
Adapted into a guide from [this discussion](https://github.com/orgs/docker-mailserver/discussions/3965).
|
||||
|
||||
**Requirements:**
|
||||
|
||||
- A _public server_ with a static IP, like many VPS providers offer. It will only relay mail to DMS, no mail is stored on this system.
|
||||
- A _private server_ (e.g.: a local system at home) that will run DMS.
|
||||
- Both servers are connected to the same network via a VPN (_optional convenience for trust via the `mynetworks` setting_).
|
||||
|
||||
---
|
||||
|
||||
The guide below will assume the VPN is setup on `192.168.2.0/24` with:
|
||||
|
||||
- The _public server_ is using `192.168.2.2`
|
||||
- The _private server_ is using `192.168.2.3`
|
||||
|
||||
The goal of this guide is to configure a _public server_ that can receive inbound mail and relay that over to DMS on a _private server_, which can likewise submit mail outbound through a _public server_ or service.
|
||||
|
||||
The primary motivation is to keep your mail storage private instead of storing it to disk unencrypted on a VPS host.
|
||||
|
||||
## DNS setup
|
||||
|
||||
Follow our [standard guidance][docs::usage-dns-setup] for DNS setup.
|
||||
|
||||
Set your A, MX and PTR records for the _public server_ as if it were running DMS.
|
||||
|
||||
!!! example "DNS Zone file example"
|
||||
|
||||
For this guide, we assume DNS is configured with:
|
||||
|
||||
- A public reachable IP address of `11.22.33.44`
|
||||
- Mail for `@example.com` addresses must have an MX record pointing to `mail.example.com`.
|
||||
- An A record for `mail.example.com` pointing to the IP address of your _public server_.
|
||||
|
||||
```txt
|
||||
$ORIGIN example.com
|
||||
@ IN A 11.22.33.44
|
||||
mail IN A 11.22.33.44
|
||||
|
||||
; mail server for example.com
|
||||
@ IN MX 10 mail.example.com.
|
||||
```
|
||||
|
||||
SPF records should also be set up as you normally would for `mail.example.com`.
|
||||
|
||||
## Public Server (Basic Postfix setup)
|
||||
|
||||
You will need to install Postfix on your _public server_. The functionality that is needed for this setup is not yet implemented in DMS, so a vanilla Postfix will probably be easier to work with, especially since this server will only be used as an inbound and outbound relay.
|
||||
|
||||
It's necessary to adjust some settings afterwards.
|
||||
|
||||
<!-- This empty quote block is purely for a visual border -->
|
||||
!!! quote ""
|
||||
|
||||
=== "Postfix main config"
|
||||
|
||||
??? example "Create or replace `/etc/postfix/main.cf`"
|
||||
|
||||
```cf
|
||||
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
|
||||
|
||||
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
|
||||
biff = no
|
||||
|
||||
# appending .domain is the MUA's job.
|
||||
append_dot_mydomain = no
|
||||
|
||||
# Uncomment the next line to generate "delayed mail" warnings
|
||||
#delay_warning_time = 4h
|
||||
|
||||
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 3.6 on
|
||||
# fresh installs.
|
||||
compatibility_level = 3.6
|
||||
|
||||
# TLS parameters
|
||||
smtpd_tls_cert_file=/etc/postfix/certificates/mail.example.com.crt
|
||||
smtpd_tls_key_file=/etc/postfix/certificates/mail.example.com.key
|
||||
smtpd_tls_security_level=may
|
||||
smtp_tls_CApath=/etc/ssl/certs
|
||||
smtp_tls_security_level=may
|
||||
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
||||
|
||||
alias_database = hash:/etc/aliases
|
||||
alias_maps = hash:/etc/aliases
|
||||
maillog_file = /var/log/postfix.log
|
||||
mailbox_size_limit = 0
|
||||
inet_interfaces = all
|
||||
inet_protocols = ipv4
|
||||
readme_directory = no
|
||||
recipient_delimiter = +
|
||||
|
||||
# Customizations relevant to this guide:
|
||||
myhostname = mail.example.com
|
||||
myorigin = example.com
|
||||
mydestination = localhost
|
||||
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.2.0/24
|
||||
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
||||
transport_maps = hash:/etc/postfix/transport
|
||||
relay_domains = $mydestination, hash:/etc/postfix/relay
|
||||
|
||||
# Disable local system accounts and delivery:
|
||||
local_recipient_maps =
|
||||
local_transport = error:local mail delivery is disabled
|
||||
```
|
||||
|
||||
Let's highlight some of the important parts:
|
||||
|
||||
- Avoid including `mail.example.com` in `mydestination`, in fact you can just set `localhost` or nothing at all here as we want all mail to be relayed to our _private server_ (DMS).
|
||||
- `mynetworks` should contain your VPN network (_eg: `192.168.2.0/24` subnet_).
|
||||
- Important are `transport_maps = hash:/etc/postfix/transport` and `relay_domains = $mydestination, hash:/etc/postfix/relay`, with their file contents covered below.
|
||||
- For good measure, also disable `local_recipient_maps`.
|
||||
- You should have a valid certificate configured for `mail.example.com`.
|
||||
|
||||
!!! warning "Open relay"
|
||||
|
||||
Please be aware that setting `mynetworks` to a public CIDR will leave you with an open relay. **Only** set it to the CIDR of your VPN beyond the localhost ranges.
|
||||
|
||||
=== "Route outbound mail through a separate transport"
|
||||
|
||||
When mail arrives to the _public server_ for an `@example.com` address, we want to send it via the `relay` transport to our _private server_ over port 25 for delivery to DMS.
|
||||
|
||||
[`transport_maps`][postfix-docs::transport_maps] is configured with a [`transport` table][postfix-docs::transport_table] file that matches recipient addresses and assigns a non-default transport. This setting has priority over [`relay_transport`][postfix-docs::relay_transport].
|
||||
|
||||
!!! example "Create `/etc/postfix/transport`"
|
||||
|
||||
```txt
|
||||
example.com relay:[192.168.2.3]:25
|
||||
```
|
||||
|
||||
**Other considerations:**
|
||||
|
||||
- If you have multiple domains, you can add them here too (on separate lines).
|
||||
- If you use a smarthost add `* relay:[X.X.X.X]:port` to the bottom (eg: `* relay:[relay1.org]:587`), which will relay everything outbound via this relay host.
|
||||
|
||||
!!! tip
|
||||
|
||||
Instead of a file, you could alternatively configure `main.cf` with `transport_maps = inline:{ example.com=relay:[192.168.2.3]:25 }`
|
||||
|
||||
=== "Configure recipient domains to relay mail"
|
||||
|
||||
We want `example.com` to be relayed inbound and everything else relayed outbound.
|
||||
|
||||
[`relay_domains`][postfix-docs::relay_domains] is configured with a file with a list of domains that should be relayed (one per line), the 2nd value is required but can be anything.
|
||||
|
||||
!!! example "Create `/etc/postfix/relay`"
|
||||
|
||||
```txt
|
||||
example.com OK
|
||||
```
|
||||
|
||||
!!! tip
|
||||
|
||||
Instead of a file, you could alternatively configure `main.cf` with `relay_domains = example.com`.
|
||||
|
||||
!!! note "Files configured with `hash:` table type must run `postmap` to apply changes"
|
||||
|
||||
Run `postmap /etc/postfix/transport` and `postmap /etc/postfix/relay` after creating or updating either of these files, this processes them into a separate file for Postfix to use.
|
||||
|
||||
## Private Server (Running DMS)
|
||||
|
||||
You can set up your DMS instance as you normally would.
|
||||
|
||||
- Be careful not to give it a hostname of `mail.example.com`. Instead, use `internal-mail.example.com` or something similar.
|
||||
- DKIM can be setup as usual since it considers checks whether the message body has been tampered with, which our public relay doesn't do. Set DKIM up for `mail.example.com`.
|
||||
|
||||
Next, we need to configure our _private server_ to relay all outbound mail through the _public server_ (or a separate smarthost service). The setup is [similar to the default relay setup][docs::relay-host-details].
|
||||
|
||||
<!-- This empty quote block is purely for a visual border -->
|
||||
!!! quote ""
|
||||
|
||||
=== "Configure the relay host"
|
||||
|
||||
!!! example "Create `postfix-relaymap.cf`"
|
||||
|
||||
```txt
|
||||
@example.com [192.168.2.2]:25
|
||||
```
|
||||
|
||||
Meaning all mail sent outbound from `@example.com` addresses will be relayed through the _public server_ at that VPN IP.
|
||||
|
||||
The _public server_ `mynetworks` setting from earlier trusts any mail received on port 25 from the VPN network, which is what allows the mail to be sent outbound when it'd otherwise be denied.
|
||||
|
||||
=== "Trust the _public server_"
|
||||
|
||||
!!! example "Create `postfix-main.cf`"
|
||||
|
||||
```txt
|
||||
mynetworks = 192.168.2.0/24
|
||||
```
|
||||
|
||||
This will trust any connection from the VPN network to DMS, such as from the _public server_ when relaying mail over to DMS at the _private server_.
|
||||
|
||||
This step is necessary to skip some security measures that DMS normally checks for, like verifying DNS records like SPF are valid. As the mail is being relayed, those checks would fail otherwise as the IP of your _public server_ would not be authorized to send mail on behalf of the sender address in mail being relayed.
|
||||
|
||||
??? tip "Alternative to `mynetworks` setting"
|
||||
|
||||
Instead of trusting connections by their IP with the `mynetworks` setting, those same security measures can be skipped for any authenticated deliveries to DMS over port 587 instead.
|
||||
|
||||
This is a bit more work. `mynetworks` on the _public server_ `main.cf` Postfix config is for trusting DMS when it sends mail from the _private server_, thus you'll need to have that public Postfix service configured with a login account that DMS can use.
|
||||
|
||||
On the _private server_, DMS needs to know the credentials for that login account, that is handled with `postfix-sasl-password.cf`:
|
||||
|
||||
```txt
|
||||
@example.com user:secret
|
||||
```
|
||||
|
||||
You could also relay mail through SendGrid, AWS SES or similar instead of the _public server_ you're running to receive mail from. Login credentials for those relay services are provided via the same `postfix-sasl-password.cf` file.
|
||||
|
||||
---
|
||||
|
||||
Likewise for the _public server_ to send mail to DMS, it would need to be configured to relay mail with credentials too, removing the need for `mynetworks` on the DMS `postfix-main.cf` config.
|
||||
|
||||
The extra effort to require authentication instead of blind trust of your private subnet can be beneficial at reducing the impact of a compromised system or service on that network that wasn't expected to be permitted to send mail.
|
||||
|
||||
## IMAP / POP3
|
||||
|
||||
IMAP and POP3 need to point towards your _private server_, since that is where the mailboxes are located, which means you need to have a way for your MUA to connect to it.
|
||||
|
||||
[docs::usage-dns-setup]: ../../usage.md#minimal-dns-setup
|
||||
[docs::relay-host-details]: ../../config/advanced/mail-forwarding/relay-hosts.md#technical-details
|
||||
[postfix-docs::relay_domains]: https://www.postfix.org/postconf.5.html#relay_domains
|
||||
[postfix-docs::relay_transport]: https://www.postfix.org/postconf.5.html#relay_transport
|
||||
[postfix-docs::transport_maps]: https://www.postfix.org/postconf.5.html#transport_maps
|
||||
[postfix-docs::transport_table]: https://www.postfix.org/transport.5.html
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
title: 'Use Cases | Forward-Only Mail-Server with LDAP'
|
||||
title: 'Use Cases | Forward-Only Mail Server with LDAP'
|
||||
---
|
||||
|
||||
## Building a Forward-Only Mail-Server
|
||||
## Building a Forward-Only Mail Server
|
||||
|
||||
A **forward-only** mail-server does not have any local mailboxes. Instead, it has only aliases that forward emails to external email accounts (for example to a Gmail account). You can also send email from the localhost (the computer where `docker-mailserver` is installed), using as sender any of the alias addresses.
|
||||
A **forward-only** mail server does not have any local mailboxes. Instead, it has only aliases that forward emails to external email accounts (for example to a Gmail account). You can also send email from the localhost (the computer where DMS is installed), using as sender any of the alias addresses.
|
||||
|
||||
The important settings for this setup (on `mailserver.env`) are these:
|
||||
|
||||
|
@ -27,10 +27,9 @@ We can create aliases with `./setup.sh`, like this:
|
|||
|
||||
## Authenticating with LDAP
|
||||
|
||||
If you want to send emails from outside the mail-server you have to authenticate somehow (with a username and password). One way of doing it is described in [this discussion][github-issue-1247]. However if there are many user accounts, it is better to use authentication with LDAP. The settings for this on `mailserver.env` are:
|
||||
If you want to send emails from outside the mail server you have to authenticate somehow (with a username and password). One way of doing it is described in [this discussion][github-issue-1247]. However if there are many user accounts, it is better to use authentication with LDAP. The settings for this on `mailserver.env` are:
|
||||
|
||||
```env
|
||||
ENABLE_LDAP=1 # with the :edge tag, use ACCOUNT_PROVISIONER
|
||||
ACCOUNT_PROVISIONER=LDAP
|
||||
LDAP_START_TLS=yes
|
||||
LDAP_SERVER_HOST=ldap.example.org
|
||||
|
@ -60,7 +59,7 @@ userPassword: {SSHA}abcdefghi123456789
|
|||
email: external-account@gmail.com
|
||||
```
|
||||
|
||||
This structure is different from what is expected/assumed from the configuration scripts of `docker-mailserver`, so it doesn't work just by using the `LDAP_QUERY_FILTER_...` settings. Instead, I had to use a custom configuration ([via `user-patches.sh`][docs-userpatches]). I created the script `docker-data/dms/config/user-patches.sh`, with content like this:
|
||||
This structure is different from what is expected/assumed from the configuration scripts of DMS, so it doesn't work just by using the `LDAP_QUERY_FILTER_...` settings. Instead, I had to use a custom configuration ([via `user-patches.sh`][docs-userpatches]). I created the script `docker-data/dms/config/user-patches.sh`, with content like this:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
@ -99,11 +98,11 @@ You see that besides `query_filter`, I had to customize as well `result_attribut
|
|||
|
||||
!!! note "See also"
|
||||
|
||||
For more details about using LDAP see: [LDAP managed mail-server with Postfix and Dovecot for multiple domains](https://www.vennedey.net/resources/2-LDAP-managed-mail-server-with-Postfix-and-Dovecot-for-multiple-domains)
|
||||
For more details about using LDAP see: [LDAP managed mail server with Postfix and Dovecot for multiple domains](https://www.vennedey.net/resources/2-LDAP-managed-mail-server-with-Postfix-and-Dovecot-for-multiple-domains)
|
||||
|
||||
!!! note
|
||||
|
||||
Another solution that serves as a forward-only mail-server is [this](https://gitlab.com/docker-scripts/postfix).
|
||||
Another solution that serves as a forward-only mail server is [this](https://gitlab.com/docker-scripts/postfix).
|
||||
|
||||
[docs-userpatches]: ../../config/advanced/override-defaults/user-patches.md
|
||||
[github-issue-1247]: https://github.com/docker-mailserver/docker-mailserver/issues/1247
|
||||
|
|
|
@ -16,7 +16,7 @@ See [`target/dovecot/15-mailboxes.conf`][github-config-dovecot-mailboxes] for ex
|
|||
|
||||
The `Archive` special IMAP folder may be useful to enable. To do so, make a copy of [`target/dovecot/15-mailboxes.conf`][github-config-dovecot-mailboxes] and uncomment the `Archive` mailbox definition. Mail clients should understand that this folder is intended for archiving mail due to the [`\Archive` _"SPECIAL-USE"_ attribute][rfc-6154].
|
||||
|
||||
With the provided [docker-compose.yml][github-config-dockercompose] example, a volume bind mounts the host directory `docker-data/dms/config/` to the container location `/tmp/docker-mailserver/`. Config file overrides should instead be mounted to a different location as described in [Overriding Configuration for Dovecot][docs-config-overrides-dovecot]:
|
||||
With the provided [compose.yaml][github-config-dockercompose] example, a volume bind mounts the host directory `docker-data/dms/config/` to the container location `/tmp/docker-mailserver/`. Config file overrides should instead be mounted to a different location as described in [Overriding Configuration for Dovecot][docs-config-overrides-dovecot]:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
|
@ -60,12 +60,12 @@ Take care to test localized names work well as well.
|
|||
!!! note "Needs citation"
|
||||
|
||||
This information is provided by the community.
|
||||
|
||||
It presently lacks references to confirm the behaviour. If any information is incorrect please let us know! :smile:
|
||||
|
||||
It presently lacks references to confirm the behavior. If any information is incorrect please let us know! :smile:
|
||||
|
||||
|
||||
[docs-config-overrides-dovecot]: ../../config/advanced/override-defaults/dovecot.md#override-configuration
|
||||
[github-config-dockercompose]: https://github.com/docker-mailserver/docker-mailserver/blob/master/docker-compose.yml
|
||||
[github-config-dockercompose]: https://github.com/docker-mailserver/docker-mailserver/blob/master/compose.yaml
|
||||
[github-config-dovecot-mailboxes]: https://github.com/docker-mailserver/docker-mailserver/blob/master/target/dovecot/15-mailboxes.conf
|
||||
[dovecot-docs-namespaces]: https://doc.dovecot.org/configuration_manual/namespace/#namespace-inbox
|
||||
[dovecot-docs-mailboxes]: https://doc.dovecot.org/configuration_manual/namespace/#mailbox-settings
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
---
|
||||
title: 'Advanced | iOS Mail Push Support'
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
iOS Mail currently does not support the IMAP idle extension. Therefore users can only either check manually or configure intervals for fetching mails in their mail account preferences when using the default configuration.
|
||||
|
||||
To support mail push Dovecot needs to advertise the `XAPPLEPUSHSERVICE` IMAP extension as well as sending the actual push notifications to the Apple Push Notification service (APNs) which will forward them to the device.
|
||||
|
||||
This can be done with two components:
|
||||
|
||||
- A Dovecot plugin (`dovecot-xaps-plugin`) which is triggered whenever a mail is created or moved from/to a mail folder.
|
||||
- A daemon service (`dovecot-xaps-daemon`) that manages both the device registrations as well as sending notifications to the APNs.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- An Apple developer account to create the required Apple Push Notification service certificate.
|
||||
- Knowledge creating Docker images, using the command-line, and creating shell scripts.
|
||||
|
||||
## Limitations
|
||||
|
||||
- You need to maintain a custom `docker-mailserver` image.
|
||||
- Push support is limited to the INBOX folder. Changes to other folders will not be pushed to the device regardless of the configuration settings.
|
||||
- You currently cannot use the same account UUID on multiple devices. This means that if you use the same backup on multiple devices (e.g. old phone / new phone) only one of them will get the notification. Use different backups or recreate the mail account.
|
||||
|
||||
## Privacy concerns
|
||||
|
||||
- The service does not send any part of the actual message to Apple.
|
||||
- The information sent contains the device UUID to notify and the (on-device) account UUID which was generated by the iOS mail application when creating the account.
|
||||
- Upon receiving the notification, the iOS mail application will connect to the IMAP server given by the provided account UUID and fetch the mail to notify the user.
|
||||
- Apple therefore does not know the mail address for which the mail was received, only that a specific account on a specific device should be notified that a new mail or that a mail was moved to the INBOX folder.
|
||||
|
||||
## Installation
|
||||
|
||||
Both components will be built using Docker and included into a custom `docker-mailserver` image. Afterwards the required configuration is added to `docker-data/dms/config`. The registration data is stored in `/var/mail-state/lib-xapsd`.
|
||||
|
||||
1. Create a Dockerfile to build a `docker-mailserver` image that includes the [`dovecot-xaps-plugin`](https://github.com/freswa/dovecot-xaps-plugin) as well as the [`dovecot-xaps-daemon`](https://github.com/freswa/dovecot-xaps-daemon). This is required to ensure that the Dovecot plugin is built against the same Dovecot version. The `:edge` tag is used here, but you might want to use a released version instead.
|
||||
|
||||
```dockerfile
|
||||
FROM mailserver/docker-mailserver:edge AS dovecot-plugin-xaps
|
||||
WORKDIR /tmp/dovecot-xaps-plugin
|
||||
RUN <<EOF
|
||||
apt-get update
|
||||
apt-get -y --no-install-recommends install git cmake make build-essential dovecot-dev
|
||||
git clone --single-branch --depth=1 https://github.com/freswa/dovecot-xaps-plugin.git .
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
make install
|
||||
EOF
|
||||
|
||||
# Use an older Go version as Go >= 1.20 causes this issue: https://github.com/freswa/dovecot-xaps-daemon/issues/24#issuecomment-1483876081
|
||||
# Note that the underlying issue are non-standard-compliant Apple http servers which might get fixed at some point
|
||||
FROM golang:1.19-alpine AS dovecot-xaps-daemon
|
||||
ENV GOPROXY=https://proxy.golang.org,direct
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /go/dovecot-xaps-daemon
|
||||
RUN <<EOF
|
||||
apk add --no-cache --virtual build-dependencies git
|
||||
git clone --single-branch --depth=1 https://github.com/freswa/dovecot-xaps-daemon .
|
||||
go build ./cmd/xapsd
|
||||
EOF
|
||||
|
||||
FROM mailserver/docker-mailserver:edge
|
||||
COPY --from=dovecot-plugin-xaps /usr/lib/dovecot/modules/*_xaps_* /usr/lib/dovecot/modules/
|
||||
COPY --from=dovecot-xaps-daemon /go/dovecot-xaps-daemon/xapsd /usr/bin/xapsd
|
||||
|
||||
# create a non-root user for the daemon process as well as configuration and run state directories
|
||||
RUN <<EOF
|
||||
adduser --quiet --system --group --disabled-password --home /var/mail-state/lib-xapsd --no-create-home xapsd
|
||||
mkdir -p /var/run/xapsd /etc/xapsd
|
||||
EOF
|
||||
```
|
||||
|
||||
2. Build the new image:
|
||||
```sh
|
||||
docker build -t yourname/docker-mailserver .
|
||||
```
|
||||
|
||||
3. Modify your `compose.yaml` to use the newly created image:
|
||||
```yaml
|
||||
services:
|
||||
mailserver:
|
||||
image: yourname/docker-mailserver:latest
|
||||
```
|
||||
|
||||
4. Recreate the container:
|
||||
```sh
|
||||
docker compose down
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
5. Create a hash of your Apple developer account password using the provided `xapsd -pass` command:
|
||||
```sh
|
||||
docker exec -it mailserver xapsd -pass
|
||||
```
|
||||
|
||||
6. Add configuration for both components:
|
||||
- Create a folder named `xaps` in `docker-data/dms/config`.
|
||||
|
||||
- Create a file named `xapsd.yaml` in `docker-data/dms/config/xaps`.
|
||||
- Replace `appleId` and `appleIdHashedPassword` with your actual credentials. For reference see also [here](https://github.com/freswa/dovecot-xaps-daemon/blob/master/configs/xapsd/xapsd.yaml).
|
||||
- The service will use the provided username/hash combination to automatically request a new certificate from Apple as well as renewing an older certificate if needed.
|
||||
|
||||
```yaml title="xapsd.yaml"
|
||||
|
||||
# set the loglevel to either
|
||||
# trace, debug, error, fatal, info, panic or warn
|
||||
# Default: info
|
||||
loglevel: info
|
||||
|
||||
# xapsd creates a json file to store the registration persistent on disk.
|
||||
# This sets the location of the file.
|
||||
databaseFile: /var/mail-state/lib-xapsd/database.json
|
||||
|
||||
# xapsd listens on a socket for http/https requests from the dovecot plugin.
|
||||
# This sets the address and port number of the listen socket.
|
||||
listenAddr: '127.0.0.1'
|
||||
port: 11619
|
||||
|
||||
# xapsd is able to listen on a HTTPS Socket to allow HTTP/2 to be used
|
||||
# SSL is enabled implicitly when certfile and keyfile exist
|
||||
# !!! only use HTTPS for connection pooling with a proxy e.g. nginx or HaProxy
|
||||
# !!! direct usage with the plugin is discouraged and unsupported
|
||||
tlsCertfile:
|
||||
tlsKeyfile:
|
||||
tlsListenAddr:
|
||||
tlsPort: 11620
|
||||
|
||||
# Notifications that are not initiated by new messages are not sent immediately for two reasons:
|
||||
# 1. When you move/copy/delete messages you most likely move/copy/delete more messages within a short period of time.
|
||||
# 2. You don't need your mailboxes to synchronize immediately since they are automatically synchronized when opening
|
||||
# the app
|
||||
# If a new message comes and the move/copy/delete notification is still on hold it will be sent with the notification
|
||||
# for the new message.
|
||||
# This sets the interval to check for delayed messages.
|
||||
checkInterval: 20
|
||||
|
||||
# Set the time how long notifications for not-new messages should be delayed until they are sent.
|
||||
# Whenever checkInterval runs, it checks if "delay" <= "waiting time" and sends the notification if the expression is
|
||||
# true.
|
||||
delay: 30
|
||||
|
||||
# To retrieve certificates from Apple, we need to login with a valid Apple ID
|
||||
# The accounts email must be given in cleartext, but the password has to
|
||||
# be hashed before sending it. To not leak working credentials on running servers,
|
||||
# we do not accept the cleartext password here.
|
||||
appleId: foo@example.com
|
||||
|
||||
# use `xaps -pass` to calculate the hash of the apple id password
|
||||
appleIdHashedPassword: bar
|
||||
```
|
||||
|
||||
- Create a file named `95-xaps.conf` in `docker-data/dms/config/xaps`. For reference see also [here](https://github.com/freswa/dovecot-xaps-plugin/blob/master/xaps.conf).
|
||||
```txt title="95-xaps.conf"
|
||||
|
||||
protocol imap {
|
||||
mail_plugins = $mail_plugins notify push_notification xaps_push_notification xaps_imap
|
||||
}
|
||||
|
||||
protocol lda {
|
||||
mail_plugins = $mail_plugins notify push_notification xaps_push_notification
|
||||
}
|
||||
|
||||
protocol lmtp {
|
||||
mail_plugins = $mail_plugins notify push_notification xaps_push_notification
|
||||
}
|
||||
|
||||
plugin {
|
||||
# xaps_config contains xaps specific configuration parameters
|
||||
# url: protocol, hostname and port under which xapsd listens
|
||||
# user_lookup: Use if you want to determine the username used for PNs from environment variables provided by
|
||||
# login mechanism. Value is variable name to look up.
|
||||
# max_retries: maximum num of retries the http client connects to the xaps daemon
|
||||
# timeout_msecs http timeout of the http connection
|
||||
xaps_config = url=http://127.0.0.1:11619 user_lookup=theattribute max_retries=6 timeout_msecs=5000
|
||||
push_notification_driver = xaps
|
||||
}
|
||||
```
|
||||
|
||||
- Create a supervisord file named `xapsd.conf` in `docker-data/dms/config/xaps` with the following content:
|
||||
```txt title="xapsd.conf"
|
||||
|
||||
[program:xapsd]
|
||||
startsecs=0
|
||||
autostart=false
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/supervisor/%(program_name)s.log
|
||||
stderr_logfile=/var/log/supervisor/%(program_name)s.log
|
||||
user=xapsd
|
||||
command=/usr/bin/xapsd
|
||||
pidfile=/var/run/xapsd/xapsd.pid
|
||||
```
|
||||
|
||||
- Create or update your `user-patches.sh` in `docker-data/dms/config` to move the files to their final location as well as starting the daemon service:
|
||||
```sh title="user-patches.sh"
|
||||
#!/bin/bash
|
||||
|
||||
# Copy the configs to internal locations:
|
||||
cp /tmp/docker-mailserver/xaps/95-xaps.conf /etc/dovecot/conf.d/95-xaps.conf
|
||||
cp /tmp/docker-mailserver/xaps/xapsd.yaml /etc/xapsd/xapsd.yaml
|
||||
cp /tmp/docker-mailserver/xaps/xapsd.conf /etc/supervisor/conf.d/xapsd.conf
|
||||
|
||||
# Setup data persistence and ensure ownership is always for xapsd:
|
||||
mkdir -p /var/mail-state/lib-xapsd
|
||||
chown -R xapsd:xapsd /var/mail-state/lib-xapsd
|
||||
|
||||
# Start the xaps daemon:
|
||||
supervisorctl update
|
||||
supervisorctl start xapsd
|
||||
```
|
||||
|
||||
7. Recreate the container again to apply the new configuration:
|
||||
```sh
|
||||
docker compose down
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
8. Recreate your mail account on your iOS device and check the logs in `/var/log/supervisor/dovecot.log` and `/var/log/supervisor/xapsd.log` for any errors.
|
||||
|
||||
|
||||
## Other configuration options
|
||||
|
||||
Both device registration and notifications send a username to the daemon to lookup the device. While the registration and other IMAP operations in Dovecot will send the Dovecot username, LMTP will send the provided authentication username.
|
||||
|
||||
The format of that username is specified by the `auth_username_format` Dovecot setting. If you are not using mail addresses as Dovecot usernames - e.g. when using LDAP - you can either change the `auth_username_format` or add the mail address as property to the user account and use the lookup feature (see below).
|
||||
|
||||
```sh title="user-patches.sh"
|
||||
sed -i -r "s|^#?(auth_username_format =).*|\1 %Ln|" /etc/dovecot/conf.d/10-auth.conf
|
||||
```
|
||||
|
||||
You can also use notifications for Dovecot alias mailboxes. Depending on your server configuration, this might require to add the original Dovecot username as [Dovecot attribute](https://doc.dovecot.org/configuration_manual/authentication/user_database_extra_fields/) to the login user as well as changing the `user_lookup=theattribute` in `95-xaps.conf` to perform the lookup of that attribute.
|
|
@ -12,7 +12,7 @@ Mails are stored in `/var/mail/${domain}/${username}`. Since `v9.0.0` it is poss
|
|||
|
||||
### How are IMAP mailboxes (_aka IMAP Folders_) set up?
|
||||
|
||||
`INBOX` is setup by default with the special IMAP folders `Drafts`, `Sent`, `Junk` and `Trash`. You can learn how to modify or add your own folders (_including additional special folders like `Archive`_) by visiting our docs page [_Customizing IMAP Folders_](../examples/use-cases/imap-folders) for more information.
|
||||
`INBOX` is setup by default with the special IMAP folders `Drafts`, `Sent`, `Junk` and `Trash`. You can learn how to modify or add your own folders (_including additional special folders like `Archive`_) by visiting our docs page [_Customizing IMAP Folders_](./examples/use-cases/imap-folders.md) for more information.
|
||||
|
||||
### How do I update DMS?
|
||||
|
||||
|
@ -21,9 +21,9 @@ Mails are stored in `/var/mail/${domain}/${username}`. Since `v9.0.0` it is poss
|
|||
Then, run the following commands:
|
||||
|
||||
``` BASH
|
||||
docker-compose pull
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
docker compose pull
|
||||
docker compose down
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
You should see the new version number on startup, for example: `[ INF ] Welcome to docker-mailserver 11.3.1`. And you're done! Don't forget to have a look at the remaining functions of the `setup.sh` script with `./setup.sh help`.
|
||||
|
@ -57,7 +57,7 @@ As you'll realistically be deploying to production on a Linux host, if you are o
|
|||
|
||||
### How to alter a running DMS instance _without_ relaunching the container?
|
||||
|
||||
`docker-mailserver` aggregates multiple "sub-services", such as Postfix, Dovecot, Fail2ban, SpamAssassin, etc. In many cases, one may edit a sub-service's config and reload that very sub-service, without stopping and relaunching the whole mail-server.
|
||||
DMS aggregates multiple "sub-services", such as Postfix, Dovecot, Fail2ban, SpamAssassin, etc. In many cases, one may edit a sub-service's config and reload that very sub-service, without stopping and relaunching the whole mail server.
|
||||
|
||||
In order to do so, you'll probably want to push your config updates to your server through a Docker volume (these docs use: `./docker-data/dms/config/:/tmp/docker-mailserver/`), then restart the sub-service to apply your changes, using `supervisorctl`. For instance, after editing fail2ban's config: `supervisorctl restart fail2ban`.
|
||||
|
||||
|
@ -79,6 +79,14 @@ volumes:
|
|||
|
||||
Optionally, you can set the `TZ` ENV variable; e.g. `TZ=Europe/Berlin`. Check [this list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for which values are allowed.
|
||||
|
||||
### What About DNS Servers?
|
||||
|
||||
Properly working DNS servers are crucial for differentiating spam from legitimate e-mails. Records like `SPF`, `DKIM` and `DMARC` records, as well as working name (resolving `A` records) and reverse name (resolving `PTR` records) resolution ensures legitimate e-mails arrive while e-mails that are more likely phishing and spam do not.
|
||||
|
||||
Anti-spam measures (like SpamAssassin or Rspamd) make use of DNS block lists. To learn more check out our [Rspamd documentation on this topic][docs::rspamd-rbl-dnsbl]. In case you want to utilize RBL/DNSBLs, you need a recursive DNS resolver (_not big custom resolvers like Cloudflare, Quad9, Google, etc._).
|
||||
|
||||
DMS does not integrate support for an internal DNS service as this is a [responsibility that is sensitive to the host environment][gh-discussion::dms-avoid-maintaining-internal-dns]. You can configure internal services within DMS to use your own managed DNS server, or configure for such at the host or container level (_such as with [`compose.yaml`][docker-compose::docs::config-dns]_).
|
||||
|
||||
### What is the file format?
|
||||
|
||||
All files are using the Unix format with `LF` line endings. Please do not use `CRLF`.
|
||||
|
@ -97,7 +105,7 @@ DMS supports multiple domains out of the box, so you can do this:
|
|||
|
||||
#### Bind mounts (default)
|
||||
|
||||
From the location of your `docker-compose.yml`, create a compressed archive of your `docker-data/dms/config/` and `docker-data/dms/mail-*` folders:
|
||||
From the location of your `compose.yaml`, create a compressed archive of your `docker-data/dms/config/` and `docker-data/dms/mail-*` folders:
|
||||
|
||||
```bash
|
||||
tar --gzip -cf "backup-$(date +%F).tar.gz" ./docker-data/dms
|
||||
|
@ -126,18 +134,9 @@ docker run --rm -it \
|
|||
find "${PWD}/docker-data/dms-backups/" -type f -mtime +30 -delete
|
||||
```
|
||||
|
||||
### What about the `./docker-data/dms/mail-state` folder?
|
||||
|
||||
When you run DMS with the ENV variable `ONE_DIR=1` (default), this folder will:
|
||||
|
||||
- Provide support to persist Fail2Ban blocks, ClamAV signature updates, and the like when the container is restarted or recreated.
|
||||
- To persist that container state properly this folder should be **volume mounted to `/var/mail-state/` internally**.
|
||||
|
||||
Service data is [relocated to the `mail-state` folder][mail-state-folders] for the following services: Postfix, Dovecot, Fail2Ban, Amavis, PostGrey, ClamAV, SpamAssassin.
|
||||
|
||||
### I Want to Know More About the Ports
|
||||
|
||||
See [this part of the documentation](../config/security/understanding-the-ports/) for further details and best practice advice, **especially regarding security concerns**.
|
||||
See [this part of the documentation](./config/security/understanding-the-ports.md) for further details and best practice advice, **especially regarding security concerns**.
|
||||
|
||||
### How can I configure my email client?
|
||||
|
||||
|
@ -152,7 +151,7 @@ imap port: 143 or 993 with STARTTLS/SSL (recommended)
|
|||
imap path prefix: INBOX
|
||||
|
||||
# SMTP
|
||||
smtp port: 25 or 587/465 with STARTTLS/SSL (recommended)
|
||||
smtp port: 587 or 465 with STARTTLS/SSL (recommended)
|
||||
username: <user1@example.com>
|
||||
password: <mypassword>
|
||||
```
|
||||
|
@ -176,16 +175,15 @@ warning: do not list domain example.com in BOTH mydestination and virtual_mailbo
|
|||
|
||||
Plus of course mail delivery fails.
|
||||
|
||||
Also you need to define `hostname: example.com` in your `docker-compose.yml`.
|
||||
Also you need to define `hostname: example.com` in your `compose.yaml`.
|
||||
|
||||
!!! tip "You might not want a bare domain"
|
||||
|
||||
We encourage you to consider using a subdomain where possible.
|
||||
|
||||
|
||||
- There are [benefits][github-comment-baredomain] to preferring a subdomain.
|
||||
- A bare domain is not required to have `user@example.com`, that is distinct from your hostname which is identified by a DNS MX record.
|
||||
|
||||
|
||||
### How can I configure a catch-all?
|
||||
|
||||
Considering you want to redirect all incoming e-mails for the domain `example.com` to `user1@example.com`, add the following line to `docker-data/dms/config/postfix-virtual.cf`:
|
||||
|
@ -220,7 +218,7 @@ baduser@example.com devnull
|
|||
|
||||
### What kind of SSL certificates can I use?
|
||||
|
||||
Both RSA and ECDSA certs are supported. You can provide your own cert files manually, or mount a `letsencrypt` generated directory (_with alternative support for Traefik's `acme.json`_). Check out the [`SSL_TYPE` documentation](../config/environment/#ssl_type) for more details.
|
||||
Both RSA and ECDSA certs are supported. You can provide your own cert files manually, or mount a `letsencrypt` generated directory (_with alternative support for Traefik's `acme.json`_). Check out the [`SSL_TYPE` documentation](./config/environment.md#ssl_type) for more details.
|
||||
|
||||
### I just moved from my old mail server to DMS, but "it doesn't work"?
|
||||
|
||||
|
@ -233,14 +231,6 @@ If everything is OK regarding DNS, please provide [formatted logs](https://guide
|
|||
|
||||
If we're blind, we won't be able to do anything.
|
||||
|
||||
### Can DMS run in a Rancher environment?
|
||||
|
||||
Yes, by adding the environment variable `PERMIT_DOCKER: network`.
|
||||
|
||||
!!! warning
|
||||
|
||||
Adding the Docker network's gateway to the list of trusted hosts, e.g. using the `network` or `connected-networks` option, can create an [**open relay**](https://en.wikipedia.org/wiki/Open_mail_relay), for instance [if IPv6 is enabled on the host machine but not in Docker][github-issue-1405-comment].
|
||||
|
||||
### Connection refused or No response at all
|
||||
|
||||
You see errors like "Connection Refused" and "Connection closed by foreign host", or you cannot connect at all? You may not be able to connect with your mail client (MUA)? Make sure to check Fail2Ban did not ban you (for exceeding the number of tried logins for example)! You can run
|
||||
|
@ -267,23 +257,32 @@ See [#1247][github-issue-1247] for an example.
|
|||
|
||||
### Common Errors
|
||||
|
||||
#### Creating an alias or account with an address for `hostname`
|
||||
|
||||
Normally you will assign DMS a `hostname` such as `mail.example.com`. If you instead use a bare domain (_such as `example.com`_) or add an alias / account with the same value as your `hostname`, this can cause a conflict for mail addressed to `@hostname` as Postfix gets confused where to deliver the mail (_`hostname` is configured for only system accounts via the Postfix `main.cf` setting `mydestination`_).
|
||||
|
||||
When this conflict is detected you'll find logs similar to this:
|
||||
|
||||
```log
|
||||
warning: connect to Milter service inet:localhost:8893: Connection refused
|
||||
# DMARC not running
|
||||
# => /etc/init.d/opendmarc restart
|
||||
|
||||
warning: connect to Milter service inet:localhost:8891: Connection refused
|
||||
# DKIM not running
|
||||
# => /etc/init.d/opendkim restart
|
||||
|
||||
mail amavis[1459]: (01459-01) (!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory
|
||||
mail amavis[1459]: (01459-01) (!)ClamAV-clamd: All attempts (1) failed connecting to /var/run/clamav/clamd.ctl, retrying (2)
|
||||
mail amavis[1459]: (01459-01) (!)ClamAV-clamscan av-scanner FAILED: /usr/bin/clamscan KILLED, signal 9 (0009) at (eval 100) line 905.
|
||||
mail amavis[1459]: (01459-01) (!!)AV: ALL VIRUS SCANNERS FAILED
|
||||
# Clamav is not running (not started or because you don't have enough memory)
|
||||
# => check requirements and/or start Clamav
|
||||
warning: do not list domain mail.example.com in BOTH mydestination and virtual_mailbox_domains
|
||||
...
|
||||
NOQUEUE: reject: RCPT from HOST[IP]: 550 5.1.1 <RECIPIENT>: Recipient address rejected: User unknown in local recipient table; ...
|
||||
```
|
||||
|
||||
Opt-out of mail being directed to services by excluding `$myhostname` as a destination with a [`postfix-main.cf`][docs-override-postfix] override config:
|
||||
|
||||
```cf
|
||||
mydestination = localhost.$mydomain, localhost
|
||||
```
|
||||
|
||||
!!! tip
|
||||
|
||||
You may want to configure a `postmaster` alias via `setup alias add` to receive system notifications.
|
||||
|
||||
!!! warning
|
||||
|
||||
Internal mail destined for `root`, `amavis` or other accounts will now no longer be received without an alias or account created for them.
|
||||
|
||||
### How to use DMS behind a proxy
|
||||
|
||||
[Using `user-patches.sh`][docs-userpatches], update the container file `/etc/postfix/main.cf` to include:
|
||||
|
@ -292,13 +291,19 @@ mail amavis[1459]: (01459-01) (!!)AV: ALL VIRUS SCANNERS FAILED
|
|||
proxy_interfaces = X.X.X.X (your public IP)
|
||||
```
|
||||
|
||||
For reverse proxy support you will want to view [our dedicated guide][docs::examples::reverse-proxy].
|
||||
|
||||
### How to restrict login by IP?
|
||||
|
||||
There are a few ways you could approach this, see [this discussion answer][gh-discussion::restrict-login-by-ip] for advice.
|
||||
|
||||
### How to adjust settings with the `user-patches.sh` script
|
||||
|
||||
Suppose you want to change a number of settings that are not listed as variables or add things to the server that are not included?
|
||||
|
||||
`docker-mailserver` has a built-in way to do post-install processes. If you place a script called **`user-patches.sh`** in the config directory it will be run after all configuration files are set up, but before the postfix, amavis and other daemons are started.
|
||||
DMS has a built-in way to do post-install processes. If you place a script called **`user-patches.sh`** in the config directory it will be run after all configuration files are set up, but before the postfix, amavis and other daemons are started.
|
||||
|
||||
It is common to use a local directory for config added to `docker-mailsever` via a volume mount in your `docker-compose.yml` (eg: `./docker-data/dms/config/:/tmp/docker-mailserver/`).
|
||||
It is common to use a local directory for config added to `docker-mailsever` via a volume mount in your `compose.yaml` (eg: `./docker-data/dms/config/:/tmp/docker-mailserver/`).
|
||||
|
||||
Add or create the script file to your config directory:
|
||||
|
||||
|
@ -373,18 +378,7 @@ DMS does not manage those concerns, verify they are not causing your delivery pr
|
|||
|
||||
#### How can I manage my custom SpamAssassin rules?
|
||||
|
||||
Antispam rules are managed in `docker-data/dms/config/spamassassin-rules.cf`.
|
||||
|
||||
#### What are acceptable `SA_SPAM_SUBJECT` values?
|
||||
|
||||
For no subject set `SA_SPAM_SUBJECT=undef`.
|
||||
|
||||
For a trailing white-space subject one can define the whole variable with quotes in `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
- "SA_SPAM_SUBJECT=[SPAM] "
|
||||
```
|
||||
Anti-spam rules are managed in `docker-data/dms/config/spamassassin-rules.cf`.
|
||||
|
||||
#### Why are SpamAssassin `x-headers` not inserted into my `subdomain.example.com` subdomain emails?
|
||||
|
||||
|
@ -396,25 +390,28 @@ The default setup `@local_domains_acl = ( ".$mydomain" );` does not match subdom
|
|||
|
||||
Put received spams in `.Junk/` imap folder using `SPAMASSASSIN_SPAM_TO_INBOX=1` and `MOVE_SPAM_TO_JUNK=1` and add a _user_ cron like the following:
|
||||
|
||||
```conf
|
||||
# This assumes you're having `environment: ONE_DIR=1` in the `mailserver.env`,
|
||||
# with a consolidated config in `/var/mail-state`
|
||||
#
|
||||
# m h dom mon dow command
|
||||
# Everyday 2:00AM, learn spam from a specific user
|
||||
0 2 * * * docker exec mailserver sa-learn --spam /var/mail/example.com/username/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin
|
||||
```
|
||||
!!! example
|
||||
|
||||
With `docker-compose` you can more easily use the internal instance of `cron` within `docker-mailserver`. This is less problematic than the simple solution shown above, because it decouples the learning from the host on which `docker-mailserver` is running, and avoids errors if the mail-server is not running.
|
||||
**NOTE:** This example assumes you have a [`/var/mail-state` volume][docs::dms-volumes-state] mounted.
|
||||
|
||||
```conf
|
||||
# m h dom mon dow command
|
||||
# Everyday 2:00AM, learn spam from a specific user
|
||||
0 2 * * * docker exec mailserver sa-learn --spam /var/mail/example.com/username/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin
|
||||
```
|
||||
|
||||
With `docker-compose` you can more easily use the internal instance of `cron` within DMS. This is less problematic than the simple solution shown above, because it decouples the learning from the host on which DMS is running, and avoids errors if the mail server is not running.
|
||||
|
||||
The following configuration works nicely:
|
||||
|
||||
??? example
|
||||
|
||||
**NOTE:** This example assumes you have a [`/var/mail-state` volume][docs::dms-volumes-state] mounted.
|
||||
|
||||
Create a _system_ cron file:
|
||||
|
||||
```sh
|
||||
# in the docker-compose.yml root directory
|
||||
# in the compose.yaml root directory
|
||||
mkdir -p ./docker-data/dms/cron
|
||||
touch ./docker-data/dms/cron/sa-learn
|
||||
chown root:root ./docker-data/dms/cron/sa-learn
|
||||
|
@ -424,9 +421,6 @@ The following configuration works nicely:
|
|||
Edit the system cron file `nano ./docker-data/dms/cron/sa-learn`, and set an appropriate configuration:
|
||||
|
||||
```conf
|
||||
# This assumes you're having `environment: ONE_DIR=1` in the env-mailserver,
|
||||
# with a consolidated config in `/var/mail-state`
|
||||
#
|
||||
# '> /dev/null' to send error notifications from 'stderr' to 'postmaster@example.com'
|
||||
#
|
||||
# m h dom mon dow user command
|
||||
|
@ -448,7 +442,7 @@ The following configuration works nicely:
|
|||
30 3 * * * root sa-learn --ham /var/mail/not-example.com/*/cur* --dbpath /var/mail-state/lib-amavis/.spamassassin > /dev/null
|
||||
```
|
||||
|
||||
Then with `docker-compose.yml`:
|
||||
Then with `compose.yaml`:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
@ -474,57 +468,41 @@ The following configuration works nicely:
|
|||
file: ./docker-data/dms/cron/sa-learn
|
||||
```
|
||||
|
||||
With the default settings, SpamAssassin will require 200 mails trained for spam (for example with the method explained above) and 200 mails trained for ham (using the same command as above but using `--ham` and providing it with some ham mails). Until you provided these 200+200 mails, SpamAssassin will not take the learned mails into account. For further reference, see the [SpamAssassin Wiki](https://wiki.apache.org/spamassassin/BayesNotWorking).
|
||||
With the default settings, SpamAssassin will require 200 mails trained for spam (for example with the method explained above) and 200 mails trained for ham (using the same command as above but using `--ham` and providing it with some ham mails).
|
||||
|
||||
- Until you provided these 200+200 mails, SpamAssassin will not take the learned mails into account.
|
||||
- For further reference, see the [SpamAssassin Wiki](https://wiki.apache.org/spamassassin/BayesNotWorking).
|
||||
|
||||
#### How do I have more control about what SpamAssassin is filtering?
|
||||
|
||||
By default, SPAM and INFECTED emails are put to a quarantine which is not very straight forward to access. Several config settings are affecting this behavior:
|
||||
This is related to Amavis processing the mail after SpamAssassin has analyzed it and assigned a spam score.
|
||||
|
||||
First, make sure you have the proper thresholds set:
|
||||
- DMS provides some [common SA tunables via ENV][docs::env::sa_env].
|
||||
- Additional configuration can be managed with the DMS config volume by providing `docker-data/dms/config/amavis.cf`.
|
||||
|
||||
```conf
|
||||
SA_TAG=-100000.0
|
||||
SA_TAG2=3.75
|
||||
SA_KILL=100000.0
|
||||
```
|
||||
#### How can I send quarantined mail to a mailbox?
|
||||
|
||||
- The very negative vaue in `SA_TAG` makes sure, that all emails have the SpamAssassin headers included.
|
||||
- `SA_TAG2` is the actual threshold to set the YES/NO flag for spam detection.
|
||||
- `SA_KILL` needs to be very high, to make sure nothing is bounced at all (`SA_KILL` superseeds `SPAMASSASSIN_SPAM_TO_INBOX`)
|
||||
SPAM and INFECTED emails that [reach the `SA_KILL` threshold are archived into quarantine][docs::env::sa_kill].
|
||||
|
||||
Make sure everything (including SPAM) is delivered to the inbox and not quarantined:
|
||||
|
||||
```conf
|
||||
SPAMASSASSIN_SPAM_TO_INBOX=1
|
||||
```
|
||||
|
||||
Use `MOVE_SPAM_TO_JUNK=1` or create a sieve script which puts spam to the Junk folder:
|
||||
|
||||
```sieve
|
||||
require ["comparator-i;ascii-numeric","relational","fileinto"];
|
||||
|
||||
if header :contains "X-Spam-Flag" "YES" {
|
||||
fileinto "Junk";
|
||||
} elsif allof (
|
||||
not header :matches "x-spam-score" "-*",
|
||||
header :value "ge" :comparator "i;ascii-numeric" "x-spam-score" "3.75" ) {
|
||||
fileinto "Junk";
|
||||
}
|
||||
```
|
||||
|
||||
Create a dedicated mailbox for emails which are infected/bad header and everything amavis is blocking by default and put its address into `docker-data/dms/config/amavis.cf`
|
||||
Instead of a quarantine folder, you can use a dedicated mailbox instead. Create an account like `quarantine@example.com` and create `docker-data/dms/config/amavis.cf`:
|
||||
|
||||
```cf
|
||||
$clean_quarantine_to = "amavis\@example.com";
|
||||
$virus_quarantine_to = "amavis\@example.com";
|
||||
$banned_quarantine_to = "amavis\@example.com";
|
||||
$bad_header_quarantine_to = "amavis\@example.com";
|
||||
$spam_quarantine_to = "amavis\@example.com";
|
||||
$clean_quarantine_to = "quarantine\@example.com";
|
||||
$virus_quarantine_to = "quarantine\@example.com";
|
||||
$banned_quarantine_to = "quarantine\@example.com";
|
||||
$bad_header_quarantine_to = "quarantine\@example.com";
|
||||
$spam_quarantine_to = "quarantine\@example.com";
|
||||
```
|
||||
|
||||
[fail2ban-customize]: ./config/security/fail2ban.md
|
||||
[docs::dms-volumes-state]: ./config/advanced/optional-config.md#volumes-state
|
||||
[docs::rspamd-rbl-dnsbl]: ./config/security/rspamd.md#rbls-real-time-blacklists-dnsbls-dns-based-blacklists
|
||||
[docs-maintenance]: ./config/advanced/maintenance/update-and-cleanup.md
|
||||
[docs-override-postfix]: ./config/advanced/override-defaults/postfix.md
|
||||
[docs-userpatches]: ./config/advanced/override-defaults/user-patches.md
|
||||
[docs::env::sa_env]: ./config/environment.md#spamassassin
|
||||
[docs::env::sa_kill]: ./config/environment.md#sa_kill
|
||||
[docs::examples::reverse-proxy]: ./examples/tutorials/mailserver-behind-proxy.md
|
||||
[github-comment-baredomain]: https://github.com/docker-mailserver/docker-mailserver/issues/3048#issuecomment-1432358353
|
||||
[github-comment-override-hostname]: https://github.com/docker-mailserver/docker-mailserver/issues/1731#issuecomment-753968425
|
||||
[github-issue-95]: https://github.com/docker-mailserver/docker-mailserver/issues/95
|
||||
|
@ -533,5 +511,7 @@ $spam_quarantine_to = "amavis\@example.com";
|
|||
[github-issue-1405-comment]: https://github.com/docker-mailserver/docker-mailserver/issues/1405#issuecomment-590106498
|
||||
[github-issue-1639]: https://github.com/docker-mailserver/docker-mailserver/issues/1639
|
||||
[github-issue-1792]: https://github.com/docker-mailserver/docker-mailserver/pull/1792
|
||||
[gh-discussion::dms-avoid-maintaining-internal-dns]: https://github.com/orgs/docker-mailserver/discussions/3959#discussioncomment-8956322
|
||||
[gh-discussion::restrict-login-by-ip]: https://github.com/orgs/docker-mailserver/discussions/3847
|
||||
[docker-compose::docs::config-dns]: https://docs.docker.com/compose/compose-file/compose-file-v3/#dns
|
||||
[hanscees-userpatches]: https://github.com/hanscees/dockerscripts/blob/master/scripts/tomav-user-patches.sh
|
||||
[mail-state-folders]: https://github.com/docker-mailserver/docker-mailserver/blob/c7e498194546416fb7231cb03254e77e085d18df/target/scripts/startup/misc-stack.sh#L24-L33
|
||||
|
|
|
@ -14,7 +14,7 @@ This documentation provides you not only with the basic setup and configuration
|
|||
|
||||
## About
|
||||
|
||||
`docker-mailserver`, or DMS for short, is a production-ready fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.). It employs only configuration files, no SQL database. The image is focused around the slogan "Keep it simple and versioned".
|
||||
`docker-mailserver`, or DMS for short, is a production-ready fullstack but simple mail server (SMTP, IMAP, LDAP, Anti-spam, Anti-virus, etc.). It employs only configuration files, no SQL database. The image is focused around the slogan "Keep it simple and versioned".
|
||||
|
||||
## Contents
|
||||
|
||||
|
@ -24,19 +24,19 @@ If you're completely new to mail servers or you want to read up on them, check o
|
|||
|
||||
There is also a script - [`setup.sh`][github-file-setupsh] - supplied with this project. It supports you in configuring and administrating your server. Information on how to get it and how to use it is available [on a dedicated page][docs-setupsh].
|
||||
|
||||
[docs-introduction]: ./introduction/
|
||||
[docs-usage]: ./usage/
|
||||
[docs-examples]: ./examples/tutorials/basic-installation/
|
||||
[docs-introduction]: ./introduction.md
|
||||
[docs-usage]: ./usage.md
|
||||
[docs-examples]: ./examples/tutorials/basic-installation.md
|
||||
[github-file-setupsh]: https://github.com/docker-mailserver/docker-mailserver/blob/master/setup.sh
|
||||
[docs-setupsh]: ./config/setup.sh/
|
||||
|
||||
### Configuration
|
||||
|
||||
We have a [dedicated configuration page][docs-environment]. It contains most of the configuration and explanation you need to setup _your_ mail server properly. Be aware that advanced tasks may still require reading through all parts of this documentation; it may also involve inspecting your running container for debugging purposes. After all, a mail-server is a complex arrangement of various programs.
|
||||
We have a [dedicated configuration page][docs-environment]. It contains most of the configuration and explanation you need to setup _your_ mail server properly. Be aware that advanced tasks may still require reading through all parts of this documentation; it may also involve inspecting your running container for debugging purposes. After all, a mail server is a complex arrangement of various programs.
|
||||
|
||||
!!! important
|
||||
|
||||
If you'd like to change, patch or alter files or behavior of `docker-mailserver`, you can use a script. Just place a script called `user-patches.sh` in your `./docker-data/dms/config/` folder volume (which is mounted to `/tmp/docker-mailserver/` inside the container) and it will be run on container startup. See the ['Modifications via Script' page][docs-userpatches] for additional documentation and an example.
|
||||
If you'd like to change, patch or alter files or behavior of DMS, you can use a script. Just place a script called `user-patches.sh` in your `./docker-data/dms/config/` folder volume (which is mounted to `/tmp/docker-mailserver/` inside the container) and it will be run on container startup. See the ['Modifications via Script' page][docs-userpatches] for additional documentation and an example.
|
||||
|
||||
You might also want to check out:
|
||||
|
||||
|
@ -59,10 +59,10 @@ You might also want to check out:
|
|||
|
||||
DMS employs a variety of tests. If you want to know more about our test suite, view our [testing docs][docs-tests].
|
||||
|
||||
[docs-tests]: ./contributing/tests/
|
||||
[docs-tests]: ./contributing/tests.md
|
||||
|
||||
### Contributing
|
||||
|
||||
We are always happy to welcome new contributors. For guidelines and entrypoints please have a look at the [Contributing section][docs-contributing].
|
||||
|
||||
[docs-contributing]: ./contributing/issues-and-pull-requests/
|
||||
[docs-contributing]: ./contributing/issues-and-pull-requests.md
|
||||
|
|
|
@ -4,17 +4,17 @@ title: Introduction
|
|||
|
||||
# An Overview of Mail Server Infrastructure
|
||||
|
||||
This article answers the question "What is a mail server, and how does it perform its duty?" and it gives the reader an introduction to the field that covers everything you need to know to get started with `docker-mailserver`.
|
||||
This article answers the question "What is a mail server, and how does it perform its duty?" and it gives the reader an introduction to the field that covers everything you need to know to get started with DMS.
|
||||
|
||||
## The Anatomy of a Mail Server
|
||||
|
||||
A mail server is only a part of a [client-server relationship][wikipedia-clientserver] aimed at exchanging information in the form of [emails][wikipedia-email]. Exchanging emails requires using specific means (programs and protocols).
|
||||
|
||||
`docker-mailserver` provides you with the server portion, whereas the client can be anything from a terminal via text-based software (eg. [Mutt][software-mutt]) to a fully-fledged desktop application (eg. [Mozilla Thunderbird][software-thunderbird], [Microsoft Outlook][software-outlook]…), to a web interface, etc.
|
||||
DMS provides you with the server portion, whereas the client can be anything from a terminal via text-based software (eg. [Mutt][software-mutt]) to a fully-fledged desktop application (eg. [Mozilla Thunderbird][software-thunderbird], [Microsoft Outlook][software-outlook]…), to a web interface, etc.
|
||||
|
||||
Unlike the client-side where usually a single program is used to perform retrieval and viewing of emails, the server-side is composed of many specialized components. The mail server is capable of accepting, forwarding, delivering, storing and overall exchanging messages, but each one of those tasks is actually handled by a specific piece of software. All of these "agents" must be integrated with one another for the exchange to take place.
|
||||
|
||||
`docker-mailserver` has made informed choices about those components and their (default) configuration. It offers a comprehensive platform to run a fully featured mail server in no time!
|
||||
DMS has made informed choices about those components and their (default) configuration. It offers a comprehensive platform to run a fully featured mail server in no time!
|
||||
|
||||
## Components
|
||||
|
||||
|
@ -33,39 +33,39 @@ Fetching an email: MUA <--------------------------------- MDA
|
|||
|
||||
There may be other moving parts or sub-divisions (for instance, at several points along the chain, specialized programs may be analyzing, filtering, bouncing, editing… the exchanged emails).
|
||||
|
||||
In a nutshell, `docker-mailserver` provides you with the following components:
|
||||
In a nutshell, DMS provides you with the following components:
|
||||
|
||||
- A MTA: [Postfix](http://www.postfix.org/)
|
||||
- A MDA: [Dovecot](https://dovecot.org/)
|
||||
- A bunch of additional programs to improve security and emails processing
|
||||
|
||||
Here's where `docker-mailserver`'s toochain fits within the delivery chain:
|
||||
Here's where DMS's toolchain fits within the delivery chain:
|
||||
|
||||
```txt
|
||||
docker-mailserver is here:
|
||||
┏━━━━━━━┓
|
||||
Sending an email: MUA ---> MTA ---> (MTA relays) ---> ┫ MTA ╮ ┃
|
||||
Fetching an email: MUA <------------------------------ ┫ MDA ╯ ┃
|
||||
┗━━━━━━━┛
|
||||
┏━━━━━━━┓
|
||||
Sending an email: MUA ---> MTA ---> (MTA relays) ---> ┫ MTA ╮ ┃
|
||||
Fetching an email: MUA <------------------------------ ┫ MDA ╯ ┃
|
||||
┗━━━━━━━┛
|
||||
```
|
||||
|
||||
??? example "An Example"
|
||||
|
||||
Let's say Alice owns a Gmail account, `alice@gmail.com`; and Bob owns an account on a `docker-mailserver`'s instance, `bob@dms.io`.
|
||||
Let's say Alice owns a Gmail account, `alice@gmail.com`; and Bob owns an account on a DMS instance, `bob@dms.io`.
|
||||
|
||||
Make sure not to conflate these two very different scenarios:
|
||||
A) Alice sends an email to `bob@dms.io` => the email is first submitted to MTA `smtp.gmail.com`, then relayed to MTA `smtp.dms.io` where it is then delivered into Bob's mailbox.
|
||||
B) Bob sends an email to `alice@gmail.com` => the email is first submitted to MTA `smtp.dms.io`, then relayed to MTA `smtp.gmail.com` and eventually delivered into Alice's mailbox.
|
||||
|
||||
In scenario *A* the email leaves Gmail's premises, that email's *initial* submission is _not_ handled by your `docker-mailserver` instance(MTA); it merely receives the email after it has been relayed by Gmail's MTA. In scenario *B*, the `docker-mailserver` instance(MTA) handles the submission, prior to relaying.
|
||||
In scenario *A* the email leaves Gmail's premises, that email's *initial* submission is _not_ handled by your DMS instance(MTA); it merely receives the email after it has been relayed by Gmail's MTA. In scenario *B*, the DMS instance(MTA) handles the submission, prior to relaying.
|
||||
|
||||
The main takeaway is that when a third-party sends an email to a `docker-mailserver` instance(MTA) (or any MTA for that matter), it does _not_ establish a direct connection with that MTA. Email submission first goes through the sender's MTA, then some relaying between at least two MTAs is required to deliver the email. That will prove very important when it comes to security management.
|
||||
The main takeaway is that when a third-party sends an email to a DMS instance(MTA) (or any MTA for that matter), it does _not_ establish a direct connection with that MTA. Email submission first goes through the sender's MTA, then some relaying between at least two MTAs is required to deliver the email. That will prove very important when it comes to security management.
|
||||
|
||||
One important thing to note is that MTA and MDA programs may actually handle _multiple_ tasks (which is the case with `docker-mailserver`'s Postfix and Dovecot).
|
||||
One important thing to note is that MTA and MDA programs may actually handle _multiple_ tasks (which is the case with DMS's Postfix and Dovecot).
|
||||
|
||||
For instance, Postfix is both an SMTP server (accepting emails) and a relaying MTA (transferring, ie. sending emails to other MTA/MDA); Dovecot is both an MDA (delivering emails in mailboxes) and an IMAP server (allowing MUAs to fetch emails from the _mail server_). On top of that, Postfix may rely on Dovecot's authentication capabilities.
|
||||
|
||||
The exact relationship between all the components and their respective (sometimes shared) responsibilities is beyond the scope of this document. Please explore this wiki & the web to get more insights about `docker-mailserver`'s toolchain.
|
||||
The exact relationship between all the components and their respective (sometimes shared) responsibilities is beyond the scope of this document. Please explore this wiki & the web to get more insights about DMS's toolchain.
|
||||
|
||||
## About Security & Ports
|
||||
|
||||
|
@ -86,35 +86,35 @@ When it comes to the specifics of email exchange, we have to look at protocols a
|
|||
The following picture gives a visualization of the interplay of all components and their [respective ports][docs-understandports]:
|
||||
|
||||
```txt
|
||||
┏━━━━━━━━━━ Submission ━━━━━━━━━━━━┓┏━━━━━━━━━━━━━ Transfer/Relay ━━━━━━━━━━━┓
|
||||
┏━━━━━━━━━━ Submission ━━━━━━━━━━━━━┓┏━━━━━━━━━━━━━ Transfer/Relay ━━━━━━━━━━━┓
|
||||
|
||||
┌─────────────────────┐ ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
|
||||
MUA ----- STARTTLS ------> ┤(587) MTA ╮ (25)├ <-- cleartext ---> ┊ Third-party MTA ┊
|
||||
----- implicit TLS --> ┤(465) │ | └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘
|
||||
----- cleartext -----> ┤(25) │ |
|
||||
|┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄|
|
||||
MUA <---- STARTTLS ------- ┤(143) MDA ╯ |
|
||||
<---- implicit TLS --- ┤(993) |
|
||||
└─────────────────────┘
|
||||
┌─────────────────────┐ ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
|
||||
MUA ----- STARTTLS -------> ┤(587) MTA ╮ (25)├ <-- cleartext ---> ┊ Third-party MTA ┊
|
||||
----- implicit TLS ---> ┤(465) │ | └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘
|
||||
----- cleartext ------> ┤(25) │ |
|
||||
|┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄|
|
||||
MUA <---- STARTTLS -------- ┤(143) MDA ╯ |
|
||||
<---- implicit TLS ---- ┤(993) |
|
||||
└─────────────────────┘
|
||||
|
||||
┗━━━━━━━━━━ Retrieval ━━━━━━━━━━━━━┛
|
||||
┗━━━━━━━━━━ Retrieval ━━━━━━━━━━━━━━┛
|
||||
```
|
||||
|
||||
If you're new to email infrastructure, both that table and the schema may be confusing.
|
||||
Read on to expand your understanding and learn about `docker-mailserver`'s configuration, including how you can customize it.
|
||||
Read on to expand your understanding and learn about DMS's configuration, including how you can customize it.
|
||||
|
||||
### Submission - SMTP
|
||||
|
||||
For a MUA to send an email to an MTA, it needs to establish a connection with that server, then push data packets over a network that both the MUA (client) and the MTA (server) are connected to. The server implements the [SMTP][wikipedia-smtp] protocol, which makes it capable of handling _Submission_.
|
||||
|
||||
In the case of `docker-mailserver`, the MTA (SMTP server) is Postfix. The MUA (client) may vary, yet its Submission request is performed as [TCP][wikipedia-tcp] packets sent over the _public_ internet. This exchange of information may be secured in order to counter eavesdropping.
|
||||
In the case of DMS, the MTA (SMTP server) is Postfix. The MUA (client) may vary, yet its Submission request is performed as [TCP][wikipedia-tcp] packets sent over the _public_ internet. This exchange of information may be secured in order to counter eavesdropping.
|
||||
|
||||
Now let's say I own an account on a `docker-mailserver` instance, `me@dms.io`. There are two very different use-cases for Submission:
|
||||
Now let's say I own an account on a DMS instance, `me@dms.io`. There are two very different use-cases for Submission:
|
||||
|
||||
1. I want to send an email to someone
|
||||
2. Someone wants to send you an email
|
||||
|
||||
In the first scenario, I will be submitting my email directly to my `docker-mailserver` instance/MTA (Postfix), which will then relay the email to its recipient's MTA for final delivery. In this case, Submission is first handled by establishing a direct connection to my own MTA-so at least for this portion of the delivery chain, I'll be able to ensure security/confidentiality. Not so much for what comes next, ie. relaying between MTAs and final delivery.
|
||||
In the first scenario, I will be submitting my email directly to my DMS instance/MTA (Postfix), which will then relay the email to its recipient's MTA for final delivery. In this case, Submission is first handled by establishing a direct connection to my own MTA-so at least for this portion of the delivery chain, I'll be able to ensure security/confidentiality. Not so much for what comes next, ie. relaying between MTAs and final delivery.
|
||||
|
||||
In the second scenario, a third-party email account owner will be first submitting an email to some third-party MTA. I have no control over this initial portion of the delivery chain, nor do I have control over the relaying that comes next. My MTA will merely accept a relayed email coming "out of the blue".
|
||||
|
||||
|
@ -124,7 +124,7 @@ My MTA will thus have to support two kinds of Submission:
|
|||
- Inbound Submission (third-party email has been submitted & relayed, then is accepted "inside" by the MTA)
|
||||
|
||||
```txt
|
||||
┏━━━━ Outbound Submission ━━━━┓
|
||||
┏━━━ Outbound Submission ━━━┓
|
||||
|
||||
┌────────────────────┐ ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
|
||||
Me ---------------> ┤ ├ -----------------> ┊ ┊
|
||||
|
@ -132,7 +132,7 @@ Me ---------------> ┤ ├ -----------------> ┊
|
|||
│ ├ <----------------- ┊ ┊
|
||||
└────────────────────┘ └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘
|
||||
|
||||
┗━━━━━━━━━━ Inbound Submission ━━━━━━━━━━┛
|
||||
┗━━━━━━━━━━ Inbound Submission ━━━━━━━━━━┛
|
||||
```
|
||||
|
||||
#### Outbound Submission
|
||||
|
@ -145,15 +145,15 @@ When it comes to securing Outbound Submission you should prefer to use _Implicit
|
|||
|
||||
Although a very satisfactory setup, Implicit TLS on port 465 is somewhat "cutting edge". There exists another well established mail Submission setup that must be supported as well, SMTP+STARTTLS on port 587. It uses Explicit TLS: the client starts with a cleartext connection, then the server informs a TLS-encrypted "upgraded" connection may be established, and the client _may_ eventually decide to establish it prior to the Submission. Basically it's an opportunistic, opt-in TLS upgrade of the connection between the client and the server, at the client's discretion, using a mechanism known as [STARTTLS][wikipedia-starttls] that both ends need to implement.
|
||||
|
||||
In many implementations, the mail server doesn't enforce TLS encryption, for backwards compatibility. Clients are thus free to deny the TLS-upgrade proposal (or [misled by a hacker](https://security.stackexchange.com/questions/168998/what-happens-if-starttls-dropped-in-smtp) about STARTTLS not being available), and the server accepts unencrypted (cleartext) mail exchange, which poses a confidentiality threat and, to some extent, spam issues. [RFC 8314 (section 3.3)][rfc-8314-s33] recommends for a mail server to support both Implicit and Explicit TLS for Submission, _and_ to enforce TLS-encryption on ports 587 (Explicit TLS) and 465 (Implicit TLS). That's exactly `docker-mailserver`'s default configuration: abiding by RFC 8314, it [enforces a strict (`encrypt`) STARTTLS policy](http://www.postfix.org/postconf.5.html#smtpd_tls_security_level), where a denied TLS upgrade terminates the connection thus (hopefully but at the client's discretion) preventing unencrypted (cleartext) Submission.
|
||||
In many implementations, the mail server doesn't enforce TLS encryption, for backwards compatibility. Clients are thus free to deny the TLS-upgrade proposal (or [misled by a hacker](https://security.stackexchange.com/questions/168998/what-happens-if-starttls-dropped-in-smtp) about STARTTLS not being available), and the server accepts unencrypted (cleartext) mail exchange, which poses a confidentiality threat and, to some extent, spam issues. [RFC 8314 (section 3.3)][rfc-8314-s33] recommends for a mail server to support both Implicit and Explicit TLS for Submission, _and_ to enforce TLS-encryption on ports 587 (Explicit TLS) and 465 (Implicit TLS). That's exactly DMS's default configuration: abiding by RFC 8314, it [enforces a strict (`encrypt`) STARTTLS policy](http://www.postfix.org/postconf.5.html#smtpd_tls_security_level), where a denied TLS upgrade terminates the connection thus (hopefully but at the client's discretion) preventing unencrypted (cleartext) Submission.
|
||||
|
||||
- **`docker-mailserver`'s default configuration enables and _requires_ Explicit TLS (STARTTLS) on port 587 for Outbound Submission.**
|
||||
- **DMS's default configuration enables and _requires_ Explicit TLS (STARTTLS) on port 587 for Outbound Submission.**
|
||||
- It does not enable Implicit TLS Outbound Submission on port 465 by default. One may enable it through simple custom configuration, either as a replacement or (better!) supplementary mean of secure Submission.
|
||||
- It does not support old MUAs (clients) not supporting TLS encryption on ports 587/465 (those should perform Submission on port 25, more details below). One may relax that constraint through advanced custom configuration, for backwards compatibility.
|
||||
|
||||
A final Outbound Submission setup exists and is akin SMTP+STARTTLS on port 587, but on port 25. That port has historically been reserved specifically for unencrypted (cleartext) mail exchange though, making STARTTLS a bit wrong to use. As is expected by [RFC 5321][rfc-5321], `docker-mailserver` uses port 25 for unencrypted Submission in order to support older clients, but most importantly for unencrypted Transfer/Relay between MTAs.
|
||||
A final Outbound Submission setup exists and is akin SMTP+STARTTLS on port 587, but on port 25. That port has historically been reserved specifically for unencrypted (cleartext) mail exchange though, making STARTTLS a bit wrong to use. As is expected by [RFC 5321][rfc-5321], DMS uses port 25 for unencrypted Submission in order to support older clients, but most importantly for unencrypted Transfer/Relay between MTAs.
|
||||
|
||||
- **`docker-mailserver`'s default configuration also enables unencrypted (cleartext) on port 25 for Outbound Submission.**
|
||||
- **DMS's default configuration also enables unencrypted (cleartext) on port 25 for Outbound Submission.**
|
||||
- It does not enable Explicit TLS (STARTTLS) on port 25 by default. One may enable it through advanced custom configuration, either as a replacement (bad!) or as a supplementary mean of secure Outbound Submission.
|
||||
- One may also secure Outbound Submission using advanced encryption scheme, such as DANE/DNSSEC and/or MTA-STS.
|
||||
|
||||
|
@ -161,14 +161,14 @@ A final Outbound Submission setup exists and is akin SMTP+STARTTLS on port 587,
|
|||
|
||||
Granted it's still very difficult enforcing encryption between MTAs (Transfer/Relay) without risking dropping emails (when relayed by MTAs not supporting TLS-encryption), Inbound Submission is to be handled in cleartext on port 25 by default.
|
||||
|
||||
- **`docker-mailserver`'s default configuration enables unencrypted (cleartext) on port 25 for Inbound Submission.**
|
||||
- **DMS's default configuration enables unencrypted (cleartext) on port 25 for Inbound Submission.**
|
||||
- It does not enable Explicit TLS (STARTTLS) on port 25 by default. One may enable it through advanced custom configuration, either as a replacement (bad!) or as a supplementary mean of secure Inbound Submission.
|
||||
- One may also secure Inbound Submission using advanced encryption scheme, such as DANE/DNSSEC and/or MTA-STS.
|
||||
|
||||
Overall, `docker-mailserver`'s default configuration for SMTP looks like this:
|
||||
Overall, DMS's default configuration for SMTP looks like this:
|
||||
|
||||
```txt
|
||||
┏━━━━ Outbound Submission ━━━━┓
|
||||
┏━━━ Outbound Submission ━━━┓
|
||||
|
||||
┌────────────────────┐ ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
|
||||
Me -- cleartext --> ┤(25) (25)├ --- cleartext ---> ┊ ┊
|
||||
|
@ -177,20 +177,20 @@ Me -- STARTTLS ---> ┤(587) │ ┊
|
|||
│ (25)├ <---cleartext ---- ┊ ┊
|
||||
└────────────────────┘ └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘
|
||||
|
||||
┗━━━━━━━━━━ Inbound Submission ━━━━━━━━━━┛
|
||||
┗━━━━━━━━━━ Inbound Submission ━━━━━━━━━━┛
|
||||
```
|
||||
|
||||
### Retrieval - IMAP
|
||||
|
||||
A MUA willing to fetch an email from a mail server will most likely communicate with its [IMAP][wikipedia-imap] server. As with SMTP described earlier, communication will take place in the form of data packets exchanged over a network that both the client and the server are connected to. The IMAP protocol makes the server capable of handling _Retrieval_.
|
||||
|
||||
In the case of `docker-mailserver`, the IMAP server is Dovecot. The MUA (client) may vary, yet its Retrieval request is performed as [TCP][wikipedia-tcp] packets sent over the _public_ internet. This exchange of information may be secured in order to counter eavesdropping.
|
||||
In the case of DMS, the IMAP server is Dovecot. The MUA (client) may vary, yet its Retrieval request is performed as [TCP][wikipedia-tcp] packets sent over the _public_ internet. This exchange of information may be secured in order to counter eavesdropping.
|
||||
|
||||
Again, as with SMTP described earlier, the IMAP protocol may be secured with either Implicit TLS (aka. [IMAPS][wikipedia-imaps] / IMAP4S) or Explicit TLS (using STARTTLS).
|
||||
|
||||
The best practice as of 2020 is to enforce IMAPS on port 993, rather than IMAP+STARTTLS on port 143 (see [RFC 8314][rfc-8314]); yet the latter is usually provided for backwards compatibility.
|
||||
|
||||
**`docker-mailserver`'s default configuration enables both Implicit and Explicit TLS for Retrievial, on ports 993 and 143 respectively.**
|
||||
**DMS's default configuration enables both Implicit and Explicit TLS for Retrievial, on ports 993 and 143 respectively.**
|
||||
|
||||
### Retrieval - POP3
|
||||
|
||||
|
@ -198,20 +198,19 @@ Similarly to IMAP, the older POP3 protocol may be secured with either Implicit o
|
|||
|
||||
The best practice as of 2020 would be [POP3S][wikipedia-pop3s] on port 995, rather than [POP3][wikipedia-pop3]+STARTTLS on port 110 (see [RFC 8314][rfc-8314]).
|
||||
|
||||
**`docker-mailserver`'s default configuration disables POP3 altogether.** One should expect MUAs to use TLS-encrypted IMAP for Retrieval.
|
||||
**DMS's default configuration disables POP3 altogether.** One should expect MUAs to use TLS-encrypted IMAP for Retrieval.
|
||||
|
||||
## How Does `docker-mailserver` Help With Setting Everything Up?
|
||||
## How Does DMS Help With Setting Everything Up?
|
||||
|
||||
As a _batteries included_ container image, `docker-mailserver` provides you with all the required components and a default configuration to run a decent and secure mail server. One may then customize all aspects of its internal components.
|
||||
|
||||
- Simple customization is supported through [docker-compose configuration][github-file-compose] and the [env-mailserver][github-file-envmailserver] configuration file.
|
||||
- Advanced customization is supported through providing "monkey-patching" configuration files and/or [deriving your own image][github-file-dockerfile] from `docker-mailserver`'s upstream, for a complete control over how things run.
|
||||
As a _batteries included_ container image, DMS provides you with all the required components and a default configuration to run a decent and secure mail server. One may then customize all aspects of its internal components.
|
||||
|
||||
- Simple customization is supported through [Docker Compose configuration][github-file-compose] and the [env-mailserver][github-file-envmailserver] configuration file.
|
||||
- Advanced customization is supported through providing "monkey-patching" configuration files and/or [deriving your own image][github-file-dockerfile] from DMS's upstream, for a complete control over how things run.
|
||||
|
||||
Eventually, it is up to _you_ deciding exactly what kind of transportation/encryption to use and/or enforce, and to customize your instance accordingly (with looser or stricter security). Be also aware that protocols and ports on your server can only go so far with security; third-party MTAs might relay your emails on insecure connections, man-in-the-middle attacks might still prove effective, etc. Advanced counter-measure such as DANE, MTA-STS and/or full body encryption (eg. PGP) should be considered as well for increased confidentiality, but ideally without compromising backwards compatibility so as to not block emails.
|
||||
|
||||
[docs-understandports]: ./config/security/understanding-the-ports.md
|
||||
[github-file-compose]: https://github.com/docker-mailserver/docker-mailserver/blob/master/docker-compose.yml
|
||||
[github-file-compose]: https://github.com/docker-mailserver/docker-mailserver/blob/master/compose.yaml
|
||||
[github-file-envmailserver]: https://github.com/docker-mailserver/docker-mailserver/blob/master/mailserver.env
|
||||
[github-file-dockerfile]: https://github.com/docker-mailserver/docker-mailserver/blob/master/Dockerfile
|
||||
[rfc-2487]: https://tools.ietf.org/html/rfc2487
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
title: Usage
|
||||
---
|
||||
|
||||
This pages explains how to get started with DMS. The guide uses Docker Compose as a reference. In our examples, a volume mounts the host location [`docker-data/dms/config/`][docs-dms-config-volume] to `/tmp/docker-mailserver/` inside the container.
|
||||
This page explains how to get started with DMS. The guide uses Docker Compose as a reference. In our examples, a volume mounts the host location [`docker-data/dms/config/`][docs::dms-volumes-config] to `/tmp/docker-mailserver/` inside the container.
|
||||
|
||||
[docs-dms-config-volume]: ./config/advanced/optional-config.md
|
||||
[docs::dms-volumes-config]: ./config/advanced/optional-config.md#volumes-config
|
||||
|
||||
## Preliminary Steps
|
||||
|
||||
Before you can get started with deploying your own mail server, there are some requirements to be met:
|
||||
|
||||
1. You need to have a host that you can manage.
|
||||
2. You need to own a domain, and you need to able to manage DNS for this domain.
|
||||
2. You need to own a domain, and you need to be able to manage DNS for this domain.
|
||||
|
||||
### Host Setup
|
||||
|
||||
|
@ -21,16 +21,17 @@ There are a few requirements for a suitable host system:
|
|||
2. The host should be able to send/receive on the [necessary ports for mail][docs-ports-overview]
|
||||
3. You should be able to set a `PTR` record for your host; security-hardened mail servers might otherwise reject your mail server as the IP address of your host does not resolve correctly/at all to the DNS name of your server.
|
||||
|
||||
On the host, you should have a suitable container runtime (like _Docker_ or _Podman_) installed. We assume [_Docker Compose_][docker-compose] is [installed][docker-compose-installation].
|
||||
!!! note "About the Container Runtime"
|
||||
|
||||
!!! info "Podman Support"
|
||||
On the host, you need to have a suitable container runtime (like _Docker_ or _Podman_) installed. We assume [_Docker Compose_][docker-compose] is [installed][docker-compose-installation]. We have aligned file names and configuration conventions with the latest [Docker Compose (currently V2) specification][docker-compose-specification].
|
||||
|
||||
If you're using podman, make sure to read the related [documentation][docs-podman].
|
||||
|
||||
[docs-podman]: ./config/advanced/podman.md
|
||||
[docs-ports-overview]: ./config/security/understanding-the-ports.md#overview-of-email-ports
|
||||
[docker-compose]: https://docs.docker.com/compose/
|
||||
[docker-compose-installation]: https://docs.docker.com/compose/install/
|
||||
[docker-compose-specification]: https://docs.docker.com/compose/compose-file/
|
||||
[docs-podman]: ./config/advanced/podman.md
|
||||
|
||||
### Minimal DNS Setup
|
||||
|
||||
|
@ -47,10 +48,21 @@ We will later dig into DKIM, DMARC & SPF, but for now, these are the records tha
|
|||
- The **MX record** tells everyone which (DNS) name is responsible for e-mails on your domain.
|
||||
Because you want to keep the option of running another service on the domain name itself, you run your mail server on `mail.example.com`.
|
||||
This does not imply your e-mails will look like `test@mail.example.com`, the DNS name of your mail server is decoupled of the domain it serves e-mails for.
|
||||
In theory, you mail server could even serve e-mails for `test@some-other-domain.com`, if the MX record for `some-other-domain.com` points to `mail.example.com`.
|
||||
Your mail server could also handle emails for `test@some-other-domain.com`, if the MX record for `some-other-domain.com` points to `mail.example.com`.
|
||||
- The **A record** tells everyone which IP address the DNS name `mail.example.com` resolves to.
|
||||
- The **PTR record** is the counterpart of the A record, telling everyone what name the IP address `11.22.33.44` resolves to.
|
||||
|
||||
!!! note "About The Mail Server's Fully Qualified Domain Name"
|
||||
|
||||
The mail server's fully qualified domain name (FQDN) in our example above is `mail.example.com`. Please note though that this is more of a convention, and not due to technical restrictions. One could also run the mail server
|
||||
|
||||
1. on `foo.example.com`: you would just need to change your `MX` record;
|
||||
2. on `example.com` directly: you would need to change your `MX` record and probably [read our docs on bare domain setups][docs-faq-bare-domain], as these setups are called "bare domain" setups.
|
||||
|
||||
The FQDN is what is relevant for TLS certificates, it has no (inherent/technical) relation to the email addresses and accounts DMS manages. That is to say: even though DMS runs on `mail.example.com`, or `foo.example.com`, or `example.com`, there is nothing that prevents it from managing mail for `barbaz.org` - `barbaz.org` will just need to set its `MX` record to `mail.example.com` (or `foo.example.com` or `example.com`).
|
||||
|
||||
[docs-faq-bare-domain]: ./faq.md#can-i-use-a-nakedbare-domain-ie-no-hostname
|
||||
|
||||
If you setup everything, it should roughly look like this:
|
||||
|
||||
```console
|
||||
|
@ -87,14 +99,14 @@ All workflows are using the tagging convention listed below. It is subsequently
|
|||
Issue the following commands to acquire the necessary files:
|
||||
|
||||
``` BASH
|
||||
DMS_GITHUB_URL="https://github.com/docker-mailserver/docker-mailserver/blob/latest"
|
||||
wget "${DMS_GITHUB_URL}/docker-compose.yml"
|
||||
DMS_GITHUB_URL="https://raw.githubusercontent.com/docker-mailserver/docker-mailserver/master"
|
||||
wget "${DMS_GITHUB_URL}/compose.yaml"
|
||||
wget "${DMS_GITHUB_URL}/mailserver.env"
|
||||
```
|
||||
|
||||
### Configuration Steps
|
||||
|
||||
1. First edit `docker-compose.yml` to your liking
|
||||
1. First edit `compose.yaml` to your liking
|
||||
- Substitute `mail.example.com` according to your FQDN.
|
||||
- If you want to use SELinux for the `./docker-data/dms/config/:/tmp/docker-mailserver/` mount, append `-z` or `-Z`.
|
||||
2. Then configure the environment specific to the mail server by editing [`mailserver.env`][docs-environment], but keep in mind that:
|
||||
|
@ -123,7 +135,7 @@ For an overview of commands to manage DMS config, run: `docker exec -it <CONTAIN
|
|||
|
||||
```console
|
||||
$ ./setup.sh help
|
||||
Image 'docker.io/mailserver/docker-mailserver:latest' not found. Pulling ...
|
||||
Image 'ghcr.io/docker-mailserver/docker-mailserver:latest' not found. Pulling ...
|
||||
SETUP(1)
|
||||
|
||||
NAME
|
||||
|
@ -152,55 +164,23 @@ You definitely want to setup TLS. Please refer to [our documentation about TLS][
|
|||
|
||||
You should add at least one [alias][docs-aliases], the [_postmaster alias_][docs-env-postmaster]. This is a common convention, but not strictly required.
|
||||
|
||||
[docs-aliases]: ./config/user-management.md#aliases
|
||||
[docs-aliases]: ./config/account-management/overview.md#aliases
|
||||
[docs-env-postmaster]: ./config/environment.md#postmaster_address
|
||||
|
||||
```bash
|
||||
docker exec -ti <CONTAINER NAME> setup alias add postmaster@example.com user@example.com
|
||||
```
|
||||
|
||||
### DKIM Keys
|
||||
### Advanced DNS Setup - DKIM, DMARC & SPF
|
||||
|
||||
You can (_and you should_) generate DKIM keys. For more information:
|
||||
|
||||
- DKIM [with OpenDKIM][docs-dkim-opendkim] (_enabled by default_)
|
||||
- DKIM [with Rspamd][docs-dkim-rspamd] (_when using `ENABLE_RSPAMD=1`_)
|
||||
|
||||
When keys are generated, you can configure your DNS server by just pasting the content of `config/opendkim/keys/domain.tld/mail.txt` to [set up DKIM][dkim-signing-setup]. See the [documentation][docs-dkim-dns] for more details.
|
||||
|
||||
!!! note
|
||||
|
||||
In case you're using LDAP, the setup looks a bit different as you do not add user accounts directly. Postfix doesn't know your domain(s) and you need to provide it when configuring DKIM:
|
||||
|
||||
``` BASH
|
||||
docker exec -ti <CONTAINER NAME> setup config dkim domain '<domain.tld>[,<domain2.tld>]'
|
||||
```
|
||||
|
||||
[dkim-signing-setup]: https://mxtoolbox.com/dmarc/dkim/setup/how-to-setup-dkim
|
||||
[docs-dkim-dns]: ./config/best-practices/dkim.md#configuration-using-a-web-interface
|
||||
[docs-dkim-opendkim]: ./config/best-practices/dkim.md#enabling-dkim-signature
|
||||
[docs-dkim-rspamd]: ./config/security/rspamd.md#dkim-signing
|
||||
|
||||
### Advanced DNS Setup
|
||||
|
||||
You will very likely want to configure your DNS with these TXT records: [SPF, DKIM, and DMARC][cloudflare-spf-dkim-dmarc].
|
||||
|
||||
The following illustrates what a (rather strict) set of records could look like:
|
||||
|
||||
```console
|
||||
$ dig @1.1.1.1 +short TXT example.com
|
||||
"v=spf1 mx -all"
|
||||
$ dig @1.1.1.1 +short TXT dkim-rsa._domainkey.example.com
|
||||
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQ..."
|
||||
$ dig @1.1.1.1 +short TXT _dmarc.example.com
|
||||
"v=DMARC1; p=reject; sp=reject; pct=100; adkim=s; aspf=s; fo=1"
|
||||
```
|
||||
You will very likely want to configure your DNS with these TXT records: [SPF, DKIM, and DMARC][cloudflare-spf-dkim-dmarc]. We also ship a [dedicated page in our documentation][docs-dkim-dmarc-spf] about the setup of DKIM, DMARC & SPF.
|
||||
|
||||
[cloudflare-spf-dkim-dmarc]: https://www.cloudflare.com/learning/email-security/dmarc-dkim-spf/
|
||||
[docs-dkim-dmarc-spf]: ./config/best-practices/dkim_dmarc_spf.md
|
||||
|
||||
### Custom User Changes & Patches
|
||||
|
||||
If you'd like to change, patch or alter files or behavior of `docker-mailserver`, you can use a script. See [this part of our documentation][docs-user-patches] for a detailed explanation.
|
||||
If you'd like to change, patch or alter files or behavior of DMS, you can use a script. See [this part of our documentation][docs-user-patches] for a detailed explanation.
|
||||
|
||||
[docs-user-patches]: ./faq.md#how-to-adjust-settings-with-the-user-patchessh-script
|
||||
|
||||
|
@ -212,3 +192,4 @@ Here are some tools you can use to verify your configuration:
|
|||
2. [DMARC Analyzer](https://www.mimecast.com/products/dmarc-analyzer/spf-record-check/)
|
||||
3. [mail-tester.com](https://www.mail-tester.com/)
|
||||
4. [multiRBL.valli.org](https://multirbl.valli.org/)
|
||||
5. [internet.nl](https://internet.nl/test-mail/)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Site specific:
|
||||
site_name: 'Docker Mailserver'
|
||||
site_description: 'A fullstack but simple mail-server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.) using Docker.'
|
||||
site_description: 'A fullstack but simple mail-server (SMTP, IMAP, LDAP, Anti-spam, Anti-virus, etc.) using Docker.'
|
||||
site_author: 'docker-mailserver (Github Organization)'
|
||||
copyright: '<p>© <a href="https://github.com/docker-mailserver"><em>Docker Mailserver Organization</em></a><br/><span>This project is licensed under the MIT license.</span></p>'
|
||||
|
||||
|
@ -35,6 +35,8 @@ theme:
|
|||
- navigation.top
|
||||
- navigation.expand
|
||||
- navigation.instant
|
||||
- content.action.edit
|
||||
- content.action.view
|
||||
- content.code.annotate
|
||||
palette:
|
||||
# Light mode
|
||||
|
@ -78,13 +80,21 @@ markdown_extensions:
|
|||
- name: mermaid
|
||||
class: mermaid
|
||||
format: !!python/name:pymdownx.superfences.fence_code_format
|
||||
- pymdownx.tabbed:
|
||||
alternate_style: true
|
||||
slugify: !!python/object/apply:pymdownx.slugs.slugify
|
||||
kwds:
|
||||
case: lower
|
||||
- pymdownx.tasklist:
|
||||
custom_checkbox: true
|
||||
- pymdownx.magiclink
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.tilde
|
||||
- pymdownx.emoji:
|
||||
emoji_index: !!python/name:materialx.emoji.twemoji
|
||||
emoji_generator: !!python/name:materialx.emoji.to_svg
|
||||
emoji_index: !!python/name:material.extensions.emoji.twemoji
|
||||
emoji_generator: !!python/name:material.extensions.emoji.to_svg
|
||||
- pymdownx.highlight:
|
||||
# Configures an alias (name) to a supported syntax (lang):
|
||||
extend_pygments_lang:
|
||||
- name: yml
|
||||
lang: yaml
|
||||
|
@ -94,12 +104,26 @@ markdown_extensions:
|
|||
lang: cfg
|
||||
- name: env
|
||||
lang: properties
|
||||
# Not helpful with Python Pygments lexer highlighting, but we might change to a JS highlighter in future
|
||||
# Ideally, this type of codefence might also have word-wrap enabled (CSS: {white-space: pre-wrap})
|
||||
# We only show PHP snippets, requires config change to work:
|
||||
# https://squidfunk.github.io/mkdocs-material/setup/extensions/python-markdown-extensions/#highlight
|
||||
# https://facelessuser.github.io/pymdown-extensions/extensions/highlight/#extended-pygments-lexer-options
|
||||
- name: php
|
||||
lang: php
|
||||
options:
|
||||
startinline: true
|
||||
# A variant that sometimes has nicer syntax highlighting:
|
||||
- name: cf-extra
|
||||
lang: linuxconfig
|
||||
- name: cli-syntax
|
||||
lang: linuxconfig
|
||||
# These formats aren't supported by Python Pygments lexer,
|
||||
# but we use them when the context is appropriate.
|
||||
- name: log
|
||||
lang: shell-session
|
||||
- name: fetchmailrc
|
||||
lang: txt
|
||||
- name: getmailrc
|
||||
lang: txt
|
||||
- name: caddyfile
|
||||
lang: txt
|
||||
|
||||
|
@ -114,12 +138,18 @@ nav:
|
|||
- 'Usage': usage.md
|
||||
- 'Configuration':
|
||||
- 'Environment Variables': config/environment.md
|
||||
- 'User Management': config/user-management.md
|
||||
- 'Account Management':
|
||||
- 'Overview': config/account-management/overview.md
|
||||
- 'Provisioner':
|
||||
- 'File Based': config/account-management/provisioner/file.md
|
||||
- 'LDAP Service': config/account-management/provisioner/ldap.md
|
||||
- 'Supplementary':
|
||||
- 'Master Accounts': config/account-management/supplementary/master-accounts.md
|
||||
- 'OAuth2 Authentication': config/account-management/supplementary/oauth2.md
|
||||
- 'Best Practices':
|
||||
- 'DKIM': config/best-practices/dkim.md
|
||||
- 'DMARC': config/best-practices/dmarc.md
|
||||
- 'SPF': config/best-practices/spf.md
|
||||
- 'Auto-discovery': config/best-practices/autodiscover.md
|
||||
- 'DKIM, DMARC & SPF': config/best-practices/dkim_dmarc_spf.md
|
||||
- 'MTA-STS': config/best-practices/mta-sts.md
|
||||
- 'Security':
|
||||
- 'Understanding the Ports': config/security/understanding-the-ports.md
|
||||
- 'SSL/TLS': config/security/ssl.md
|
||||
|
@ -128,7 +158,7 @@ nav:
|
|||
- 'Rspamd' : config/security/rspamd.md
|
||||
- 'Debugging': config/debugging.md
|
||||
- 'Mail Delivery with POP3': config/pop3.md
|
||||
- 'Your Friend setup.sh': config/setup.sh.md
|
||||
- 'About setup.sh': config/setup.sh.md
|
||||
- 'Advanced Configuration':
|
||||
- 'Optional Configuration': config/advanced/optional-config.md
|
||||
- 'Maintenance':
|
||||
|
@ -137,30 +167,36 @@ nav:
|
|||
- 'Dovecot': config/advanced/override-defaults/dovecot.md
|
||||
- 'Postfix': config/advanced/override-defaults/postfix.md
|
||||
- 'Modifications via Script': config/advanced/override-defaults/user-patches.md
|
||||
- 'LDAP Authentication': config/advanced/auth-ldap.md
|
||||
- 'Email Filtering with Sieve': config/advanced/mail-sieve.md
|
||||
- 'Email Gathering with Fetchmail': config/advanced/mail-fetchmail.md
|
||||
- 'Email Gathering with Getmail': config/advanced/mail-getmail.md
|
||||
- 'Email Forwarding':
|
||||
- 'Relay Hosts': config/advanced/mail-forwarding/relay-hosts.md
|
||||
- 'AWS SES': config/advanced/mail-forwarding/aws-ses.md
|
||||
- 'Configure Gmail as a relay host': config/advanced/mail-forwarding/gmail-smtp.md
|
||||
- 'Full-Text Search': config/advanced/full-text-search.md
|
||||
- 'Kubernetes': config/advanced/kubernetes.md
|
||||
- 'IPv6': config/advanced/ipv6.md
|
||||
- 'Podman': config/advanced/podman.md
|
||||
- 'Dovecot Master Accounts': config/advanced/dovecot-master-accounts.md
|
||||
- 'Examples':
|
||||
- 'Tutorials':
|
||||
- 'Basic Installation': examples/tutorials/basic-installation.md
|
||||
- 'Mailserver behind Proxy': examples/tutorials/mailserver-behind-proxy.md
|
||||
- 'Crowdsec': examples/tutorials/crowdsec.md
|
||||
- 'Building your own Docker image': examples/tutorials/docker-build.md
|
||||
- 'Blog Posts': examples/tutorials/blog-posts.md
|
||||
- 'Dovecot FTS with Apache Solr': examples/tutorials/dovecot-solr.md
|
||||
- 'Use Cases':
|
||||
- 'Forward-Only Mail-Server with LDAP': examples/use-cases/forward-only-mailserver-with-ldap-authentication.md
|
||||
- 'Customize IMAP Folders': examples/use-cases/imap-folders.md
|
||||
- 'iOS Mail Push Support': examples/use-cases/ios-mail-push-support.md
|
||||
- 'Lua Authentication': examples/use-cases/auth-lua.md
|
||||
- 'Bind outbound SMTP to a specific network': examples/use-cases/bind-smtp-network-interface.md
|
||||
- 'Relay inbound and outbound mail for an internal DMS': examples/use-cases/external-relay-only-mailserver.md
|
||||
- 'FAQ' : faq.md
|
||||
- 'Contributing':
|
||||
- 'General Information': contributing/general.md
|
||||
- 'Tests': contributing/tests.md
|
||||
- 'Issues and Pull Requests': contributing/issues-and-pull-requests.md
|
||||
- 'DockerHub': https://hub.docker.com/r/mailserver/docker-mailserver/
|
||||
- 'GHCR': https://github.com/docker-mailserver/docker-mailserver/pkgs/container/docker-mailserver
|
||||
- '<span class="icon-external-link"></span>DockerHub': https://hub.docker.com/r/mailserver/docker-mailserver/
|
||||
- '<span class="icon-external-link"></span>GHCR': https://github.com/docker-mailserver/docker-mailserver/pkgs/container/docker-mailserver
|
||||
|
|
179
mailserver.env
179
mailserver.env
|
@ -30,9 +30,11 @@ LOG_LEVEL=info
|
|||
# debug => Also show debug messages
|
||||
SUPERVISOR_LOGLEVEL=
|
||||
|
||||
# 0 => mail state in default directories
|
||||
# 1 => consolidate all states into a single directory (`/var/mail-state`) to allow persistence using docker volumes
|
||||
ONE_DIR=1
|
||||
# Support for deployment where these defaults are not compatible (eg: some NAS appliances):
|
||||
# /var/mail vmail User ID (default: 5000)
|
||||
DMS_VMAIL_UID=
|
||||
# /var/mail vmail Group ID (default: 5000)
|
||||
DMS_VMAIL_GID=
|
||||
|
||||
# **empty** => use FILE
|
||||
# LDAP => use LDAP authentication
|
||||
|
@ -87,10 +89,10 @@ TLS_LEVEL=
|
|||
# Configures the handling of creating mails with forged sender addresses.
|
||||
#
|
||||
# **0** => (not recommended) Mail address spoofing allowed. Any logged in user may create email messages with a forged sender address (see also https://en.wikipedia.org/wiki/Email_spoofing).
|
||||
# 1 => Mail spoofing denied. Each user may only send with his own or his alias addresses. Addresses with extension delimiters(http://www.postfix.org/postconf.5.html#recipient_delimiter) are not able to send messages.
|
||||
# 1 => Mail spoofing denied. Each user may only send with their own or their alias addresses. Addresses with extension delimiters(http://www.postfix.org/postconf.5.html#recipient_delimiter) are not able to send messages.
|
||||
SPOOF_PROTECTION=
|
||||
|
||||
# Enables the Sender Rewriting Scheme. SRS is needed if your mail server acts as forwarder. See [postsrsd](https://github.com/roehling/postsrsd/blob/master/README.md#sender-rewriting-scheme-crash-course) for further explanation.
|
||||
# Enables the Sender Rewriting Scheme. SRS is needed if your mail server acts as forwarder. See [postsrsd](https://github.com/roehling/postsrsd/blob/main/README.rst) for further explanation.
|
||||
# - **0** => Disabled
|
||||
# - 1 => Enabled
|
||||
ENABLE_SRS=0
|
||||
|
@ -105,15 +107,35 @@ ENABLE_OPENDKIM=1
|
|||
# 0 => Disabled
|
||||
ENABLE_OPENDMARC=1
|
||||
|
||||
# 1 => Enables POP3 service
|
||||
# empty => disables POP3
|
||||
|
||||
# Enabled `policyd-spf` in Postfix's configuration. You will likely want to set this
|
||||
# to `0` in case you're using Rspamd (`ENABLE_RSPAMD=1`).
|
||||
#
|
||||
# - 0 => Disabled
|
||||
# - **1** => Enabled
|
||||
ENABLE_POLICYD_SPF=1
|
||||
|
||||
# Enables POP3 service
|
||||
# - **0** => Disabled
|
||||
# - 1 => Enabled
|
||||
ENABLE_POP3=
|
||||
|
||||
# Enables IMAP service
|
||||
# - 0 => Disabled
|
||||
# - **1** => Enabled
|
||||
ENABLE_IMAP=1
|
||||
|
||||
# Enables ClamAV, and anti-virus scanner.
|
||||
# 1 => Enabled
|
||||
# **0** => Disabled
|
||||
ENABLE_CLAMAV=0
|
||||
|
||||
# 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=
|
||||
|
||||
# Enables Rspamd
|
||||
# **0** => Disabled
|
||||
# 1 => Enabled
|
||||
|
@ -125,6 +147,49 @@ ENABLE_RSPAMD=0
|
|||
# 1 => Enabled
|
||||
ENABLE_RSPAMD_REDIS=
|
||||
|
||||
# When enabled,
|
||||
#
|
||||
# 1. the "[autolearning][rspamd-autolearn]" feature is turned on;
|
||||
# 2. the Bayes classifier will be trained when moving mails from or to the Junk folder (with the help of Sieve scripts).
|
||||
#
|
||||
# **0** => disabled
|
||||
# 1 => enabled
|
||||
RSPAMD_LEARN=0
|
||||
|
||||
# This settings controls whether checks should be performed on emails coming
|
||||
# from authenticated users (i.e. most likely outgoing emails). The default value
|
||||
# is `0` in order to align better with SpamAssassin. We recommend reading
|
||||
# through https://rspamd.com/doc/tutorials/scanning_outbound.html though to
|
||||
# decide for yourself whether you need and want this feature.
|
||||
#
|
||||
# Note that DKIM signing of e-mails will still happen.
|
||||
RSPAMD_CHECK_AUTHENTICATED=0
|
||||
|
||||
# Controls whether the Rspamd Greylisting module is enabled.
|
||||
# This module can further assist in avoiding spam emails by greylisting
|
||||
# e-mails with a certain spam score.
|
||||
#
|
||||
# **0** => disabled
|
||||
# 1 => enabled
|
||||
RSPAMD_GREYLISTING=0
|
||||
|
||||
# Can be used to enable or disable the Hfilter group module.
|
||||
#
|
||||
# - 0 => Disabled
|
||||
# - **1** => Enabled
|
||||
RSPAMD_HFILTER=1
|
||||
|
||||
# Can be used to control the score when the HFILTER_HOSTNAME_UNKNOWN symbol applies. A higher score is more punishing. Setting it to 15 is equivalent to rejecting the email when the check fails.
|
||||
#
|
||||
# Default: 6
|
||||
RSPAMD_HFILTER_HOSTNAME_UNKNOWN_SCORE=6
|
||||
|
||||
# Can be used to enable or disable the (still experimental) neural module.
|
||||
#
|
||||
# - **0** => Disabled
|
||||
# - 1 => Enabled
|
||||
RSPAMD_NEURAL=0
|
||||
|
||||
# Amavis content filter (used for ClamAV & SpamAssassin)
|
||||
# 0 => Disabled
|
||||
# 1 => Enabled
|
||||
|
@ -142,7 +207,7 @@ AMAVIS_LOGLEVEL=0
|
|||
# 1 => DNS block lists are enabled
|
||||
ENABLE_DNSBL=0
|
||||
|
||||
# If you enable Fail2Ban, don't forget to add the following lines to your `docker-compose.yml`:
|
||||
# If you enable Fail2Ban, don't forget to add the following lines to your `compose.yaml`:
|
||||
# cap_add:
|
||||
# - NET_ADMIN
|
||||
# Otherwise, `nftables` won't be able to ban IPs.
|
||||
|
@ -197,17 +262,17 @@ VIRUSMAILS_DELETE_DELAY=
|
|||
# `lmtp:<kopano-host>:2003` (use kopano as mailstore)
|
||||
POSTFIX_DAGENT=
|
||||
|
||||
# Set the mailbox size limit for all users. If set to zero, the size will be unlimited (default).
|
||||
# Set the mailbox size limit for all users. If set to zero, the size will be unlimited (default). Size is in bytes.
|
||||
#
|
||||
# empty => 0
|
||||
POSTFIX_MAILBOX_SIZE_LIMIT=
|
||||
|
||||
# See https://docker-mailserver.github.io/docker-mailserver/edge/config/user-management/accounts/#notes
|
||||
# See https://docker-mailserver.github.io/docker-mailserver/latest/config/account-management/overview/#quotas
|
||||
# 0 => Dovecot quota is disabled
|
||||
# 1 => Dovecot quota is enabled
|
||||
ENABLE_QUOTAS=1
|
||||
|
||||
# Set the message size limit for all users. If set to zero, the size will be unlimited (not recommended!)
|
||||
# Set the message size limit for all users. If set to zero, the size will be unlimited (not recommended!). Size is in bytes.
|
||||
#
|
||||
# empty => 10240000 (~10 MB)
|
||||
POSTFIX_MESSAGE_SIZE_LIMIT=
|
||||
|
@ -282,6 +347,16 @@ REPORT_SENDER=
|
|||
# Note: This variable can also determine the interval for Postfix's log summary reports, see [`PFLOGSUMM_TRIGGER`](#pflogsumm_trigger).
|
||||
LOGROTATE_INTERVAL=weekly
|
||||
|
||||
# Defines how many log files are kept by logrorate
|
||||
LOGROTATE_COUNT=4
|
||||
|
||||
|
||||
# If enabled, employs `reject_unknown_client_hostname` to sender restrictions in Postfix's configuration.
|
||||
#
|
||||
# - **0** => Disabled
|
||||
# - 1 => Enabled
|
||||
POSTFIX_REJECT_UNKNOWN_CLIENT_HOSTNAME=0
|
||||
|
||||
# Choose TCP/IP protocols for postfix to use
|
||||
# **all** => All possible protocols.
|
||||
# ipv4 => Use only IPv4 traffic. Most likely you want this behind Docker.
|
||||
|
@ -290,6 +365,12 @@ LOGROTATE_INTERVAL=weekly
|
|||
# Note: More details at http://www.postfix.org/postconf.5.html#inet_protocols
|
||||
POSTFIX_INET_PROTOCOLS=all
|
||||
|
||||
# Enables MTA-STS support for outbound mail.
|
||||
# More details: https://docker-mailserver.github.io/docker-mailserver/v13.3/config/best-practices/mta-sts/
|
||||
# - **0** ==> MTA-STS disabled
|
||||
# - 1 => MTA-STS enabled
|
||||
ENABLE_MTA_STS=0
|
||||
|
||||
# Choose TCP/IP protocols for dovecot to use
|
||||
# **all** => Listen on all interfaces
|
||||
# ipv4 => Listen only on IPv4 interfaces. Most likely you want this behind Docker.
|
||||
|
@ -304,9 +385,6 @@ DOVECOT_INET_PROTOCOLS=all
|
|||
|
||||
ENABLE_SPAMASSASSIN=0
|
||||
|
||||
# deliver spam messages in the inbox (eventually tagged using SA_SPAM_SUBJECT)
|
||||
SPAMASSASSIN_SPAM_TO_INBOX=1
|
||||
|
||||
# KAM is a 3rd party SpamAssassin ruleset, provided by the McGrail Foundation.
|
||||
# If SpamAssassin is enabled, KAM can be used in addition to the default ruleset.
|
||||
# - **0** => KAM disabled
|
||||
|
@ -315,21 +393,24 @@ SPAMASSASSIN_SPAM_TO_INBOX=1
|
|||
# Note: only has an effect if `ENABLE_SPAMASSASSIN=1`
|
||||
ENABLE_SPAMASSASSIN_KAM=0
|
||||
|
||||
# deliver spam messages to the inbox (tagged using SPAM_SUBJECT)
|
||||
SPAMASSASSIN_SPAM_TO_INBOX=1
|
||||
|
||||
# spam messages will be moved in the Junk folder (SPAMASSASSIN_SPAM_TO_INBOX=1 required)
|
||||
MOVE_SPAM_TO_JUNK=1
|
||||
|
||||
# add spam info headers if at, or above that level:
|
||||
# spam messages will be marked as read
|
||||
MARK_SPAM_AS_READ=0
|
||||
|
||||
# add 'spam info' headers at, or above this level
|
||||
SA_TAG=2.0
|
||||
|
||||
# add 'spam detected' headers at that level
|
||||
# add 'spam detected' headers at, or above this level
|
||||
SA_TAG2=6.31
|
||||
|
||||
# triggers spam evasive actions
|
||||
SA_KILL=10.0
|
||||
|
||||
# add tag to subject if spam detected
|
||||
SA_SPAM_SUBJECT=***SPAM*****
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- Fetchmail Section -------------------------
|
||||
# -----------------------------------------------
|
||||
|
@ -338,25 +419,45 @@ ENABLE_FETCHMAIL=0
|
|||
|
||||
# The interval to fetch mail in seconds
|
||||
FETCHMAIL_POLL=300
|
||||
# Use multiple fetchmail instances (1 per poll entry in fetchmail.cf)
|
||||
# Supports multiple IMAP IDLE connections when a server is used across multiple poll entries
|
||||
# https://otremba.net/wiki/Fetchmail_(Debian)#Immediate_Download_via_IMAP_IDLE
|
||||
FETCHMAIL_PARALLEL=0
|
||||
|
||||
# Enable or disable `getmail`.
|
||||
#
|
||||
# - **0** => Disabled
|
||||
# - 1 => Enabled
|
||||
ENABLE_GETMAIL=0
|
||||
|
||||
# The number of minutes for the interval. Min: 1; Default: 5.
|
||||
GETMAIL_POLL=5
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- OAUTH2 Section ----------------------------
|
||||
# -----------------------------------------------
|
||||
|
||||
# empty => OAUTH2 authentication is disabled
|
||||
# 1 => OAUTH2 authentication is enabled
|
||||
ENABLE_OAUTH2=
|
||||
|
||||
# Specify the user info endpoint URL of the oauth2 provider
|
||||
# Example: https://oauth2.example.com/userinfo/
|
||||
OAUTH2_INTROSPECTION_URL=
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- LDAP Section ------------------------------
|
||||
# -----------------------------------------------
|
||||
|
||||
# A second container for the ldap service is necessary (i.e. https://github.com/osixia/docker-openldap)
|
||||
|
||||
# with the :edge tag, use ACCOUNT_PROVISIONER=LDAP
|
||||
# empty => LDAP authentification is disabled
|
||||
# 1 => LDAP authentification is enabled
|
||||
ENABLE_LDAP=
|
||||
# A second container for the ldap service is necessary (i.e. https://hub.docker.com/r/bitnami/openldap/)
|
||||
|
||||
# empty => no
|
||||
# yes => LDAP over TLS enabled for Postfix
|
||||
LDAP_START_TLS=
|
||||
|
||||
# If you going to use the mailserver in combination with docker-compose you can set the service name here
|
||||
# empty => mail.domain.com
|
||||
# Specify the dns-name/ip-address where the ldap-server
|
||||
# empty => mail.example.com
|
||||
# Specify the `<dns-name>` / `<ip-address>` where the LDAP server is reachable via a URI like: `ldaps://mail.example.com`.
|
||||
# Note: You must include the desired URI scheme (`ldap://`, `ldaps://`, `ldapi://`).
|
||||
LDAP_SERVER_HOST=
|
||||
|
||||
# empty => ou=people,dc=domain,dc=com
|
||||
|
@ -407,7 +508,7 @@ DOVECOT_MAILBOX_FORMAT=maildir
|
|||
|
||||
# empty => no
|
||||
# yes => Allow bind authentication for LDAP
|
||||
# https://wiki.dovecot.org/AuthDatabase/LDAP/AuthBinds
|
||||
# https://doc.dovecot.org/2.4.0/core/config/auth/databases/ldap.html#authentication-bind
|
||||
DOVECOT_AUTH_BIND=
|
||||
|
||||
# -----------------------------------------------
|
||||
|
@ -443,11 +544,11 @@ SASLAUTHD_MECHANISMS=
|
|||
SASLAUTHD_MECH_OPTIONS=
|
||||
|
||||
# empty => Use value of LDAP_SERVER_HOST
|
||||
# Note: since version 10.0.0, you can specify a protocol here (like ldaps://); this deprecates SASLAUTHD_LDAP_SSL.
|
||||
# Note: You must include the desired URI scheme (`ldap://`, `ldaps://`, `ldapi://`).
|
||||
SASLAUTHD_LDAP_SERVER=
|
||||
|
||||
# empty => Use value of LDAP_BIND_DN
|
||||
# specify an object with priviliges to search the directory tree
|
||||
# specify an object with privileges to search the directory tree
|
||||
# e.g. active directory: SASLAUTHD_LDAP_BIND_DN=cn=Administrator,cn=Users,dc=mydomain,dc=net
|
||||
# e.g. openldap: SASLAUTHD_LDAP_BIND_DN=cn=admin,dc=mydomain,dc=net
|
||||
SASLAUTHD_LDAP_BIND_DN=
|
||||
|
@ -528,8 +629,8 @@ SRS_SECRET=
|
|||
|
||||
# Setup relaying all mail through a default relay host
|
||||
#
|
||||
# empty => don't configure default relay host
|
||||
# default host and optional port to relay all mail through
|
||||
# Set a default host to relay all mail through (optionally include a port)
|
||||
# Example: [mail.example.com]:587
|
||||
DEFAULT_RELAY_HOST=
|
||||
|
||||
# -----------------------------------------------
|
||||
|
@ -539,18 +640,22 @@ DEFAULT_RELAY_HOST=
|
|||
# Setup relaying for multiple domains based on the domain name of the sender
|
||||
# optionally uses usernames and passwords in postfix-sasl-password.cf and relay host mappings in postfix-relaymap.cf
|
||||
#
|
||||
# empty => don't configure relay host
|
||||
# default host to relay mail through
|
||||
# Set a default host to relay mail through
|
||||
# Example: mail.example.com
|
||||
RELAY_HOST=
|
||||
|
||||
# empty => 25
|
||||
# default port to relay mail
|
||||
RELAY_PORT=25
|
||||
|
||||
# -----------------------------------------------
|
||||
# --- Relay Host Credentials Section ------------
|
||||
# -----------------------------------------------
|
||||
|
||||
# Configure a relay user and password to use with RELAY_HOST / DEFAULT_RELAY_HOST
|
||||
|
||||
# empty => no default
|
||||
# default relay username (if no specific entry exists in postfix-sasl-password.cf)
|
||||
RELAY_USER=
|
||||
|
||||
# empty => no default
|
||||
# password for default relay user
|
||||
RELAY_PASSWORD=
|
||||
|
|
68
setup.sh
68
setup.sh
|
@ -12,7 +12,7 @@ DESIRED_CONFIG_PATH=
|
|||
DIR=$(pwd)
|
||||
DMS_CONFIG='/tmp/docker-mailserver'
|
||||
IMAGE_NAME=
|
||||
DEFAULT_IMAGE_NAME='docker.io/mailserver/docker-mailserver:latest'
|
||||
DEFAULT_IMAGE_NAME='ghcr.io/docker-mailserver/docker-mailserver:latest'
|
||||
INFO=
|
||||
PODMAN_ROOTLESS=false
|
||||
USE_SELINUX=
|
||||
|
@ -27,8 +27,7 @@ RESET=$(echo -ne '\e[0m')
|
|||
set -euEo pipefail
|
||||
shopt -s inherit_errexit 2>/dev/null || true
|
||||
|
||||
function _show_local_usage
|
||||
{
|
||||
function _show_local_usage() {
|
||||
# shellcheck disable=SC2059
|
||||
printf '%s' "${ORANGE}OPTIONS${RESET}
|
||||
${LBLUE}Config path, container or image adjustments${RESET}
|
||||
|
@ -69,22 +68,17 @@ function _show_local_usage
|
|||
"
|
||||
}
|
||||
|
||||
function _get_absolute_script_directory
|
||||
{
|
||||
if dirname "$(readlink -f "${0}")" &>/dev/null
|
||||
then
|
||||
function _get_absolute_script_directory() {
|
||||
if dirname "$(readlink -f "${0}")" &>/dev/null; then
|
||||
DIR=$(dirname "$(readlink -f "${0}")")
|
||||
elif realpath -e -L "${0}" &>/dev/null
|
||||
then
|
||||
elif realpath -e -L "${0}" &>/dev/null; then
|
||||
DIR=$(realpath -e -L "${0}")
|
||||
DIR="${DIR%/setup.sh}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _set_default_config_path
|
||||
{
|
||||
if [[ -d "${DIR}/config" ]]
|
||||
then
|
||||
function _set_default_config_path() {
|
||||
if [[ -d "${DIR}/config" ]]; then
|
||||
# legacy path (pre v10.2.0)
|
||||
DEFAULT_CONFIG_PATH="${DIR}/config"
|
||||
else
|
||||
|
@ -92,25 +86,20 @@ function _set_default_config_path
|
|||
fi
|
||||
}
|
||||
|
||||
function _handle_config_path
|
||||
{
|
||||
if [[ -z ${DESIRED_CONFIG_PATH} ]]
|
||||
then
|
||||
function _handle_config_path() {
|
||||
if [[ -z ${DESIRED_CONFIG_PATH} ]]; then
|
||||
# no desired config path
|
||||
if [[ -n ${CONTAINER_NAME} ]]
|
||||
then
|
||||
if [[ -n ${CONTAINER_NAME} ]]; then
|
||||
VOLUME=$(${CRI} inspect "${CONTAINER_NAME}" \
|
||||
--format="{{range .Mounts}}{{ println .Source .Destination}}{{end}}" | \
|
||||
grep "${DMS_CONFIG}$" 2>/dev/null || :)
|
||||
fi
|
||||
|
||||
if [[ -n ${VOLUME} ]]
|
||||
then
|
||||
if [[ -n ${VOLUME} ]]; then
|
||||
CONFIG_PATH=$(echo "${VOLUME}" | awk '{print $1}')
|
||||
fi
|
||||
|
||||
if [[ -z ${CONFIG_PATH} ]]
|
||||
then
|
||||
if [[ -z ${CONFIG_PATH} ]]; then
|
||||
CONFIG_PATH=${DEFAULT_CONFIG_PATH}
|
||||
fi
|
||||
else
|
||||
|
@ -118,11 +107,9 @@ function _handle_config_path
|
|||
fi
|
||||
}
|
||||
|
||||
function _run_in_new_container
|
||||
{
|
||||
function _run_in_new_container() {
|
||||
# start temporary container with specified image
|
||||
if ! ${CRI} history -q "${IMAGE_NAME}" &>/dev/null
|
||||
then
|
||||
if ! ${CRI} history -q "${IMAGE_NAME}" &>/dev/null; then
|
||||
echo "Image '${IMAGE_NAME}' not found. Pulling ..."
|
||||
${CRI} pull "${IMAGE_NAME}"
|
||||
fi
|
||||
|
@ -132,14 +119,12 @@ function _run_in_new_container
|
|||
"${IMAGE_NAME}" "${@}"
|
||||
}
|
||||
|
||||
function _main
|
||||
{
|
||||
function _main() {
|
||||
_get_absolute_script_directory
|
||||
_set_default_config_path
|
||||
|
||||
local OPTIND
|
||||
while getopts ":c:i:p:zZR" OPT
|
||||
do
|
||||
while getopts ":c:i:p:zZR" OPT; do
|
||||
case ${OPT} in
|
||||
( i ) IMAGE_NAME="${OPTARG}" ;;
|
||||
( z | Z ) USE_SELINUX=":${OPT}" ;;
|
||||
|
@ -151,8 +136,7 @@ function _main
|
|||
( * ) DESIRED_CONFIG_PATH="${DIR}/${OPTARG}" ;;
|
||||
esac
|
||||
|
||||
if [[ ! -d ${DESIRED_CONFIG_PATH} ]]
|
||||
then
|
||||
if [[ ! -d ${DESIRED_CONFIG_PATH} ]]; then
|
||||
echo "Specified directory '${DESIRED_CONFIG_PATH}' doesn't exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
@ -169,14 +153,11 @@ function _main
|
|||
done
|
||||
shift $(( OPTIND - 1 ))
|
||||
|
||||
if command -v docker &>/dev/null
|
||||
then
|
||||
if command -v docker &>/dev/null; then
|
||||
CRI=docker
|
||||
elif command -v podman &>/dev/null
|
||||
then
|
||||
elif command -v podman &>/dev/null; then
|
||||
CRI=podman
|
||||
if ! ${PODMAN_ROOTLESS} && [[ ${EUID} -ne 0 ]]
|
||||
then
|
||||
if ! ${PODMAN_ROOTLESS} && [[ ${EUID} -ne 0 ]]; then
|
||||
read -r -p "You are running Podman in rootless mode. Continue? [Y/n] "
|
||||
[[ -n ${REPLY} ]] && [[ ${REPLY} =~ (n|N) ]] && exit 0
|
||||
fi
|
||||
|
@ -190,13 +171,11 @@ function _main
|
|||
|
||||
[[ -z ${CONTAINER_NAME} ]] && CONTAINER_NAME=${INFO#*;}
|
||||
[[ -z ${IMAGE_NAME} ]] && IMAGE_NAME=${INFO%;*}
|
||||
if [[ -z ${IMAGE_NAME} ]]
|
||||
then
|
||||
if [[ -z ${IMAGE_NAME} ]]; then
|
||||
IMAGE_NAME=${NAME:-${DEFAULT_IMAGE_NAME}}
|
||||
fi
|
||||
|
||||
if test -t 0
|
||||
then
|
||||
if test -t 0; then
|
||||
USE_TTY="-it"
|
||||
else
|
||||
# GitHub Actions will fail (or really anything else
|
||||
|
@ -207,8 +186,7 @@ function _main
|
|||
|
||||
_handle_config_path
|
||||
|
||||
if [[ -n ${CONTAINER_NAME} ]]
|
||||
then
|
||||
if [[ -n ${CONTAINER_NAME} ]]; then
|
||||
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" setup "${@}"
|
||||
else
|
||||
_run_in_new_container setup "${@}"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use strict;
|
||||
|
||||
@local_domains_maps = (
|
||||
read_hash('/etc/postfix/vhost')
|
||||
read_hash('/etc/postfix/vhost')
|
||||
);
|
||||
|
||||
1; # ensure a defined return
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
# shellcheck source=../scripts/helpers/index.sh
|
||||
source /usr/local/bin/helpers/index.sh
|
||||
|
||||
function _main
|
||||
{
|
||||
function _main() {
|
||||
_require_n_parameters_or_print_usage 2 "${@}"
|
||||
|
||||
local MAIL_ALIAS="${1}"
|
||||
|
@ -14,8 +13,7 @@ function _main
|
|||
|| _exit_with_error "'${MAIL_ALIAS}' is already an alias for recipient: '${RECIPIENT}'"
|
||||
}
|
||||
|
||||
function __usage
|
||||
{
|
||||
function __usage() {
|
||||
printf '%s' "${PURPLE}addalias${RED}(${YELLOW}8${RED})
|
||||
|
||||
${ORANGE}USAGE${RESET}
|
||||
|
@ -35,6 +33,9 @@ ${ORANGE}EXAMPLES${RESET}
|
|||
${LWHITE}./setup.sh alias add alias@example.com recipient@example.com${RESET}
|
||||
Add the alias 'alias@example.com' for the mail account 'recipient@example.com'.
|
||||
|
||||
${LWHITE}./setup.sh alias add alias@example.com 'recipient@example.com, another-recipient@example.com'${RESET}
|
||||
Multiple recipients are separated by comma.
|
||||
|
||||
${ORANGE}EXIT STATUS${RESET}
|
||||
Exit status is 0 if command was successful. If wrong arguments are provided
|
||||
or arguments contain errors, the script will exit early with exit status 1.
|
||||
|
|
|
@ -3,19 +3,16 @@
|
|||
# shellcheck source=../scripts/helpers/index.sh
|
||||
source /usr/local/bin/helpers/index.sh
|
||||
|
||||
function _main
|
||||
{
|
||||
function _main() {
|
||||
_require_n_parameters_or_print_usage 1 "${@}"
|
||||
|
||||
local MAIL_ACCOUNT="${1}"
|
||||
shift
|
||||
local PASSWD="${*}"
|
||||
local PASSWD="${2}"
|
||||
|
||||
_manage_accounts_dovecotmaster_create "${MAIL_ACCOUNT}" "${PASSWD}"
|
||||
}
|
||||
|
||||
function __usage
|
||||
{
|
||||
function __usage() {
|
||||
printf '%s' "${PURPLE}adddovecotmasteruser${RED}(${YELLOW}8${RED})
|
||||
|
||||
${ORANGE}USAGE${RESET}
|
||||
|
|
|
@ -3,13 +3,11 @@
|
|||
# shellcheck source=../scripts/helpers/index.sh
|
||||
source /usr/local/bin/helpers/index.sh
|
||||
|
||||
function _main
|
||||
{
|
||||
function _main() {
|
||||
_require_n_parameters_or_print_usage 1 "${@}"
|
||||
|
||||
local MAIL_ACCOUNT="${1}"
|
||||
shift
|
||||
local PASSWD="${*}"
|
||||
local PASSWD="${2}"
|
||||
|
||||
_manage_accounts_create "${MAIL_ACCOUNT}" "${PASSWD}"
|
||||
|
||||
|
@ -18,8 +16,7 @@ function _main
|
|||
# where the actual account is created in Dovecot. Expect a delay.
|
||||
}
|
||||
|
||||
function __usage
|
||||
{
|
||||
function __usage() {
|
||||
printf '%s' "${PURPLE}addmailuser${RED}(${YELLOW}8${RED})
|
||||
|
||||
${ORANGE}USAGE${RESET}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue