Skip to content

Commit 5201271

Browse files
committed
add proxy support in acme providers
add dns resolver support in acme providers
1 parent 2c7149f commit 5201271

File tree

3 files changed

+59
-27
lines changed

3 files changed

+59
-27
lines changed

command/ca/provisioner/add.go

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ACME
4444
4545
**step ca provisioner add** <name> **--type**=ACME
4646
[**--force-cn**] [**--require-eab**] [**--challenge**=<challenge>]
47+
[**--acme-proxy-url**=<url>] [**--acme-disable-proxy**] [**--acme-dns-resolver**=<host:port>]
4748
[**--attestation-format**=<format>] [**--attestation-roots**=<file>]
4849
[**--admin-cert**=<file>] [**--admin-key**=<file>]
4950
[**--admin-subject**=<subject>] [**--admin-provisioner**=<name>] [**--admin-password-file**=<file>]
@@ -145,12 +146,15 @@ SCEP
145146
// Nebula provisioner flags
146147
nebulaRootFlag,
147148

148-
// ACME provisioner flags
149-
requireEABFlag, // ACME
150-
forceCNFlag, // ACME + SCEP
151-
challengeFlag, // ACME + SCEP
152-
attestationFormatFlag, // ACME
153-
attestationRootsFlag, // ACME
149+
// ACME provisioner flags
150+
requireEABFlag, // ACME
151+
forceCNFlag, // ACME + SCEP
152+
challengeFlag, // ACME + SCEP
153+
acmeProxyURLFlag, // ACME networking
154+
acmeDisableProxyFlag, // ACME networking
155+
acmeDNSResolverFlag, // ACME networking
156+
attestationFormatFlag, // ACME
157+
attestationRootsFlag, // ACME
154158

155159
// SCEP provisioner flags
156160
scepCapabilitiesFlag,
@@ -335,19 +339,26 @@ func addAction(ctx *cli.Context) (err error) {
335339
return errs.InvalidFlagValue(ctx, "type", ctx.String("type"), "JWK, ACME, OIDC, SSHPOP, K8SSA, NEBULA, SCEP, AWS, GCP, AZURE")
336340
}
337341

338-
p := &linkedca.Provisioner{
339-
Name: args.Get(0),
340-
Type: linkedca.Provisioner_Type(typ),
341-
}
342-
343-
// Validate challenge flag on scep and acme
344-
if err := validateChallengeFlag(ctx, p.Type); err != nil {
345-
return err
346-
}
347-
// Validate attestation format flag on acme
348-
if err := validateAttestationFormatFlag(ctx, p.Type); err != nil {
349-
return err
350-
}
342+
p := &linkedca.Provisioner{
343+
Name: args.Get(0),
344+
Type: linkedca.Provisioner_Type(typ),
345+
}
346+
347+
// Validate challenge flag on scep and acme
348+
if err := validateChallengeFlag(ctx, p.Type); err != nil {
349+
return err
350+
}
351+
// Validate attestation format flag on acme
352+
if err := validateAttestationFormatFlag(ctx, p.Type); err != nil {
353+
return err
354+
}
355+
356+
// Informative note: networking flags for ACME require server + linkedca support
357+
if p.Type == linkedca.Provisioner_ACME {
358+
if ctx.IsSet("acme-proxy-url") || ctx.IsSet("acme-disable-proxy") || ctx.IsSet("acme-dns-resolver") {
359+
ui.PrintSelected("Notice", "ACME networking flags provided (proxy/DNS). Server support depends on linkedca fields.\nIf your CA version does not yet include these fields, the settings will be ignored.")
360+
}
361+
}
351362

352363
// Read x509 template if passed
353364
p.X509Template = &linkedca.Template{}

command/ca/provisioner/provisioner.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,23 @@ Use the flag multiple times to remove multiple challenges.`,
369369
If this flag is set to false, then disable EAB.`,
370370
}
371371

372+
// ACME networking flags (provider-level)
373+
acmeProxyURLFlag = cli.StringFlag{
374+
Name: "acme-proxy-url",
375+
Usage: `Explicit proxy <url> to use for outbound ACME validation requests (e.g. http-01 fetches).
376+
If not set, system or environment proxy configuration will be used unless '--acme-disable-proxy' is set.`,
377+
}
378+
379+
acmeDisableProxyFlag = cli.BoolFlag{
380+
Name: "acme-disable-proxy",
381+
Usage: `Disable any HTTP(S) proxy for outbound ACME validation requests, ignoring environment variables.`,
382+
}
383+
384+
acmeDNSResolverFlag = cli.StringFlag{
385+
Name: "acme-dns-resolver",
386+
Usage: `Force a DNS resolver <host:port> (e.g. 8.8.8.8:53) for DNS queries performed during ACME challenges.`,
387+
}
388+
372389
attestationFormatFlag = cli.StringSliceFlag{
373390
Name: "attestation-format",
374391
Usage: `Enable an ACME attestation statement <format> in the provisioner. Use the flag

command/ca/provisioner/update.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ACME
4444
4545
**step ca provisioner update** <name> [**--force-cn**] [**--require-eab**]
4646
[**--challenge**=<challenge>] [**--remove-challenge**=<challenge>]
47+
[**--acme-proxy-url**=<url>] [**--acme-disable-proxy**] [**--acme-dns-resolver**=<host:port>]
4748
[**--attestation-format**=<format>] [**--remove-attestation-format**=<format>]
4849
[**--attestation-roots**=<file>] [**--admin-cert**=<file>] [**--admin-key**=<file>]
4950
[**--admin-subject**=<subject>] [**--admin-provisioner**=<name>] [**--admin-password-file**=<file>]
@@ -141,14 +142,17 @@ SCEP
141142
// Nebula provisioner flags
142143
nebulaRootFlag,
143144

144-
// ACME provisioner flags
145-
requireEABFlag, // ACME
146-
forceCNFlag, // ACME + SCEP
147-
challengeFlag, // ACME + SCEP
148-
removeChallengeFlag, // ACME
149-
attestationFormatFlag, // ACME
150-
removeAttestationFormatFlag, // ACME
151-
attestationRootsFlag, // ACME
145+
// ACME provisioner flags
146+
requireEABFlag, // ACME
147+
forceCNFlag, // ACME + SCEP
148+
challengeFlag, // ACME + SCEP
149+
removeChallengeFlag, // ACME
150+
acmeProxyURLFlag, // ACME networking
151+
acmeDisableProxyFlag, // ACME networking
152+
acmeDNSResolverFlag, // ACME networking
153+
attestationFormatFlag, // ACME
154+
removeAttestationFormatFlag, // ACME
155+
attestationRootsFlag, // ACME
152156

153157
// SCEP flags
154158
scepCapabilitiesFlag,

0 commit comments

Comments
 (0)