-
Notifications
You must be signed in to change notification settings - Fork 210
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
Ingest S3 access key id/secret for bookshelf #1137
Conversation
f91a7ad
to
66f87e6
Compare
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.
Looks good to me. I wonder if we could consolidate the migrate_and_check_ functions at all.
d708e77
to
38fdce5
Compare
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.
Just one comment for future consideration. I like the flow of this better.
@@ -22,6 +22,16 @@ | |||
set_secret("data_collector", "token", password) | |||
end | |||
|
|||
add_command_under_category "set-s3-access-key-id", "Secrets Management", "Set or change the S3 access key id", 2 do |
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'm starting to wonder if it wouldn't be a better UX to have something like:
chef-server-ctl set-secret NAME VALUE
And validate the names/provide a list of available names.
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.
👍 Working on it -- either as part of this PR or the next 😃
f9d390a
to
1117ccf
Compare
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.
Let's also add a warning along the lines of:
if password in chef-server.rb and we have imported it or it is already in both, warn/tell the user that they should remove it from chef-server.rb.
@@ -42,16 +51,15 @@ def confirm_continue!(message) | |||
end | |||
end | |||
|
|||
def set_secret(group, key, secret) | |||
def set(group, key, secret) |
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.
The only thing to keep in mind is that these all get eval
d into the ChefServerCtl class - so set
will become a member function of the class.
If there's any chance of another command (there are none) or existing function of the same name (I'm less sure about this without looking closer), odd things will happen without clear indication of what went wrong.
This one is generic enough that we're probably better off keeping it as set_secret
, even if only to prevent accidental future collisions.
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.
set_secret
did indeed clash with this :D
9b14901
to
3527a59
Compare
Now, if for example chef-server.rb contains redis_lb['password'] = 'foo' This would 1. be ingested in the secret store 2. trigger a warning if the value in the secret store is different from the one in the config 3. trigger a warning that it's in plain in chef-server.rb and should rather be taken from the secret store (i.e., removed from the config) and could be set interactively via chef-server-ctl set-secret redis_lb password or from the environment via REDIS_LB_PASSWORD=foobar chef-server-ctl set-secret redis_lb password Replaces old ctl-commands by calls to set-secrets; with a whitelist. Without the whitelisting, it would be quite easy to mistype the name of a secret, and thus store it under the wrong key. Now, only anticipated group/name combinations are allowed. Note that the non-generic secret ingestion commands, i.e. those with extra warnings and confirmations, - postgresql/db_superuser_password - rabbitmq/actions_password are not retired, since `set-secret` does not support extras. Signed-off-by: Stephan Renatus <[email protected]> Signed-off-by: Steven Danna <[email protected]>
This adds a simple show-secrets command. It does no validation since this is a command meant for debugging. Signed-off-by: Steven Danna <[email protected]>
dd68055
to
aa6421f
Compare
Now, if for example chef-server.rb contains
This would
the one in the config
rather be taken from the secret store (i.e., removed from the config)
and could be set interactively via
or from the environment via
Replaces old ctl-commands by calls to set-secrets; with a whitelist.
Without the whitelisting, it would be quite easy to mistype the name of
a secret, and thus store it under the wrong key. Now, only anticipated
group/name combinations are allowed.
Note that the non-generic secret ingestion commands, i.e. those with
extra warnings and confirmations,
are not retired, since
set-secret
does not support extras.