-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Reloadable SecureSettings #28001
Reloadable SecureSettings #28001
Conversation
cf630c8
to
886c9b2
Compare
With respect to the That is:
However, (1) is tricky.
For (2) I think a single consumer across the whole set of secure settings is more useful than a consumer for each setting (like the existing |
I agree with everything @tvernum said. |
Thank you @rjernst and @tvernum . Nevertheless, starting from what @tvernum proposed I am thinking to have it like this: Have secure settings stored in the cluster state with the value being a pointer indirection to the actual value inside the keystore (or other repository). Not sure how the password and the |
I think that would be complicated to try to reuse the dynamic cluster settings infrastructure. As @tvernum pointed out, it doesn't make sense to reload these settings one by one. Anything using secure settings will likely want to reload their state completely based on the new SecureSettings. I think a simple callback for secure settings updates that take the new SecureSettings (plus Settings, which will be needed to rebuild eg aws s3 config objects). Also, as a side note, please try to narrow the PR to only the changes necessary. I noticed there are a number of rewrites of existing javadocs and method names (eg decrypt -> unlock). If you think those changes are worthwhile (I disagree with the method rename and not sure about the javadoc changes), please do so in separate PRs. |
+1; every change should be as small and as coherent (a single unit) as possible, and no smaller. |
Pinging @elastic/es-core-infra |
@albertzaharovits can we close this? |
yes, sorry for letting it linger. |
This is my current work in progress, which is imperfect and I need advice, please:
I have changed the
SecretSettings
interface to haveunlock(char[] pass)
andlock()
methods, that will guard calls togetString
andgetFile
. Theunlock(char[] pass)
call (usable in a try-with-resource) will read the keystore contents from disk and cache the password, so that subsequentget*
calls retrieve and decrypt the latest entries (from the last unlock). TheKeyStoreWrapper
implements this interface; I have experimented with another wrapper (knowing that the keystore implementation will change) but it turned messy andKeyStoreWrapper
required rewriting anyway to remove theset*
methods (which would complicateunlock
and multithreading, and are only required when building keystores, therefore have been moved to a Builder class); I might change my mind on this, but I digress...The bigger picture is that the reload action will call
unlock
(from a try-with-resource) on theSecretSettings
instance from the node'sSettings
and then iterate overAbstractComponents
implementing some interface that will reinitialize theAbstractComponent
(maybe a new Lifecycle transition); the point is, that everything relies on the existing Settings behavior.The stuff that I need advice on:
I don't like the (soft) requirement that secure setting names are fixed but values are dynamic. If we are ok with this, then should all the settings be reloadable? Otherwise I think
SecureSettings
should move out ofSettings
, in their own component (service, maybe)?Notes:
Does not compile, all relevant code is in
KeyStoreWrapper.java
andSecureSettings.java
.