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

Add reload capability for Vault listener certs #1196

Merged
merged 9 commits into from Mar 15, 2016
Merged

Conversation

jefferai
Copy link
Member

This can be performed at any time, but must be performed by an administrator, and as an added safety check, it currently will only re-read the same files initially given in the config at startup time. We can consider changing this later if we want (and the mechanism for how this would happen is already plumbed through).

This also generally adds a mechanism for triggering a reload; the core can call the provided reload functions with the data passed in via the API. It's up to the reload functions to do the right thing, but I don't anticipate that most of them will be very complicated. Most things will still require restart Vault.

Still to do:

  • Docs
  • CLI command/API

if err := core.Shutdown(); err != nil {
c.Ui.Error(fmt.Sprintf("Error with core shutdown: %s", err))
shutdownTriggered := false
for {
Copy link
Member

Choose a reason for hiding this comment

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

May as well do for !shutdownTriggered { and remove the if block

Copy link
Member Author

Choose a reason for hiding this comment

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

Hah, I've gotten so used to the infinite-loop-using-for-to-keep-selecting paradigm that it didn't even cross my mind.

}
tlsConf.ClientAuth = tls.RequestClientCert

ln = tls.NewListener(ln, tlsConf)
props["tls"] = "enabled"
return ln, props, nil
return ln, props, func() (string, ReloadFunc) {
Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't inline the function like this, its kind of weird to read

@@ -530,6 +549,46 @@ func (c *ServerCommand) setupTelementry(config *server.Config) error {
return nil
}

func (c *ServerCommand) Reload(configPath []string) error {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to expose this method?

Also, is it possible to use this method to load the configuration the first time as well?

var reloadErrors *multierror.Error
// Call reload on the listeners. This will call each listener with each
// config block, but they verify the ID.
for _, lnConfig := range config.Listeners {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to range over the listeners? It seems like we have one reloadFunc per anyways, seems like we can just loop over those

@armon
Copy link
Member

armon commented Mar 12, 2016

Minor comment, but LGTM

jefferai added a commit that referenced this pull request Mar 15, 2016
Add reload capability for Vault listener certs
@jefferai jefferai merged commit 6e3b771 into master Mar 15, 2016
@jefferai jefferai deleted the reload-listener-tls branch March 15, 2016 18:09
@jefferai jefferai added this to the 0.5.2 milestone Mar 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants