about summary refs log tree commit diff stats
path: root/internal/server/tls.go
diff options
context:
space:
mode:
authorAlan Pearce2024-11-27 15:06:04 +0100
committerAlan Pearce2024-11-27 15:06:04 +0100
commit8ecb3549518646e39ec7df0079ae6cad3384271a (patch)
tree18ca08745b6d87b2ecf897667ea53ff4eda6b49d /internal/server/tls.go
parent72018b5585e945aa51a3a557a641cce17cabaf26 (diff)
downloadwebsite-8ecb3549518646e39ec7df0079ae6cad3384271a.tar.lz
website-8ecb3549518646e39ec7df0079ae6cad3384271a.tar.zst
website-8ecb3549518646e39ec7df0079ae6cad3384271a.zip
Use PowerDNS API instead of acme-dns (buggy)
Diffstat (limited to 'internal/server/tls.go')
-rw-r--r--internal/server/tls.go19
1 files changed, 5 insertions, 14 deletions
diff --git a/internal/server/tls.go b/internal/server/tls.go
index 9f22a5e..1c1073e 100644
--- a/internal/server/tls.go
+++ b/internal/server/tls.go
@@ -13,7 +13,7 @@ import (
 	"github.com/ardanlabs/conf/v3"
 	"github.com/caddyserver/caddy/v2"
 	"github.com/caddyserver/certmagic"
-	"github.com/libdns/acmedns"
+	"github.com/libdns/powerdns"
 	certmagic_redis "github.com/pberkel/caddy-storage-redis"
 	"gitlab.com/tozd/go/errors"
 )
@@ -26,13 +26,6 @@ type redisConfig struct {
 	KeyPrefix     string `conf:"default:certmagic"`
 }
 
-type acmeConfig struct {
-	Username  string `conf:"required"`
-	Password  string `conf:"required"`
-	Subdomain string `conf:"required"`
-	ServerURL string `conf:"env:SERVER_URL,default:https://acme.alanpearce.eu"`
-}
-
 func (s *Server) serveTLS() (err error) {
 	log := s.log.Named("tls")
 
@@ -81,10 +74,10 @@ func (s *Server) serveTLS() (err error) {
 			return errors.Wrap(err, "could not parse redis config")
 		}
 
-		acme := &acmedns.Provider{}
-		_, err = conf.Parse("ACME", acme)
+		pdns := &powerdns.Provider{}
+		_, err = conf.Parse("POWERDNS", pdns)
 		if err != nil {
-			return errors.Wrap(err, "could not parse ACME config")
+			return errors.Wrap(err, "could not parse PowerDNS ACME config")
 		}
 
 		issuer = certmagic.NewACMEIssuer(cfg, certmagic.ACMEIssuer{
@@ -94,7 +87,7 @@ func (s *Server) serveTLS() (err error) {
 			Logger: certmagic.Default.Logger,
 			DNS01Solver: &certmagic.DNS01Solver{
 				DNSManager: certmagic.DNSManager{
-					DNSProvider: acme,
+					DNSProvider: pdns,
 					Logger:      certmagic.Default.Logger,
 				},
 			},
@@ -102,8 +95,6 @@ func (s *Server) serveTLS() (err error) {
 
 		certificateDomains = append(slices.Clone(s.config.Domains), wildcardDomain)
 
-		log.Info("acme", "username", acme.Username, "subdomain", acme.Subdomain, "server_url", acme.ServerURL)
-
 		rs := certmagic_redis.New()
 		rs.Address = []string{rc.Address}
 		rs.Username = rc.Username