Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Perform renewal tasks at regular intervals Console domain certificates do not include mail

lotk3b4c7108d74c
diff --git a/core/internal/service/domains/ssl.go b/core/internal/service/domains/ssl.go
index 63a30854..81a3bbaf 100644
--- a/core/internal/service/domains/ssl.go
+++ b/core/internal/service/domains/ssl.go
@@ -215,10 +215,10 @@ func ApplyConsoleCert(ctx context.Context) error {
if hostname == "" {
return gerror.New("BILLIONMAIL_HOSTNAME environment variable is not set")
}
- mailDomain := public.FormatMX(hostname)
+ //mailDomain := public.FormatMX(hostname)
// Check for the existence of a certificate
- sql := fmt.Sprintf("dns::jsonb ? '%s' AND status = 1 AND endtime > %d", mailDomain, time.Now().Unix())
+ sql := fmt.Sprintf("dns::jsonb ? '%s' AND status = 1 AND endtime > %d", hostname, time.Now().Unix())
crt := &entity.Letsencrypt{}
err = g.DB().Model("letsencrypts").
Where(sql).
@@ -276,7 +276,7 @@ func ApplyConsoleCert(ctx context.Context) error {
notBefore = certInfo.NotBefore
subject = certInfo.Subject
endTime = certInfo.Endtime
- dnsNamesBytes, err := json.Marshal([]string{mailDomain, hostname})
+ dnsNamesBytes, err := json.Marshal([]string{hostname})
if err == nil {
dnsNames = string(dnsNamesBytes)
}
diff --git a/core/internal/service/timers/timers.go b/core/internal/service/timers/timers.go
index 88c59503..6dbcf400 100644
--- a/core/internal/service/timers/timers.go
+++ b/core/internal/service/timers/timers.go
@@ -103,6 +103,10 @@ func Start(ctx context.Context) (err error) {
relay.UpdateRelayStatus(ctx)
})
+ gtimer.Add(24*time.Hour, func() {
+ domains.AutoRenewSSL(ctx)
+ })
+
g.Log().Debug(ctx, "All timers started successfully")
return nil
}