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

Ingest S3 access key id/secret for bookshelf #1137

Merged
merged 2 commits into from
Mar 13, 2017

Conversation

srenatus
Copy link
Contributor

@srenatus srenatus commented Mar 10, 2017

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.

Copy link
Contributor

@stevendanna stevendanna left a 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.

@srenatus srenatus force-pushed the ssd-sr/ingest-s3-creds branch 2 times, most recently from d708e77 to 38fdce5 Compare March 13, 2017 11:24
Copy link
Member

@marcparadise marcparadise left a 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
Copy link
Member

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.

Copy link
Contributor Author

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 😃

@srenatus srenatus force-pushed the ssd-sr/ingest-s3-creds branch 2 times, most recently from f9d390a to 1117ccf Compare March 13, 2017 14:39
Copy link
Member

@marcparadise marcparadise left a 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)
Copy link
Member

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 evald 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.

Copy link
Contributor Author

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

@srenatus srenatus force-pushed the ssd-sr/ingest-s3-creds branch 2 times, most recently from 9b14901 to 3527a59 Compare March 13, 2017 16:21
srenatus and others added 2 commits March 13, 2017 17:31
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]>
@srenatus srenatus force-pushed the ssd-sr/ingest-s3-creds branch from dd68055 to aa6421f Compare March 13, 2017 16:31
@srenatus
Copy link
Contributor Author

@marcparadise marcparadise merged commit 695d121 into master Mar 13, 2017
@marcparadise marcparadise deleted the ssd-sr/ingest-s3-creds branch March 13, 2017 18:57
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.

3 participants