This commit is contained in:
1 parent
7ffb1e751d
commit
369f502c10
20 files changed
+599
-56
No files matched your search
@@ -31,6 +31,7 @@ type PublicIssue struct {
|
||||
|
||||
type ConfigStatus struct {
|
||||
SetupState SetupState `json:"setupState"`
|
||||
TLSMode string `json:"tlsMode"`
|
||||
ActiveGeneration uint64 `json:"activeGeneration"`
|
||||
LastValidAt *time.Time `json:"lastValidAt,omitempty"`
|
||||
PendingRestart []ServiceName `json:"pendingRestart,omitempty"`
|
||||
@@ -248,6 +249,7 @@ func (m *ConfigManager) Status() ConfigStatus {
|
||||
m.mu.RLock()
|
||||
defer m.mu.RUnlock()
|
||||
status := m.status
|
||||
status.TLSMode = m.current.Root.HTTP.TLSMode
|
||||
status.PendingRestart = append([]ServiceName(nil), status.PendingRestart...)
|
||||
status.DegradedReasons = append([]PublicIssue(nil), status.DegradedReasons...)
|
||||
if status.LastValidAt != nil {
|
||||
|
||||
@@ -145,7 +145,8 @@ func sameSSLPolicy(left, right *Config) bool {
|
||||
return reflect.DeepEqual(left.SSL, right.SSL) && left.SSLType == right.SSLType &&
|
||||
left.SSLPrivateKeyPath == right.SSLPrivateKeyPath && left.SSLPublicKeyPath == right.SSLPublicKeyPath &&
|
||||
left.Domain == right.Domain && left.WebDomain == right.WebDomain &&
|
||||
reflect.DeepEqual(left.Domains, right.Domains) && left.HttpsEnabled == right.HttpsEnabled
|
||||
reflect.DeepEqual(left.Domains, right.Domains) && left.HttpsEnabled == right.HttpsEnabled &&
|
||||
left.TLSMode == right.TLSMode
|
||||
}
|
||||
|
||||
func mergeServices(previous, next []ServiceName) []ServiceName {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package config
|
||||
|
||||
import "strings"
|
||||
|
||||
// UsesProxyHTTPS 表示网页 HTTPS 由反向代理终止,不代表邮件协议可以关闭 TLS。
|
||||
func (c *Config) UsesProxyHTTPS() bool {
|
||||
return c != nil && strings.EqualFold(strings.TrimSpace(c.TLSMode), HTTPSTLSModeProxy)
|
||||
}
|
||||
|
||||
// AutomaticSSLEnabled 保留原证书策略,但反代模式下禁止 Smail 自动签发和续期。
|
||||
func (c *Config) AutomaticSSLEnabled() bool {
|
||||
return c != nil && !c.UsesProxyHTTPS() && (c.SSLType == SSLTypeAutoHTTP || c.SSLType == SSLTypeAutoDNS)
|
||||
}
|
||||
Reference in new issue
Block a user