add option to handle autoconfig and mta-sts requests without TLS, for when it is reverse proxied

for #5 with hints from belst & idnovic
This commit is contained in:
Mechiel Lukkien
2023-02-25 11:28:15 +01:00
parent ac3a3e496e
commit 0ede7f78c1
5 changed files with 28 additions and 10 deletions

View File

@ -135,11 +135,13 @@ type Listener struct {
} `sconf:"optional" sconf-doc:"Serve /debug/pprof/ for profiling a running mox instance. Do not enable this on a public IP!"`
AutoconfigHTTPS struct {
Enabled bool
Port int `sconf:"optional" sconf-doc:"TLS port, 443 by default. You should only override this if you cannot listen on port 443 directly. Autoconfig requests will be made to port 443, so you'll have to add an external mechanism to get the connection here, e.g. by configuring port forwarding."`
Port int `sconf:"optional" sconf-doc:"TLS port, 443 by default. You should only override this if you cannot listen on port 443 directly. Autoconfig requests will be made to port 443, so you'll have to add an external mechanism to get the connection here, e.g. by configuring port forwarding."`
NonTLS bool `sconf:"optional" sconf-doc:"If set, plain HTTP instead of HTTPS is spoken on the configured port. Can be useful when the autoconfig domain is reverse proxied."`
} `sconf:"optional" sconf-doc:"Serve autoconfiguration/autodiscovery to simplify configuring email applications, will use port 443. Requires a TLS config."`
MTASTSHTTPS struct {
Enabled bool
Port int `sconf:"optional" sconf-doc:"TLS port, 443 by default. You should only override this if you cannot listen on port 443 directly. MTA-STS requests will be made to port 443, so you'll have to add an external mechanism to get the connection here, e.g. by configuring port forwarding."`
Port int `sconf:"optional" sconf-doc:"TLS port, 443 by default. You should only override this if you cannot listen on port 443 directly. MTA-STS requests will be made to port 443, so you'll have to add an external mechanism to get the connection here, e.g. by configuring port forwarding."`
NonTLS bool `sconf:"optional" sconf-doc:"If set, plain HTTP instead of HTTPS is spoken on the configured port. Can be useful when the mta-sts domain is reverse proxied."`
} `sconf:"optional" sconf-doc:"Serve MTA-STS policies describing SMTP TLS requirements. Requires a TLS config."`
}

View File

@ -240,6 +240,10 @@ describe-static" and "mox config describe-domains":
# port forwarding. (optional)
Port: 0
# If set, plain HTTP instead of HTTPS is spoken on the configured port. Can be
# useful when the autoconfig domain is reverse proxied. (optional)
NonTLS: false
# Serve MTA-STS policies describing SMTP TLS requirements. Requires a TLS config.
# (optional)
MTASTSHTTPS:
@ -251,6 +255,10 @@ describe-static" and "mox config describe-domains":
# forwarding. (optional)
Port: 0
# If set, plain HTTP instead of HTTPS is spoken on the configured port. Can be
# useful when the mta-sts domain is reverse proxied. (optional)
NonTLS: false
# Destination for emails delivered to postmaster address.
Postmaster:
Account: