mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 13:04:38 +03:00
make it possible to serve https on a different port than 443 through configuration
so you can run mox on openbsd with port redirects in pf.conf. in the future, starting as root, binding the sockets, and passing the bound sockets to a new unprivileged process should be implemented, but this should get openbsd users going. from discussion with mteege
This commit is contained in:
10
http/web.go
10
http/web.go
@ -55,12 +55,12 @@ func ListenAndServe() {
|
||||
s = serve{nil, nil, &http.ServeMux{}}
|
||||
}
|
||||
s.kinds = append(s.kinds, kind)
|
||||
if https && port == 443 && l.TLS.ACME != "" {
|
||||
if https && l.TLS.ACME != "" {
|
||||
s.tlsConfig = l.TLS.ACMEConfig
|
||||
} else if https {
|
||||
s.tlsConfig = l.TLS.Config
|
||||
if l.TLS.ACME != "" {
|
||||
ensureServe(true, 443, "acme-tls-alpn-01")
|
||||
ensureServe(true, config.Port(mox.Conf.Static.ACME[l.TLS.ACME].Port, 443), "acme-tls-alpn-01")
|
||||
}
|
||||
}
|
||||
portServe[port] = s
|
||||
@ -68,7 +68,7 @@ func ListenAndServe() {
|
||||
}
|
||||
|
||||
if l.SMTP.Enabled && !l.SMTP.NoSTARTTLS || l.Submissions.Enabled || l.IMAPS.Enabled {
|
||||
ensureServe(true, 443, "acme-tls-alpn01")
|
||||
ensureServe(true, config.Port(config.Port(l.AutoconfigHTTPS.Port, 443), 443), "acme-tls-alpn01")
|
||||
}
|
||||
|
||||
if l.AccountHTTP.Enabled {
|
||||
@ -110,12 +110,12 @@ func ListenAndServe() {
|
||||
}))
|
||||
}
|
||||
if l.AutoconfigHTTPS.Enabled {
|
||||
srv := ensureServe(true, 443, "autoconfig-https")
|
||||
srv := ensureServe(true, config.Port(l.AutoconfigHTTPS.Port, 443), "autoconfig-https")
|
||||
srv.mux.HandleFunc("/mail/config-v1.1.xml", safeHeaders(autoconfHandle(l)))
|
||||
srv.mux.HandleFunc("/autodiscover/autodiscover.xml", safeHeaders(autodiscoverHandle(l)))
|
||||
}
|
||||
if l.MTASTSHTTPS.Enabled {
|
||||
srv := ensureServe(true, 443, "mtasts-https")
|
||||
srv := ensureServe(true, config.Port(l.MTASTSHTTPS.Port, 443), "mtasts-https")
|
||||
srv.mux.HandleFunc("/.well-known/mta-sts.txt", safeHeaders(mtastsPolicyHandle))
|
||||
}
|
||||
if l.PprofHTTP.Enabled {
|
||||
|
Reference in New Issue
Block a user