VAULT-33758: IPv6 address conformance for proxy and agent (#29517)

This is a follow-up to our initial work[0] to address RFC-5952 §4 conformance for IPv6 addresses in Vault. The initial pass focused on the vault server configuration and start-up routines. This follow-up focuses on Agent and Proxy, with a few minor improvements for server.

The approach generally mirrors the server implementation but also adds support for normalization with CLI configuration overrides.

One aspect we do not normalize currently is Agent/Proxy client creation to the Vault server with credentials taken from environment variables, as it would require larger changes to the `api` module. In practice this ought to be fine for the majority of cases.

[0]: https://github.com/hashicorp/vault/pull/29228
This commit is contained in:
Ryan Cragun
2025-02-27 15:57:46 -07:00
committed by GitHub
parent 69646127df
commit 58a49e6ce0
32 changed files with 1474 additions and 315 deletions

View File

@@ -22,6 +22,7 @@ import (
"github.com/hashicorp/vault/api/tokenhelper"
"github.com/hashicorp/vault/command/config"
"github.com/hashicorp/vault/helper/namespace"
"github.com/hashicorp/vault/internalshared/configutil"
"github.com/mattn/go-isatty"
"github.com/mitchellh/go-homedir"
"github.com/pkg/errors"
@@ -387,11 +388,12 @@ func (c *BaseCommand) flagSet(bit FlagSetBit) *FlagSets {
f := set.NewFlagSet("HTTP Options")
addrStringVar := &StringVar{
Name: flagNameAddress,
Target: &c.flagAddress,
EnvVar: api.EnvVaultAddress,
Completion: complete.PredictAnything,
Usage: "Address of the Vault server.",
Name: flagNameAddress,
Target: &c.flagAddress,
EnvVar: api.EnvVaultAddress,
Completion: complete.PredictAnything,
Normalizers: []func(string) string{configutil.NormalizeAddr},
Usage: "Address of the Vault server.",
}
if c.flagAddress != "" {
@@ -403,11 +405,12 @@ func (c *BaseCommand) flagSet(bit FlagSetBit) *FlagSets {
f.StringVar(addrStringVar)
agentAddrStringVar := &StringVar{
Name: "agent-address",
Target: &c.flagAgentProxyAddress,
EnvVar: api.EnvVaultAgentAddr,
Completion: complete.PredictAnything,
Usage: "Address of the Agent.",
Name: "agent-address",
Target: &c.flagAgentProxyAddress,
EnvVar: api.EnvVaultAgentAddr,
Completion: complete.PredictAnything,
Normalizers: []func(string) string{configutil.NormalizeAddr},
Usage: "Address of the Agent.",
}
f.StringVar(agentAddrStringVar)