Prerequisite
- Create two users with the required permission in your PostgreSQL instance. We’ll refer to them as
user-aanduser-b. - Create another PostgreSQL user with just the permission to update the passwords of
user-aanduser-b. We’ll refer to this user as theadminuser.
How it works
- Infisical connects to your database using the provided
adminuser account. - A random value is generated and the password for
user-ais updated with the new value. - The new password is then tested by logging into the database
- If test is success, it’s saved to the output secret mappings so that rest of the system gets the newly rotated value(s).
- The process is then repeated for
user-bon the next rotation. - The cycle repeats until secret rotation is deleted/stopped.
Rotation Configuration
1
Open Secret Rotation Page
Head over to Secret Rotation configuration page of your project by clicking on
Secret Rotation in the left side bar2
Click on PostgresSQL card
3
Provide the inputs
string
required
Rotator admin username
string
required
Rotator admin password
string
required
Database host url
number
required
Database port number
string
required
The first username of two to rotate -
user-astring
required
The second username of two to rotate -
user-bstring
Optional database certificate to connect with database
4
Configure the output secret mapping
When a secret rotation is successful, the updated values needs to be saved to an existing key(s) in your project.
string
required
The environment where the rotated credentials should be mapped to.
string
required
The secret path where the rotated credentials should be mapped to.
number
required
What interval should the credentials be rotated in days.
string
required
Select an existing secret key where the rotated database username value should be saved to.
string
required
Select an existing select key where the rotated database password value should be saved to.
FAQ
Why can't we delete the other user when rotating?
Why can't we delete the other user when rotating?
When a system has multiple nodes by horizontal scaling, redeployment doesn’t happen instantly.This means that when the secrets are rotated, and the redeployment is triggered, the existing system will still be using the old credentials until the change rolls out.To avoid causing failure for them, the old credentials are not removed. Instead, in the next rotation, the previous user’s credentials are updated.
Why do you need root user account?
Why do you need root user account?
The admin account is used by Infisical to update the credentials for
user-a and user-b.You don’t need to grant all permission for your admin account but rather just the permissions to update both of the user’s passwords.