Add ACME profile support for IP address certificates
This commit is contained in:
@@ -69,10 +69,21 @@ func startACME(ctx context.Context, logger logger.Logger, options option.Inbound
|
||||
Storage: storage,
|
||||
Logger: zapLogger,
|
||||
}
|
||||
profile := options.Profile
|
||||
if profile == "" && acmeServer == certmagic.LetsEncryptProductionCA {
|
||||
for _, domain := range options.Domain {
|
||||
if certmagic.SubjectIsIP(domain) {
|
||||
profile = "shortlived"
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
acmeConfig := certmagic.ACMEIssuer{
|
||||
CA: acmeServer,
|
||||
Email: options.Email,
|
||||
Agreed: true,
|
||||
Profile: profile,
|
||||
DisableHTTPChallenge: options.DisableHTTPChallenge,
|
||||
DisableTLSALPNChallenge: options.DisableTLSALPNChallenge,
|
||||
AltHTTPPort: int(options.AlternativeHTTPPort),
|
||||
|
||||
@@ -24,6 +24,7 @@ type ACMECertificateProviderOptions struct {
|
||||
ExternalAccount *ACMEExternalAccountOptions `json:"external_account,omitempty"`
|
||||
DNS01Challenge *ACMEProviderDNS01ChallengeOptions `json:"dns01_challenge,omitempty"`
|
||||
KeyType ACMEKeyType `json:"key_type,omitempty"`
|
||||
Profile string `json:"profile,omitempty"`
|
||||
HTTPClient *HTTPClientOptions `json:"http_client,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ type InboundACMEOptions struct {
|
||||
AlternativeTLSPort uint16 `json:"alternative_tls_port,omitempty"`
|
||||
ExternalAccount *ACMEExternalAccountOptions `json:"external_account,omitempty"`
|
||||
DNS01Challenge *ACMEDNS01ChallengeOptions `json:"dns01_challenge,omitempty"`
|
||||
Profile string `json:"profile,omitempty"`
|
||||
}
|
||||
|
||||
type ACMEExternalAccountOptions struct {
|
||||
|
||||
@@ -112,11 +112,22 @@ func NewCertificateProvider(ctx context.Context, logger log.ContextLogger, tag s
|
||||
config.KeySource = certmagic.StandardKeyGenerator{KeyType: keyType}
|
||||
}
|
||||
|
||||
profile := options.Profile
|
||||
if profile == "" && acmeServer == certmagic.LetsEncryptProductionCA {
|
||||
for _, domain := range options.Domain {
|
||||
if certmagic.SubjectIsIP(domain) {
|
||||
profile = "shortlived"
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
acmeIssuer := certmagic.ACMEIssuer{
|
||||
CA: acmeServer,
|
||||
Email: options.Email,
|
||||
AccountKeyPEM: options.AccountKey,
|
||||
Agreed: true,
|
||||
Profile: profile,
|
||||
DisableHTTPChallenge: options.DisableHTTPChallenge,
|
||||
DisableTLSALPNChallenge: options.DisableTLSALPNChallenge,
|
||||
AltHTTPPort: int(options.AlternativeHTTPPort),
|
||||
|
||||
Reference in New Issue
Block a user