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

Adding the InfluxDB Single and Multi-user Secret Rotation Lambda functions #140

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

forestmvey
Copy link

@forestmvey forestmvey commented Apr 18, 2024

Issue #, if available:

N/A

Description of changes:

The InfluxDB Single and Multi-user Secret Rotation Lambdas enables the automatic rotation for users and tokens with Timestream for InfluxDB. The Multi-user rotation lambda uses an admin authenticated session to rotate another token credentials. The Single-user rotation lambda rotates their own authenticated session to update a user password with a new random password.

InfluxDB best practice for access management is to use users to create tokens for fine grain access control within an organization. Users permissions are scoped to allAccess within an organization and tokens can have any set of permissions. Use the multi-user variant for managing token rotation and use the single-user variant for rotating user credentials.

The Timestream for InfluxDB endpoint is retrieved through get_db_instance. In the case of the Multi-user rotator the authenticated client performing the rotation is the influxAuthParametersSecretArn that is created on DB initialization.

Validations:

Linting

  • - Ruff linting

single-user tests

  • - test existing user
  • - test re-rotation
  • - test invalid password
  • - test non-existent user
  • - test missing password
  • - test missing username
  • - test invalid engine
  • - test missing engine
  • - test invalid DB identifier
  • - test missing DB identifier

multi-user tests

  • - test failure to create operator token with auth environment variable set to True
  • - test failure to create operator token with auth environment variable set to False
  • - test failure to create allAccess token with auth environment variable set to False
  • - test failure to create custom token with auth environment variable set to False
  • - test success to create allAccess token with auth environment variable set to True
  • - test on successful rotation that old token value is deleted
  • - test success to create custom token with auth environment variable set to True
  • - test failure to create custom token without any permissions defined in secret
  • - test custom token has correct permissions - 2 sets of write/read buckets and 2 permissions
  • - test success rotation of allAccess token
  • - test success rotation of custom token
  • - test success rotation of operator token
  • - test failure with missing org
  • - test failure with invalid org
  • - test failure with invalid DB identifier
  • - test failure with missing DB identifier
  • - test failure with invalid engine
  • - test failure with missing engine
  • - test failure with invalid token value
  • - test failure with invalid token type
  • - test failure with missing token type

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

* Adding the InfluxDB Single and Multi-user Secret Rotation Lambdas.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Updating deployment package path to parent directory.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Fix typos in README.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Fix formatting and removing not used variables.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

---------

Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
…r token rotation only and single-user scheme for user password rotation.

Signed-off-by: forestmvey <forestv@bitquilltech.com>
…se styling.

Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
…set_secret step for confused deputy checks

Signed-off-by: forestmvey <forestv@bitquilltech.com>
…ing current token copying functionality for the multi-user rotator.

Signed-off-by: forestmvey <forestv@bitquilltech.com>
…ssions for the multi-user rotator.

Signed-off-by: forestmvey <forestv@bitquilltech.com>
…okens in a catch statement and re-throw exception.

Signed-off-by: forestmvey <forestv@bitquilltech.com>
…rvices.

Signed-off-by: forestmvey <forestv@bitquilltech.com>
@forestmvey forestmvey changed the title Adding the InfluxDB Single and Multi-user Secret Rotation Lambdas Adding the InfluxDB Single and Multi-user Secret Rotation Lambda functions Jul 8, 2024
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.

None yet

1 participant