Skip to content

Conversation

@andrew-corbalt
Copy link
Contributor

PR Description

This PR adds a tool that accepts a postgres connection string with admin permissions. It sets up a nessus_scan_user and a secret in secrets manager for SecOPS to use for scanning. (If the secret already exists, it will use the password already there to update the nessus_scan_user to ensure they match)

Then it sets the admin user to RDS IAM auth mode which in turn disables password auth.

Tests:
Ran against a dev db and verified the secret and user was updated as expected in each case

PR Checklist

  • New automated tests have been written to the extent possible.
  • The code has been checked for structural/syntactic validity.
    • AMI/application: a build was performed
    • terraform changes: "terraform plan" checked on every affected environment
  • (If applicable) the code has been manually tested on our infrastructure.
    • AMI/application: deployed an a test or dev environment
    • terraform changes: applied to test or dev environment
    • script: run against test or dev environment
  • Likely failure points and new functionality have been identified and tested manually.
    Examples:
    • Application manually run in a way that triggers any new branches
    • AMI logged into and changes verified from login shell
  • Pull request description includes a description of all the manual steps performed to accomplish the above.

To provide feedback on this template, visit https://docs.google.com/document/d/1YfTv7Amyop5G_8w1c2GJ_Mu-70L0KkZHhm9f9umDi3U/edit

Copy link
Contributor

@hundt-corbalt hundt-corbalt left a comment

Choose a reason for hiding this comment

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

cool!

## When to Run

- **Initial provisioning** — Run after creating a new RDS instance
- **Password rotation** — Run after manually updating the password in the `{db-identifier}_nessus` Secrets Manager secret to sync it to the database
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really understand how this is a use case, since presumably this will happen after the first run so it won't work because no more password auth

max := big.NewInt(int64(len(passwordCharset)))
out := make([]byte, n)

for i := 0; i < n; i++ {
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: as we discussed, just reading random bytes and using Sprintf("%x") is even simpler. feel free to do whichever one you prefer

Copy link
Contributor

@hundt-corbalt hundt-corbalt left a comment

Choose a reason for hiding this comment

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

Approved but please respond to comment on line 47

https://github.com/corbaltcode/go-libraries/pull/16/changes#r2632615561

@andrew-corbalt
Copy link
Contributor Author

Approved but please respond to comment on line 47

https://github.com/corbaltcode/go-libraries/pull/16/changes#r2632615561

Removed that line completely as we never supported an RDS IAM approach of running this script since it wasn't needed as part of the reprovisioning of test dbs.

@andrew-corbalt andrew-corbalt merged commit fe7db0a into main Dec 22, 2025
1 check passed
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