-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Conversation
manual) yet, and no documentation yet.
then layers reloading tests on top.
63f9ea8
to
9e49463
Compare
if err := core.Shutdown(); err != nil { | ||
c.Ui.Error(fmt.Sprintf("Error with core shutdown: %s", err)) | ||
shutdownTriggered := false | ||
for { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
…l need to sane against what's in the config
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 { |
There was a problem hiding this comment.
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
Minor comment, but LGTM |
Add reload capability for Vault listener certs
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: