Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify api_addr related errors on VaultPluginTLSProvider #3620

Merged
merged 7 commits into from
Dec 5, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions helper/pluginutil/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,19 @@ func VaultPluginTLSProvider(apiTLSConfig *api.TLSConfig) func() (*tls.Config, er

addrRaw := wt.Claims().Get("addr")
if addrRaw == nil {
return nil, errors.New("decoded token does not contain primary cluster address")
return nil, errors.New("decoded token does not contain primary cluster api_address")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message isn't really good (originally, not due to your change) -- it's not really "primary cluster" it's "active node". But really just, the originating Vault process.

}
vaultAddr, ok := addrRaw.(string)
if !ok {
return nil, errors.New("decoded token's address not valid")
return nil, errors.New("decoded token's api_address not valid")
}
if vaultAddr == "" {
return nil, errors.New(`no address for the vault found`)
return nil, errors.New(`no vault api_address found`)
}

// Sanity check the value
if _, err := url.Parse(vaultAddr); err != nil {
return nil, fmt.Errorf("error parsing the vault address: %s", err)
return nil, fmt.Errorf("error parsing the vault api_address: %s", err)
}

// Unwrap the token
Expand Down
8 changes: 5 additions & 3 deletions website/source/docs/configuration/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ to specify where the configuration is.

The following parameters are used on backends that support [high availability][high-availability].

- `api_addr` `(string: "")` - Specifies the address (full URL) to
advertise to other Vault servers in the cluster for client redirection. This
can also be provided via the environment variable `VAULT_API_ADDR`.
- `api_addr` `(string: "")` - Specifies the address (full URL) to advertise to
other Vault servers in the cluster for client redirection. This value is also
used for [plugin backends][plugins]. This can also be provided via the
environment variable `VAULT_API_ADDR`.

- `cluster_addr` `(string: "")` - – Specifies the address to advertise to other
Vault servers in the cluster for request forwarding. This can also be provided
Expand All @@ -139,3 +140,4 @@ The following parameters are used on backends that support [high availability][h
[sealwrap]: /docs/enterprise/sealwrap/index.html
[telemetry]: /docs/configuration/telemetry.html
[high-availability]: /docs/concepts/ha.html
[plugins]: /docs/plugin/index.html
5 changes: 5 additions & 0 deletions website/source/docs/internals/plugins.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ plugin process' environment. This token is single use and has a short TTL. Once
unwrapped, it provides the plugin with a uniquely generated TLS certificate and
private key for it to use to talk to the original vault process.

The [`api_addr`][api_addr] must be set in order for the plugin process establish
communication with the Vault server during mount time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want a note here (and below) about when this will be set automatically.

~> Note: Reading the original connection's TLS connection state is not supported
in plugins.

Expand Down Expand Up @@ -125,3 +128,5 @@ func main() {

And that's basically it! You would just need to change MyPlugin to your actual
plugin.

[api_addr]: /docs/configuration/index.html#api_addr
5 changes: 5 additions & 0 deletions website/source/docs/plugin/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ description: |-
Plugin backends are the components in Vault that can be implemented separately from Vault's
builtin backends. These backends can be either authentication or secret backends.

The [`api_addr`][api_addr] must be set in order for the plugin process establish
communication with the Vault server during mount time.

Detailed information regarding the plugin system can be found in the
[internals documentation](https://www.vaultproject.io/docs/internals/plugins.html).

Expand Down Expand Up @@ -40,3 +43,5 @@ Unmounting a plugin backend is the identical to unmounting internal backends:
```
$ vault unmount my-secrets
```

[api_addr]: /docs/configuration/index.html#api_addr