shared/tls: Add EAB support to RunACMEChallenge

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
This commit is contained in:
Stéphane Graber 2026-07-27 16:26:33 -04:00
parent e6a84950a3
commit 3caced2ae5
No known key found for this signature in database
GPG Key ID: C638974D64792D67

View File

@ -33,9 +33,16 @@ func CertificateNeedsUpdate(domain string, cert *x509.Certificate, threshold tim
}
// RunACMEChallenge runs an ACME challenge to fetch updated certificates with `lego`.
func RunACMEChallenge(ctx context.Context, dir, caURL, domain, email, challengeType, provider, port, proxy string, resolvers, environment []string) ([]byte, []byte, error) {
func RunACMEChallenge(ctx context.Context, dir, caURL, domain, email, challengeType, provider, port, proxy, eabKid, eabHmac string, resolvers, environment []string) ([]byte, []byte, error) {
env := os.Environ()
// Pass External Account Binding details through environment variables as
// those are handled identically by both lego v4 and v5 and keep the HMAC
// key off the command line.
if eabKid != "" && eabHmac != "" {
env = append(env, "LEGO_EAB=true", "LEGO_EAB_KID="+eabKid, "LEGO_EAB_HMAC="+eabHmac)
}
// Detect the installed lego command line interface as it changed in lego v5.
//
// Lego v5 broke its CLI backward compatibility by moving some flags