AWS RDS for PostgreSQL

Rotating Admin/Regular AWS PostgreSQL Database Users with Keeper

Overview

In this guide, you'll learn how to rotate passwords for AWS PostgreSQL Database User and Admin accounts on your AWS environment using Keeper Rotation. RDS for PostgreSQL is an AWS managed resource where the PostgreSQL Admin Credentials are defined in the PAM Database record type and the configurations of the PostgreSQL Users are defined in the PAM User record type.

For Amazon RDS, the AWS SDK will be used to rotate the password of Database Admin Accounts. To rotate the passwords of Regular Database Users, Keeper connects to the DB instance with the provided admin credentials and executes the necessary SQL statements to change the password. For a high-level overview on the rotation process in the AWS Environment, visit this page.

Prerequisites

This guide assumes the following tasks have already taken place:

  • Keeper Secrets Manager is enabled for your enterprise and your role

  • Keeper Rotation is enabled for your role

  • A Keeper Secrets Manager application has been created

  • A Keeper Rotation gateway is already installed, running, and is able to communicate with your AWS PostgreSQL Database

  • Your AWS environment is configured per our documentation

1. Set up a PAM Database Record

The PAM Database record contains the admin credentials and necessary configurations to connect to the PostgreSQL RDS instance on AWS. Keeper Rotation will use these provided configurations to rotate passwords of regular database user accounts in the PostgreSQL RDS instance. These provided admin credentials need to also have sufficient database permissions to successfully change the credentials of the database user accounts.

The following table lists all the required fields on the PAM Database Record:

FieldDescription

Title

Keeper record title Ex: AWS PostgreSQL Admin

Hostname or IP Address

The RDS Endpoint i.e. rdsdb.ckivswes.us-east-2.rds.amazonaws.com

Port

The RDS Port, for default ports see port mapping i.e. 5432

Use SSL

Check to perform SSL verification before connecting, if your database has SSL configured

Login

Admin account username that will perform rotation

Password

Admin account password

Connect Database

Optional database that will be used when connecting to the database server. For example, PostgreSQL requires a database and so this will default to template1.

Database ID

The AWS DB instance ID

Database Type

postgresql

Provider Region

The region your Amazon RDS instance is using. i.e us-east-2

Note: Adding Provider Region and Database ID will enable managing the PAM Database Record through the SDK.

This PAM Database Record with the admin credential needs to be in a shared folder that is shared to the KSM application created in the pre-requisites. Only the KSM application needs access to this privileged account, it does not need to be shared with any users

2. Set up PAM Configuration

If you already have a PAM Configuration for your AWS environment, you can simply add the additional Resource Credentials required for rotating database users to the existing PAM Configuration.

If you are creating a new PAM Configuration, login to the Keeper Vault and select "Secrets Manager", then select the "PAM Configurations" tab, and click on "New Configuration".

The following table lists all the required fields on the PAM Configuration Record:

FieldDescription

Title

Configuration name, example: AWS RDS Configuration

Environment

Select: AWS

Gateway

Select the Gateway that is configured on the Keeper Secrets Manager application and has network access to your PostgreSQL RDS Instance

Application Folder

Select the Shared folder that contains the PAM Database record in Step 1

Admin Credentials Record

Select the PAM Database record created in Step 1 This is the record with the admin credentials and sufficient permissions to rotate the credentials of regular database user accounts

AWS ID

A unique ID for this instance of AWS. This is for your reference and can be anything, but its recommended to be kept short Ex: AWS-1

Access Key ID

Set this field to USE_INSTANCE_ROLE if you are using EC2 role policy (default). Otherwise use a specific Access Key ID.

Access Secret Key

Set this field to USE_INSTANCE_ROLE if you are using EC2 role policy (default). Otherwise use a specific Secret Access Key.

For more details on all the configurable fields in the PAM Network Configuration record, visit this page.

3. Set up PAM User Records

Keeper Rotation will use the credentials in the PAM Database record to rotate the PAM User records on your AWS environment. The PAM User credential needs to be in a shared folder that is shared to the KSM application created in the prerequisites.

The following table lists all the required fields on the PAM User record:

FieldDescription

Title

Keeper record title i.e. AWS DB User 1

Login

Case sensitive username of the account being rotated. If the user in the DB user table is in a Host other than %, add the Host value to the user name as USERNAME@HOST

Password

Account password is optional, rotation will set one if blank

Connect Database

Optional database that will be used when connecting to the database server. For example: PostgreSQL requires a database and so this will default to template1

4. Configure Rotation on the Record - AWS PostgreSQL DB User

Select the PAM User record(s) from Step 3, edit the record and open the "Password Rotation Settings".

  • Select the desired schedule and password complexity.

  • The "Rotation Settings" should use the PAM Configuration setup previously.

  • The "Resource Credential" field should select the PAM Database credential setup from Step 1.

  • Upon saving, the rotation button will be enabled and available to rotate on demand, or via the selected schedule.

Any user with edit rights to a PAM User record has the ability to setup rotation for that record.

If the desired Admin Credential is not showing in the rotation settings screen, go to Secrets Manager > PAM Configuration > and add the necessary resource credentials.

5. Configure Rotation on the Record - AWS PostgreSQL DB Admin

Select the PAM Database record from Step 1, edit the record and open the "Password Rotation Settings".

  • Select the desired schedule and password complexity.

  • The "Rotation Settings" should use the PAM Configuration setup previously.

  • The "Resource Credential" field should select the PAM Database credential setup from Step 1.

  • Upon saving, the rotation button will be enabled and available to rotate on demand, or via the selected schedule.

If the desired Admin Credential is not showing in the rotation settings screen, go to Secrets Manager > PAM Configuration > and add the necessary resource credentials.

Last updated