Skip to content

Commit

Permalink
Support go-sockaddr templates in top-level cluster_addr config (#13678)
Browse files Browse the repository at this point in the history
In doing some testing I found that the listener clusteraddr isn't really used, or at least isn't as important as the top-level clusteraddr setting.  As such, go-sockaddr templating needs to be implemented for the top-level `cluster_addr` setting or it's unusable for HA.

Also fix a nil pointer panic I discovered at the same time.
  • Loading branch information
ncabatoff committed Jan 19, 2022
1 parent 04307e1 commit c76f627
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog/13678.txt
@@ -0,0 +1,3 @@
```release-note:bug
core: add support for go-sockaddr templates in the top-level cluster_addr field
```
6 changes: 5 additions & 1 deletion command/server.go
Expand Up @@ -724,7 +724,6 @@ func (c *ServerCommand) runRecoveryMode() int {
c.logger.Info("goroutine trace", "stack", string(buf[:n]))
}
}

}

func logProxyEnvironmentVariables(logger hclog.Logger) {
Expand Down Expand Up @@ -2407,6 +2406,11 @@ CLUSTER_SYNTHESIS_COMPLETE:
}

if coreConfig.ClusterAddr != "" {
rendered, err := configutil.ParseSingleIPTemplate(coreConfig.ClusterAddr)
if err != nil {
return fmt.Errorf("Error parsing cluster address %s: %v", coreConfig.ClusterAddr, err)
}
coreConfig.ClusterAddr = rendered
// Force https as we'll always be TLS-secured
u, err := url.ParseRequestURI(coreConfig.ClusterAddr)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions vault/core.go
Expand Up @@ -1368,6 +1368,9 @@ func (c *Core) getUnsealKey(ctx context.Context, seal Seal) ([]byte, error) {
if err != nil {
return nil, err
}
if config == nil {
return nil, fmt.Errorf("failed to obtain seal/recovery configuration")
}

// Check if we don't have enough keys to unlock, proceed through the rest of
// the call only if we have met the threshold
Expand Down

0 comments on commit c76f627

Please sign in to comment.