All pages
Powered by GitBook
3 of 12

AWS

Password Rotation in the AWS Environment

Overview

In this section, you will learn how to rotate user credentials within the AWS Cloud environment across various target systems and services.

AWS Credentials and their corresponding PAM Record Type

Configurations for your AWS environment are defined in the PAM Configuration section of Keeper Secrets Manager. Keeper will use the inherited EC2 instance role where the Gateway is installed to authenticate with the AWS system and perform rotation. If instance roles are not defined, the AWS Access Key ID and Secret Key can be stored in the PAM Configuration record to authenticate and perform rotations.

PAM Configuration records are encrypted in the vault just like other Keeper records

Configurations for managed resources like EC2, RDS, and Directory Services are defined in the PAM Machine, PAM Database, and PAM Directory record types. The following table shows the supported AWS managed resources with Keeper Rotation and their corresponding PAM Record Type:

AWS Managed Resource
Corresponding Record Type

EC2

PAM Machine

RDS

PAM Database

Directory Service

PAM Directory

Configurations for directory users or IAM users are defined in the PAM User record type.

Prerequisites - Rotation on your AWS Environment

Prior to rotating user credentials within your AWS environment, you need to make sure you have the following information and configurations in place:

  1. To successfully rotate IAM User accounts, an IAM Admin account needs to be created. An IAM Admin account is an IAM User account with the appropriate policy settings configured to access the target resource. For more information on the policy settings, visit this page.

  2. To successfully rotate credentials of AWS Managed Resources attached to an EC2 instance, a role with the appropriate policy settings need to be configured and attached to the EC2 instance. For more information on the policy settings, visit this page.

  3. To configure and setup Rotation within your AWS environment, the following values are needed in the PAM Configuration:

Field
Description

Access Key ID

This is the Access Key ID from the desired Access Key found in the IAM User account Set this field to USE_INSTANCE_ROLE if the gateway is deployed to an EC2 Instance that supports instance roles

Secret Access Key

This is the Secret Access Key from the desired Access Key found in the IAM User account Set this field to USE_INSTANCE_ROLE if the gateway is deployed to an EC2 Instance that supports instance roles

The Keeper Gateway will always first attempt to use the EC2 instance role to authenticate and perform the rotation. If this fails or is not available on the machine, Keeper will use the Access Key ID and Secret Access Key stored in the PAM Configuration.

AWS Environment Setup

Visit the following section for more details on setting up your environment in AWS:

AWS Environment Setup

Summary - Rotation on your AWS Environment

At a high level, the following steps are needed to successfully rotate passwords on your AWS network:

  1. Create Shared Folders to hold the PAM records involved in rotation

  2. Create PAM Machine, PAM Database and PAM Directory records that contain credentials with the necessary permissions to rotate and update the user's credentials

  3. Create PAM User records that contain the user's information

  4. Create a Secrets Manager Application and assign it to the shared folders that hold the PAM records

  5. Install a Keeper Gateway and add it to the Secrets Manager application

  6. Create a PAM Configuration with the AWS environment setting

  7. Configure Rotation settings on the PAM User records and/or PAM Machine, PAM Database, PAM Directory records

The following pages cover these steps in more details on how to successfully rotate passwords in different scenarios on AWS:

Rotating AWS Directory Users:

Managed Microsoft AD User

Rotating EC2 Virtual Machine Accounts:

EC2 Virtual Machine User

Rotating IAM User Accounts:

IAM User Password

Rotating AWS Access Keys

IAM User Access Key

Rotating AWS Managed Database Accounts:

Managed Database

AWS Environment Setup

How to configure your AWS environment for Keeper Rotation

AWS Environment Overview

Resources in your AWS environment can be rotated either using EC2 instance roles or using a specified Access Key ID / Secret Access Key configured in the PAM Configuration record.

The role policy must be configured appropriately to enable access to the target AWS resources:

  • EC2 Role Policy (Preferred)

  • IAM User Policy

The following diagram shows the AWS environment hierarchy:

AWS Rotation Hierarchy

EC2 IAM Role Policy (Preferred)

This method requires that you are running the Keeper Gateway on an EC2 instance in AWS.

To rotate credentials of AWS Managed Resources from an EC2 instance:

First, a role with the appropriate policy settings will be configured and then attached to the EC2 instance (instead of using a static Access Key ID / Secret Access Key).

To be configured to have the authority for rotation, the following inline role policy needs to be created with the following JSON:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeInstances",
                "rds:DescribeDBInstances",
                "ds:DescribeDirectories",
                "iam:ListUsers",
                "iam:ListAccessKeys",
                "iam:UpdateLoginProfile",
                "rds:ModifyDBInstance",
                "ds:ResetUserPassword",
                "ds:DescribeLDAPSSettings",
                "ds:DescribeDomainControllers"
            ],
            "Resource": "*"
        }
    ]
}

The above JSON can be edited to remove resources not used for rotation. For example, if no RDS resource is used, you can remove rds:DescribeDBInstances and rds:ModifyDBInstance. However iam:SimulatePrincipalPolicy is required.

Follow these steps to create a new role and apply the policy:

  1. Create role with JSON specified above, or click on IAM > Roles > Create Role > Select "AWS Service" with "EC2 use case".

  2. Attach the policy JSON to the role.

  1. From EC2 > Instances, select the instance with the gateway and go to Actions > Security > Modify IAM Role > Select your new role.

Minimum AWS Policy to Manage IAM users

Managed User Type
IAM Policy

EC2 User

Rotation uses local credentials and no specific AWS permissions are needed.

Managed Database

Rotation uses AWS APIs for PAM Database records and requires: iam:GetUser iam:SimulatePrincipalPolicy rds:ModifyDBInstance rds:DescribeDBInstances

For managing PAM Database or PAM User Records via SQL no AWS permissions are needed.

Directory User

Rotation uses AWS APIs for PAM Directory records and requires:

iam:SimulatePrincipalPolicy ds:DescribeDirectories ds:ResetUserPassword ds:DescribeLDAPSSettings ds:DescribeDomainControllers

IAM User

Rotation uses AWS APIs for PAM User records and requires:

iam:SimulatePrincipalPolicy iam:UpdateLoginProfile iam:GetUser


IAM User Policy

Using EC2 instance role policy is preferred. Alternatively, the AWS Access Key ID and Secret Access Key can be directly set in the PAM Configuration. The IAM Admin account needs to be created with the appropriate policy settings configured to access the target resource in AWS.

An inline policy can be created for a user with the following JSON:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "iam:SimulatePrincipalPolicy",
                "ec2:DescribeInstances",
                "rds:DescribeDBInstances",
                "ds:DescribeDirectories",
                "iam:ListUsers",
                "iam:GetUser",
                "iam:ListAccessKeys",
                "iam:UpdateLoginProfile",
                "rds:ModifyDBInstance",
                "ds:ResetUserPassword",
                "ds:DescribeLDAPSSettings",
                "ds:DescribeDomainControllers"
            ],
            "Resource": "*"
        }
    ]
}

The above JSON can be edited to remove resources not used for rotation. For example, if no RDS resource is used, you can remove rds:DescribeDBInstances and rds:ModifyDBInstance

However iam:SimulatePrincipalPolicy is required.

The steps to create the access keys is below:

  • Create a new IAM user or select an existing user

  • Attach the inline policy specified above to the user

  • Open the IAM user > Security credentials > Create access key

  • Select "Application running outside AWS"

  • Save the provided Access Key ID / Secret Access Key into the PAM Configuration

Managed Microsoft AD User

Rotating AWS Managed Microsoft AD Service accounts with Keeper

Overview

In this guide, you will learn how to rotate Admin and User Accounts of an AWS Managed Microsoft AD service using Keeper Rotation. The Active Directory Service is an AWS managed resource where the Directory Service admin credentials are defined in the PAM Directory record type and the configurations of the AD Users are defined in the PAM User record type.

For Amazon Managed Active Directory Services, the AWS SDK will be used to rotate the password of Directory Admins. User Account passwords will be rotated using LDAP and, in order to successfully rotate, server-side LDAPS must be configured and the Directory Admin, defined in the PAM Directory record type, must be using a SSL Connection.

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 Directory Services

  • Your AWS environment is configured per our documentation

1. Set up a PAM Directory Record

Keeper Rotation will use the Directory admin credentials of your AWS Managed Directory Service to rotate passwords of Domain Service's directory accounts. These admin credentials can also be used to rotate the passwords of the Directory admin.

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

Field
Description

Title

Name of the Record i.e. AD Domain Service

Hostname or IP Address

The Directory DNS Name i.e. ad.pam.test

Port

636 for LDAPS, for default ports see port mapping

Use SSL (checkbox)

Must be checked

Login

Directory Service Admin Account i.e. Admin Note: Either Login and Domain Name or Distinguished Name is required. Distinguished Name is preferred.

Password

Directory Service Admin Password

Distinguished Name

Directory Service Admin Account's Distinguished Name (DN). Note: If DN is not provided, the following format will be used: Given domain name is example.com: CN=<user>,CN=Users,DC=example,DC=com

Domain Name

The Directory DNS Name Note: This is required if using Login instead of Distinguished Name

Directory ID

Directory Service's Identifier i.e d-##########

Directory Type

Directory Service Directory type, defaults to Active Directory if left blank.

Provider Region

AWS region name i.e. us-east-1

Note: Adding Provider Region and Directory ID will enable managing the PAM Directory Record through the AWS SDK, which is preferred.

This PAM Directory 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 directory 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:

Field
Description

Title

Configuration name, example: AWS AD Configuration

Environment

Select: AWS

Gateway

Select the Gateway that is configured on the Keeper Secrets Manager application and has network access to your Active Directory server from the pre-requisites

Application Folder

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

Admin Credentials Record

Select the PAM Directory record created in Step 1 This is the record with the admin credentials and sufficient permissions to rotate the directory user account's credentials

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 Access Key ID.

Region Names

List of AWS region names, one per line Example: us-east-1 us-east-2

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

3. Set up one or more PAM User Records

Keeper Rotation will use the credentials in the PAM Directory 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:

Field
Description

Title

Keeper record title i.e. AWS Directory User1

Login

Username of the Directory Service's user account

Password

Account password is optional, rotation will set one if blank

Distinguished Name

Directory Service User Account's Distinguished Name (DN)

4. Configure Rotation on the Record - Directory 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 Directory 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 - Directory Admin

Select the PAM Directory 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 Directory 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.

Troubleshooting

Getting the Distinguished Names of AWS Managed Directory Service Users

The following windows command can be used to get the distinguished name of the Directory user:

Get-ADUser -Identity "username" | Select-Object -ExpandProperty DistinguishedName

If the command does not exist, you need to import the appropriate module with:

Import-Module ActiveDirectory

EC2 Virtual Machine User

Rotating AWS EC2 Virtual Machine accounts with Keeper

In this guide, you will learn how to rotate AWS EC2 Virtual Machine (VM) Accounts on your AWS Environment using Keeper Rotation. The EC2 VM is an AWS managed resource where the EC2 VM Admin Credentials are defined in the PAM Machine record type and the configurations of the EC2 VM Users are defined in the PAM User record type.

For EC2 VM Accounts, the AWS SDK is not used to rotate the password. Instead, the normal operating system commands are used to change the password. Keeper will connect to the target machine and send command-line commands 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 via SSH or WinRM with your target AWS Virtual Machine(s).

  • Your AWS environment is configured per our documentation

1. Set up PAM Machine Records

Keeper can rotate any local user account on either the Gateway machine or any other machine on the network. A PAM Machine record should be created for every machine. This PAM Machine record should contain an administrative credential that has the rights to change passwords for users on the machine.

Once a PAM Machine record is created for every machine, a PAM User record needs to be created for each local user account that will be rotated. The PAM Machine record itself can also be rotated.

Keeper will use the referenced admin credential to rotate the password or SSH key of AWS Virtual Machine users in your AWS environment. These admin credentials need to have the sufficient permissions in order to successfully change the credentials of these user accounts.

If you are running a rotation on a PAM Machine record which also happens to be the same machine running the Keeper Gateway, Keeper will attempt to rotate the password or SSH key for the account using the keeper-gw user. Assuming that keeper-gw has sudoers privilege, it will be able to perform rotations on the local Gateway machine.

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

Field
Description

Title

Name of the Record i.e AWS Linux 1

Hostname or IP Address

Machine hostname or IP as accessed by the Gateway

Port

Typically 5985 or 5986 for WinRM, 22 for SSH.

Login

Username of the Admin account

Password

Required for WinRM

Optional for SSH if your admin user logs in with a password, otherwise the PEM key is utilized. Note: The following chars are restricted: " '

Private PEM Key

Required for SSH if not using a password

Operating System

The VM Operating System, i.e Windows or Linux

SSL Verification

For WinRM, if selected, will use SSL mode port 5986. Ignored for SSH.

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

The PAM Machine record can also be set up for rotation.

PAM Machine record

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 machine users to the existing PAM Configuration.

Make sure the following items are completed first:

  • A Keeper Secrets Manager application has been created

  • A Keeper Rotation gateway is already installed, running, and is provisioned in the Keeper Secrets Manager application you created.

  • PAM Machine records have been created for each target machine

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 that needs to be filled on the PAM Configuration.

Field
Description

Title

Configuration name, example: AWS VM Configuration

Environment

Select: AWS

Gateway

Select the Gateway that is configured on the Keeper Secrets Manager application and has network access to your Active Directory server from the prerequisites

Application Folder

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

Admin Credentials Record

Select the PAM Machine record created in Step 1 This is the record with the admin credentials and sufficient permissions to rotate the directory user account's credentials

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.

Secret Access 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.

PAM Configuration for AWS

Add all of the Administrative Resource Credentials to your PAM Configuration required for performing rotation on the target machines. For example, if you are rotating 3 different PAM Machines, those needed to be added as Resource Credentials on the PAM Configuration.

3. Set up PAM User Records

Keeper will use the credentials in the PAM Machine record to rotate the PAM User records in 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 that need to be filled on the PAM User record:

Field
Description

Title

Keeper record title i.e. AWS Machine1 ec2-user

Login

Case sensitive username of the user account being rotated, e.g. ec2-user.

Password

This is only required if the user logs in with a password. If the password is left blank, performing a rotation will set one.

Private PEM Key

This is only required if you are planning to rotate the PEM key instead of rotating a password.

PAM User record for password rotation

4. Configure Rotation on the Record - AWS VM 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 Machine credential setup from Step 1.

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

Password Rotation Settings on AWS Instance User

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 PAM Machine Record

If rotation of the PAM Machine credential is desired, select the PAM Machine 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 Machine credential setup from Step 1.

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

Password Rotation Settings on PAM Machine

SSH Key Rotation Notes

When rotating the private PEM Key credential on a target machine or user, Keeper will update the authorized_keys file on the machine with the new public key. The first time that a rotation occurs, the old public key is left intact in order to prevent system lockout. The second public key added to the file contains a comment that serves as an identifier for future rotations. For example:

[ec2-user@host .ssh]$ cat authorized_keys
ssh-rsa AAAAB3NzaC1...11xZrfOxYXG6RV84mCZ3uldesEyV/ghLxAb7Fcz awsdemo
ssh-rsa AAAAB3NzaC...un+frl9Q== keeper-security-ec2user

If the first rotation is successful, you can optionally delete the old public key entry in the authorized_keys file. On subsequent rotations, Keeper will update the line which contains the "keeper-security-xxx" comment.

Troubleshooting

  • For Linux user rotations, password-encrypted PEM files are not currently supported.

IAM User Password

Rotating AWS IAM account passwords with Keeper

Overview

In this guide, you will learn how to rotate passwords for AWS IAM users. In Keeper, the PAM Configuration contains all of the information needed to rotate passwords. The record containing the AWS IAM user accounts to be rotated are stored in the PAM User record.

For a high-level overview on the rotation process in the AWS cloud 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 and running

  • Your AWS environment is configured per our documentation

The Keeper Gateway uses AWS APIs to rotate the credentials defined in the PAM User records.

1. Create Shared Folder

In this folder, you’ll create records for the AWS IAM accounts that you’ll rotate. You will create a PAM User record for each user that will be rotated.

Shared Folder containing PAM User records

Note: The target user to be rotated must have AWS Console access and at minimum have a temporary password set in the AWS Console before the password can be rotated.

2. Create PAM User Record(s)

Keeper Rotation uses the AWS API to rotate the PAM User records in your AWS environment. The PAM User records need 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:

Field
Description

Title

Keeper record title i.e. AWS user: TestUser

Login

Case sensitive username of the account being rotated.

Password

Providing a password is optional. Performing a rotation will set one if this field is left blank.

Distinguished Name

This is the full ARN of the user identity, e.g: arn:aws:iam::123456789:user/TestUser

PAM User records for IAM Users

3. Set up PAM Configuration

Note: You can skip this step if you already have a PAM configuration set up.

In the left menu of the vault, 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:

Field
Description

Title

Configuration name, example: AWS IAM Configuration

Environment

Select: AWS

Gateway

Select the Gateway that is configured on the Keeper Secrets Manager application.

Application Folder

Select the Shared folder from Step 1 that contains the PAM User record(s) which will be rotated.

Admin Credentials Record

Leave this blank as it is not required for IAM User rotations. It may be required for other use cases.

AWS ID

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

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.

PAM Configuration for AWS Environment

4. Configure Rotation on the PAM User Records

Select the PAM User record(s) from Step 2, 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 is not needed

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

Password Rotation Settings on AWS IAM Users

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

Note: The user must have AWS Console access and at minimum have a temporary password set in the AWS Console before the password can be rotated.

IAM User Access Key

Automatically rotate AWS access keys using Keeper Secrets Manager rotations

Overview

This documentation explains how to rotate AWS IAM user access keys using Keeper Secrets Manager rotation’s “NOOP mode”. This is a flag set in the Keeper record which tells the Gateway to skip the primary rotation method and directly execute the post-rotation script attached to the PAM User record in the vault.

This guide includes prerequisites, step-by-step instructions, and a Python script example. This provided script supports both provided admin credentials (AWS Access key for an admin account) and EC2 instance role authentication. The script ensures secure access key rotation, including deletion of previous user keys. The new key is stored in the Keeper record after rotation is complete.

Prerequisites

  1. KSM role: Ensure that the Keeper user has a role providing access to Keeper Secrets Manager, and Keeper Secrets Manager rotations.

  2. A Linux instance to run the Keeper Gateway: The Gateway can be deployed in an EC2 instance, any private Cloud or on-prem. This script is capable of leveraging EC2 Instance Roles Authentication to perform the Access Key rotation if the Gateway runs in an EC2 instance. If the gateway runs somewhere else, then an Access Key with role privilege needs to be provided in the Keeper vault to perform the rotation of the end user Access Key.

Rotation Script Logic Flow

1. Admin Credentials Retrieval

The script retrieve admin credentials in three ways:

  1. Record directly attached to the post rotation script.

  2. The access key provided to the AWS PAM config selected for the rotation. This will be used if no access key is found in the record attached (method 1 above) to the post rotation script.

  3. Uses AWS instance role authentication if no credentials are provided from either methods above. The gateway needs to be running on an EC2 Instance with an EC2 Instance Role in place.

2. Key Rotation Logics

The script provides two modes of operation based on the delete_all_keys_before_rotating custom field:

  • If False (default), a new access key is created first, then the old ones are deleted, keeping only the newly created key. This will fail if the user account has already two access keys: AWS will not allow the script to create a third one.

  • If this custom field is set to True, the script deletes all existing access keys for the IAM user before creating a new one. This helps in the scenario described above where the end user account has already two access keys.

3. Updating the Keeper PAM User Record in the Vault

After key rotation, the script updates the rotated PAM User Keeper record with the new AWS access key ID, secret access key, creation date, and any deleted access keys IDs.

PAM User Record - Fields Requirements

You need to create a PAM User record where the rotation will be configured later on. The fields below need to be created.

Fields required:

Field Name
Description

Login

Name of the user account in AWS where the access key needs to be rotated.

Password

It will be a dummy value in this case. The password field gets automatically rotated, but it is not used anywhere. This is still required field.

Custom fields required:

Custom Field Label
Field Type
Description
aws_access_key_id

Text

This field will receive the new access key id after the rotation.

aws_secret_access_key

Hidden Field

This field will receive the new secret access key after the rotation.

CreateDate

Text

This field will contain the timestamp of when the new key has been generated by the script.

Access_Key_ID_Removed_during_previous_rotation

Text

This field will contain the old access key id(s) removed from the user account in AWS during the rotation.

delete_all_keys_before_rotating

Text

This custom field is optional. It could be set to “False” or “True”, the default value is “False”.

If set to “True” then the rotation script will start by deleting all existing access keys on the user account before creating a new one. This is needed when the user has already 2 access keys setup. AWS will not allow the script to create a third one, hence the need to delete the existing keys before adding a new one.

NOOP

Text

This rotation requires the gateway to only execute the rotation script, and not try to rotate something using the built-in rotation features.

The value has to be:

True
Private Key Type

Text

Second field to enable NOOP.

The value has to be:

rsa-ssh

Instead of creating the PAM User record manually using the details above, you could also import the csv file below. It will create a template record you can amend and duplicate as needed. Importing the file will generate a Login record type: make sure to convert it to PAM User.

213B
PAM User template.csv
CSV file to easily create a PAM User template record via an import in the vault
PAM User record example

Setting Up the Rotation in the Keeper Vault

When the gateway runs in an EC2 instance, you don’t need to provide an admin access key to the script. The gateway will leverage the AWS Instance Role permissions assigned to the VM.

The steps below explains how to set up an EC2 Instance role to the gateway EC2 instance with minimal permissions:

Steps to Add/Configure Instance Role With Minimum Permissions to Rotate Access Keys:

Step 1: Create a Policy in AWS

  1. Go to the IAM Management Console.

  2. Select Policies and click Create policy.

  3. Select JSON and paste the following, make sure to replace your AWS Account ID:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "iam:CreateAccessKey",
        "iam:ListAccessKeys",
        "iam:DeleteAccessKey"
      ],
      "Resource": "arn:aws:iam::YOUR_AWS_ACCOUNT_ID_HERE:user/*"
    }
  ]
}
Create a policy in AWS
  1. Name the policy and save it.

Step 2: Create an IAM Role in AWS

  1. Go to the IAM Management Console.

  2. Select Roles and click create role.

  3. Choose AWS service and select EC2.

Create an IAM role in AWS
  1. Attach the necessary IAM policies (e.g., the policy we created above with the minimum permissions).

Attach the policy to the role in AWS

Step 3: Assign the Role to Your EC2 Instance

  1. In the EC2 Management Console, find your instance.

  2. Click Actions > Security > Modify IAM Role.

EC2 Instance contextual menu
  1. Select the role you created and click Update

Assign IAM role to EC2 instance
  1. Verify Instance Role Permissions

You can ensure that the instance role has appropriate permissions to interact with IAM by running the command below on the Gateway EC2 Instance:

aws sts get-caller-identity

After configuring this role, your EC2 instance, in this case your Keeper Gateway, will automatically use the attached role credentials for your script, allowing it to perform actions like creating and deleting IAM access keys without needing explicit access key credentials.

Rotation Configuration From the Vault:

  1. Create a shared folder in the vault

  2. Create a PAM User record in the shared folder with the fields and custom fields described above.

  3. In the Secret Manager tab of the Keeper vault, create a new application for the gateway if there is no gateway yet.

  4. Make sure the Application has edit permissions on the shared folder created above.

  5. Provision the gateway (gateway tab after selecting the application) on an EC2 instance. On the EC2 Instance run the install command provided by the Keeper vault and make sure boto3 and keeper_secrets_manager_core are installed by running the following commands in the EC2 instance:

pip3 install boto3
pip3 install keeper_secrets_manager_core
  1. In the Secret Manager tab of the Keeper vault, go to the PAM Configurations tab. Create a new PAM configuration if needed.

  2. Under Environment you can select “Local Network” or “AWS”. If you select “AWS”, please make sure to leave the “Access Key” and “Secret Access Key” field empty. If you provide one, it will be automatically used by the script instead of using the Instance Role authentication. You will still need to provide the AWS Account ID to the AWS PAM configuration.

  3. Select the gateway, select the shared folder and save the PAM configuration.

PAM Configuration without providing an AWS access key
  1. Edit the PAM User record previously described in this documentation:

    • Password Rotation Settings: select your desired schedule and the PAM configuration created above.

    • Add PAM Script to the record: select the provided file below and make sure to specify the script command:

python3
Attach PAM script with a script command

When the gateway does not run in an EC2 instance, it will require an admin access key to authenticate against AWS and rotate another user's access key. Here we will be using the admin access key provided in the AWS PAM Configuration.

Configuration From the Keeper Vault:

  1. Create a shared folder in the vault

  2. Create a PAM User record in the shared folder with the fields and custom fields described above.

PAM User record in the shared folder
  1. In the Secret Manager tab of the Keeper vault, create a new application for the gateway if there is no gateway yet.

  2. Make sure the Application has edit permissions on the shared folder created above.

  3. Provision the gateway (gateway tab after selecting the application) on a Linux box. Simply run the install command provided by the Keeper vault and make sure boto3 and keeper_secrets_manager_core are installed by running the following commands on the Linux box:

pip3 install boto3
pip3 install keeper_secrets_manager_core
  1. In the Secret Manager tab of the Keeper vault, go to the PAM Configurations tab. Create a new PAM configuration if needed.

  2. Under Environment, please select “AWS”, select the Gateway, select the shared folder, provide the “AWS ID”, the “Access Key” and “Secret Access Key”. This will be the admin access key that the script uses to rotate a user access key.

AWS PAM Config
  1. Edit the PAM User record previously described in this documentation:

    • Password Rotation Settings: select your desired schedule and the PAM configuration created above.

    • Add PAM Script to the record: select the provided file below and make sure to specify the script command:

python3
Attach PAM script with a script command

When the gateway does not run in an EC2 instance, it will require an admin access key to authenticate against AWS and rotate another user's access key. Here we will be using the admin access key provided in another Keeper record. This option also allows to rotate the admin access key the same way Keeper rotates an user access key.

You may have followed any of the two other tabs available in this doc (Using AWS instance role, or Using AWS PAM Config) to set up the rotation: you will have a PAM configuration that contains or does not contain an access key. Following the steps below will force the use of an admin access key stored in another Keeper record.

Configuration From the Keeper Vault:

When attaching the PAM Script to the PAM user record, it is possible to attach Rotation Credentials.

Attach Rotation Credentials to a PAM Script

The attached record could be any record type. It needs at least the two custom fields “aws_access_key_id” and “aws_secret_access_key” with the admin access key.

Using the PAM User record type to store the admin access key allows you to also automate the rotation of the admin access key. Make sure to follow those requirements in that case.

Using AWS AssumeRole to rotate user access keys across other AWS accounts

When attaching a record to the PAM script itself to provide an admin AWS access keys also allows to leverage AWS AssumeRole to rotate an AWS user access key across multiple AWS accounts.

More information about AWS AssumeRole here.

To leverage this feature, you need to add a new custom field to the record attached to the PAM script (Rotation Credentials).

The custom field label needs to be:

role_arn

This field will contain the role arn from your AWS environment that has the permissions to rotate access keys in other AWS accounts.

When this field exists, the rotation script will use it along with the provided admin access key ID and secret to generate a new temporary access key to rotate the end user’s one in the other AWS account. The script will then update the Keeper PAM User record with the new key and information, the same way it usually does without this extra field.

Python Script

10KB
RotateAWSAccessKeys.py
Download script
import boto3
import sys
import base64
import json
from keeper_secrets_manager_core import SecretsManager
from keeper_secrets_manager_core.storage import FileKeyValueStorage
from botocore.exceptions import ClientError, NoCredentialsError

# sys.stdin is not an array, it cannot be subscripted (i.e., sys.stdin[0])
for base64_params in sys.stdin:
    # Retrieve params from the gateway
    params = json.loads(base64.b64decode(base64_params).decode('utf-8'))
    break

# Retrieve records attached to the post-rotation script in Keeper
records = json.loads(base64.b64decode(params.get('records')).decode('utf-8'))

# Initiate Keeper Secrets Manager SDK using the gateway configuration
secrets_manager = SecretsManager(config=FileKeyValueStorage('/etc/keeper-gateway/gateway-config.json'))

# Function to create a new access key for a user
def create_new_access_key(iam_client, user_name: str) -> tuple:
    new_key = iam_client.create_access_key(UserName=user_name)
    return new_key['AccessKey']['AccessKeyId'], new_key['AccessKey']['SecretAccessKey'], new_key['AccessKey']['CreateDate']

# Function to rotate user's access key
def rotate_user_access_key(iam_client, user_name: str) -> dict:
    if not user_name:
        raise ValueError("User name is required for rotation")

    try:
        # Step 1: Create a new access key for the user
        new_access_key_id, new_secret_access_key, create_date = create_new_access_key(iam_client, user_name)

        print(f"New Access Key created successfully for user {user_name}")

        # Step 2: List all existing access keys for the user
        existing_keys = iam_client.list_access_keys(UserName=user_name)
        deleted_keys = [access_key['AccessKeyId'] for access_key in existing_keys['AccessKeyMetadata']
                        if access_key['AccessKeyId'] != new_access_key_id]

        # Step 3: Delete all other access keys, except the newly created one
        for access_key_id in deleted_keys:
            iam_client.delete_access_key(UserName=user_name, AccessKeyId=access_key_id)

        # Return the results
        return {
            'NewAccessKeyId': new_access_key_id,
            'NewSecretAccessKey': new_secret_access_key,
            'CreateDate': create_date,
            'DeletedAccessKeys': deleted_keys
        }

    except ClientError as e:
        print(f"An error occurred: {e}")
        raise e

# Function to delete all keys and then rotate user's access key
def delete_then_rotate_user_access_key(iam_client, user_name: str) -> dict:
    try:
        # Step 1: List all existing access keys for the user
        existing_keys = iam_client.list_access_keys(UserName=user_name)
        deleted_keys = [access_key['AccessKeyId'] for access_key in existing_keys['AccessKeyMetadata']]

        # Step 2: Delete all keys
        for access_key_id in deleted_keys:
            iam_client.delete_access_key(UserName=user_name, AccessKeyId=access_key_id)

        # Step 3: Create a new access key for the user
        new_access_key_id, new_secret_access_key, create_date = create_new_access_key(iam_client, user_name)

        print(f"New Access Key created successfully for user {user_name}")

        # Return the results
        return {
            'NewAccessKeyId': new_access_key_id,
            'NewSecretAccessKey': new_secret_access_key,
            'CreateDate': create_date,
            'DeletedAccessKeys': deleted_keys
        }

    except ClientError as e:
        print(f"An error occurred: {e}")
        raise e

# Function to assume the role in the target AWS account
def assume_role_in_target_account(role_arn, session_name='CrossAccountSession'):
    sts_client = boto3.client('sts')
    try:
        assumed_role = sts_client.assume_role(
            RoleArn=role_arn,
            RoleSessionName=session_name
        )
        credentials = assumed_role['Credentials']
        return {
            'aws_access_key_id': credentials['AccessKeyId'],
            'aws_secret_access_key': credentials['SecretAccessKey'],
            'aws_session_token': credentials['SessionToken']
        }
    except ClientError as e:
        print(f"Error assuming role: {e}")
        raise e

# Inputs from the gateway and full PAM user query using KSM
pam_user_to_update = secrets_manager.get_secrets([params.get('userRecordUid')])[0]
user_name = params.get('user')

# Retrieve admin user account access key
aws_admin_cred_provided = False
for record in records:
    if "role_arn" in record: # AssumeRole auth detected from the Keeper record
        aws_admin_cred_provided = True
        role_arn = record["role_arn"]
        aws_access_key_id = record["aws_access_key_id"]
        aws_secret_access_key = record["aws_secret_access_key"]
        print(f"Admin access key provided along with role arn for AWS AssumeRole. Using Access Key ID {aws_access_key_id}, from record UID {record['uid']}.")
        # Assume the role and get temporary credentials
        assumed_role_credentials = assume_role_in_target_account(role_arn)
        # Initialize IAM client using the assumed role's credentials
        iam_client = boto3.client(
            'iam',
            aws_access_key_id=assumed_role_credentials['aws_access_key_id'],
            aws_secret_access_key=assumed_role_credentials['aws_secret_access_key'],
            aws_session_token=assumed_role_credentials['aws_session_token'],
            region_name='us-east-1'
        )
        break
    if "aws_access_key_id" in record:
        aws_admin_cred_provided = True
        aws_access_key_id = record["aws_access_key_id"]
        aws_secret_access_key = record["aws_secret_access_key"]
        print(f"Admin access key provided. Using Access Key ID {aws_access_key_id}, from record UID {record['uid']}.")
        # Initialize IAM client with admin credentials
        iam_client = boto3.client('iam',
                                  aws_access_key_id=aws_access_key_id,
                                  aws_secret_access_key=aws_secret_access_key,
                                  region_name='us-east-1')
        break
    if "accessKeyId" in record:
        aws_admin_cred_provided = True
        aws_access_key_id = record["accessKeyId"]
        aws_secret_access_key = record["accessSecretKey"]
        print(f"Admin access key provided. Using Access Key ID {aws_access_key_id}, from record UID {record['uid']}.")
        # Initialize IAM client with admin credentials
        iam_client = boto3.client('iam',
                                  aws_access_key_id=aws_access_key_id,
                                  aws_secret_access_key=aws_secret_access_key,
                                  region_name='us-east-1')
        break
else:
    try:
        # Try to retrieve admin access key from the PAM config using Keeper Secrets Manager
        pam_config = secrets_manager.get_secrets([params.get('providerRecordUid')])[0]
        aws_access_key_id = pam_config.field('accessKeyId', single=True)
        aws_secret_access_key = pam_config.field('accessSecretKey', single=True)

        # Check if keys are retrieved successfully
        if aws_access_key_id and aws_secret_access_key:
            aws_admin_cred_provided = True
            print(f"Admin access key retrieved from the PAM Config. Using Access Key ID {aws_access_key_id}, from the PAM Config.")
            # Initialize IAM client with admin credentials
            iam_client = boto3.client('iam',
                                      aws_access_key_id=aws_access_key_id,
                                      aws_secret_access_key=aws_secret_access_key,
                                      region_name='us-east-1')
        else:
            print("Access key ID or secret key not found in the retrieved Keeper Secrets Manager record.")
    except Exception as e:
        # Handle any error that occurs during retrieval
        print(f"Error retrieving admin access key: {e}")

# Check for instance role credentials if no admin access key is provided
if not aws_admin_cred_provided:
    print("No admin access key provided. Checking for instance role authentication...")
    try:
        # Test if instance role credentials are available by creating an IAM client without credentials
        iam_client = boto3.client('iam')
        iam_client.list_access_keys(UserName=user_name)  # Test if we can access the API
        aws_admin_cred_provided = True
        print("Instance role credentials found. Using instance role authentication.")
    except NoCredentialsError:
        print("No instance role credentials available.")
    except ClientError as e:
        print(f"Error using instance role credentials: {e}")

# Exit if no credentials were provided
if not aws_admin_cred_provided:
    raise RuntimeError("No admin access key or instance role credentials provided. The script will exit.")

# Check if the user specified a delete_all_keys_before_rotating custom field
try:
    delete_all_keys_before_rotating = pam_user_to_update.custom_field('delete_all_keys_before_rotating', single=True)
    delete_all_keys_before_rotating = str(delete_all_keys_before_rotating).lower() in ['true', 'yes', '1']
except Exception as e:
    print(f"OPTIONAL field 'delete_all_keys_before_rotating' not found: {e}")
    delete_all_keys_before_rotating = False  # Set to false if an error occurs

# Call the right rotate function based on user parameters
if delete_all_keys_before_rotating:
    result = delete_then_rotate_user_access_key(iam_client, user_name=user_name)
else:
    result = rotate_user_access_key(iam_client, user_name=user_name)

if result:
    print("\nRotation Result:")
    print(f"New Access Key ID: {result['NewAccessKeyId']}")
    print(f"Create Date: {result['CreateDate']}")
    print(f"Deleted Access Keys: {result['DeletedAccessKeys']}")

    # Update the PAM User record in Keeper
    pam_user_to_update.custom_field('aws_access_key_id', result['NewAccessKeyId'])
    pam_user_to_update.custom_field('aws_secret_access_key', result['NewSecretAccessKey'])
    create_date_str = result['CreateDate'].isoformat() if hasattr(result['CreateDate'], 'isoformat') else str(result['CreateDate'])  # Convert the create_date to string format
    pam_user_to_update.custom_field('CreateDate', create_date_str)
    deleted_keys_str = ', '.join(result['DeletedAccessKeys'])  # Convert deleted access keys to a comma-separated string
    pam_user_to_update.custom_field('Access_Key_ID_Removed_during_previous_rotation', deleted_keys_str)
    secrets_manager.save(pam_user_to_update)

Managed Database

Rotating AWS RDS accounts with Keeper

Overview

In this section, you will learn how to rotate DB User or Admin credentials on the following AWS Managed Databases:

AWS RDS for MySQL:

AWS RDS for MySQL

AWS RDS for SQL Server:

AWS RDS for SQL Server

AWS RDS for PostgreSQL

AWS RDS for PostgreSQL

AWS RDS for MariaDB

AWS RDS for MariaDB

AWS RDS for Oracle:

AWS RDS for Oracle

If you are running a database directly on an EC2 instance in your AWS environment instead of using a managed service, refer to the Local Network > Database documentation for rotating passwords.

AWS RDS for MySQL

Rotating Admin/Regular AWS SQL Database Users with Keeper

Overview

In this guide, you'll learn how to rotate passwords for AWS MySQL Database User and Admin accounts on your AWS environment using Keeper Rotation. RDS for MySQL is an AWS managed resource where the MySQL Admin Credentials are defined in the PAM Database record type and the configurations of the MySQL 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 MySQL Database

  • Your AWS environment is configured per our documentation

1. Set up PAM Database Records

The PAM Database record contains the admin credentials and necessary configurations to connect to the MySQL RDS instance on AWS. Keeper Rotation will use these provided configurations to rotate passwords of regular database user accounts in the MySQL 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:

Field
Description

Title

Keeper record title Ex: AWS MySQL 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. 3306

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

Database ID

The AWS DB instance ID

Database Type

mysql

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:

Field
Description

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 MySQL 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:

Field
Description

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

4. Configure Rotation on the Record - AWS MySQL 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 MySQL 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.

AWS RDS for SQL Server

Rotating Admin/Regular AWS SQL Server Database Users with Keeper

Overview

In this guide, you'll learn how to rotate passwords for AWS SQL Server Database User and Admin accounts on your AWS environment using Keeper Rotation. RDS for SQL Server is an AWS managed resource where the SQL Server Admin Credentials are defined in the PAM Database record type and the configurations of the SQL Server 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 SQL Server Database

  • If the Gateway is installed on a Linux or macOS server, install the Microsoft ODBC driver

  • 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 SQL Server RDS instance on AWS. Keeper Rotation will use these provided configurations to rotate passwords of regular database user accounts in the SQL Server 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:

Field
Description

Title

Keeper record title Ex: RDS SQL Server 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. 1433

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, MS SQL server requires a database and so this will default to master.

Database ID

The AWS DB instance ID

Database Type

mssql

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:

Field
Description

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 SQL Server 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:

Field
Description

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, MS SQL server requires a database and so this will default to master.

4. Configure Rotation on the Record - AWS SQL Server 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 SQL Server 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.

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:

Field
Description

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:

Field
Description

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:

Field
Description

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.

AWS RDS for MariaDB

Rotating Admin/Regular AWS MariaDB Database Users with Keeper

Overview

In this guide, you'll learn how to rotate passwords for AWS MariaDB Database User and Admin accounts on your AWS environment using Keeper Rotation. RDS for MariaDB is an AWS managed resource where the MariaDB Admin Credentials are defined in the PAM Database record type and the configurations of the MySQL 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 MariaDB Database

  • Your AWS environment is configured per our documentation

1. Set up PAM Database Record

The PAM Database record contains the admin credentials and necessary configurations to connect to the MariaDB RDS instance on AWS. Keeper Rotation will use these provided configurations to rotate passwords of regular database user accounts in the MariaDB 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:

Field
Description

Title

Keeper record title Ex: AWS MariaDB 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. 3306

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

Database ID

The AWS DB instance ID

Database Type

mariadb

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:

Field
Description

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 MariaDB 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:

Field
Description

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

4. Configure Rotation on the Record - AWS MariaDB 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 MariaDB 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.

AWS RDS for Oracle

Rotating Admin/Regular AWS Oracle Database Users with Keeper

Overview

In this guide, you'll learn how to rotate passwords for AWS Oracle Database User and Admin accounts on your AWS environment using Keeper Rotation. RDS for Oracle is an AWS managed resource where the Oracle Admin Credentials are defined in the PAM Database record type and the configurations of the MySQL 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 Oracle 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 Oracle RDS instance on AWS. Keeper Rotation will use these provided configurations to rotate passwords of regular database user accounts in the Oracle 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:

Field
Description

Title

Keeper record title Ex: AWS Oracle 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. 1521

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.

Database ID

The AWS DB instance ID

Database Type

oracle

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:

Field
Description

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 Oracle 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:

Field
Description

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