Skip to content

LG-352 Create new CloudHSM key sharing script to grant IDP access to generated keys#2235

Merged
stevegsa merged 1 commit intomasterfrom
stevegsa-update-cloudhsm-keygen-to-grant-user-access
Aug 9, 2018
Merged

LG-352 Create new CloudHSM key sharing script to grant IDP access to generated keys#2235
stevegsa merged 1 commit intomasterfrom
stevegsa-update-cloudhsm-keygen-to-grant-user-access

Conversation

@stevegsa
Copy link
Contributor

@stevegsa stevegsa commented Jun 14, 2018

Why: To separate the key creator from the IDP user

How: Create the CloudhsmKeySharer script to interface to cloudhsm_mgmt_util using the credentials and key handle output by the CloudhsmKeyGenerator. Use the greenletters gem to automate interaction with the commandline utility and obscure the password.

Hi! Before submitting your PR for review, and/or before merging it, please
go through the following checklist:

  • For DB changes, check for missing indexes, check to see if the changes
    affect other apps (such as the dashboard), make sure the DB columns in the
    various environments are properly populated, coordinate with devops, plan
    migrations in separate steps.

  • For route changes, make sure GET requests don't change state or result in
    destructive behavior. GET requests should only result in information being
    read, not written.

  • For encryption changes, make sure it is compatible with data that was
    encrypted with the old code.

  • For secrets changes, make sure to update the S3 secrets bucket with the
    new configs in all environments.

  • Do not disable Rubocop or Reek offenses unless you are absolutely sure
    they are false positives. If you're not sure how to fix the offense, please
    ask a teammate.

  • When reading data, write tests for nil values, empty strings,
    and invalid formats.

  • When calling redirect_to in a controller, use _url, not _path.

  • When adding user data to the session, use the user_session helper
    instead of the session helper so the data does not persist beyond the user's
    session.

  • When adding a new controller that requires the user to be fully
    authenticated, make sure to add before_action :confirm_two_factor_authenticated.

key_handle = nil
@kmu.wait_for(:output, /Key Handle: \d+/) do |_process, matching|
matching.matched =~ /Key Handle: (\d+)/
key_handle = Regexp.last_match[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

Code Climate says lines 101 and 102 are not tested.

@kmu << "listUsers\n"
user_id = nil
@kmu.wait_for(:output, /\d+\s+CU\s+#{@idp_username}/) do |_process, matching|
user_id = matching.matched.split[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Code Climate says line 54 is not tested.

@stevegsa stevegsa force-pushed the stevegsa-update-cloudhsm-keygen-to-grant-user-access branch 3 times, most recently from cb6e8d0 to d852f30 Compare July 22, 2018 00:54
@stevegsa stevegsa force-pushed the stevegsa-update-cloudhsm-keygen-to-grant-user-access branch from 8788d58 to d76591b Compare July 22, 2018 01:03
@stevegsa
Copy link
Contributor Author

Sample transcript:

screen shot 2018-07-21 at 9 04 35 pm

…o generated keys

**Why**: To separate the key creator from the IDP user

**How**: Create the CloudhsmKeySharer script to interface to cloudhsm_mgmt_util using the credentials and key handle output by the CloudhsmKeyGenerator.  Use the greenletters gem to automate interaction with the commandline utility and obscure the password.
@stevegsa stevegsa force-pushed the stevegsa-update-cloudhsm-keygen-to-grant-user-access branch from 2677dd1 to 2eba64e Compare July 22, 2018 01:38
end

def login_to_hsm
@kmu << "loginHSM CU #{@username} #{@password}\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to document that all of these interpolated arguments should never have spaces in them.

@stevegsa stevegsa merged commit 44946cb into master Aug 9, 2018
@amathews-fs amathews-fs deleted the stevegsa-update-cloudhsm-keygen-to-grant-user-access branch January 7, 2021 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants