@@ -24,9 +24,9 @@ options, including SSL options, can be found in the [pgx][pgxlib] and
24
24
25
25
## Capabilities
26
26
27
- | Plugin Name | Root Credential Rotation | Dynamic Roles | Static Roles | Username Customization |
28
- | ---------------------------- | ------------------------ | ------------- | ------------ | ---------------------- |
29
- | ` postgresql-database-plugin ` | Yes | Yes | Yes | Yes (1.7+) |
27
+ | Plugin Name | Root Credential Rotation | Dynamic Roles | Static Roles | Username Customization | Credential Types |
28
+ | ---------------------------- | ------------------------ | ------------- | ------------ | ---------------------- | ---------------------------- |
29
+ | ` postgresql-database-plugin ` | Yes | Yes | Yes | Yes (1.7+) | password, gcp_iam |
30
30
31
31
## Setup
32
32
@@ -84,6 +84,70 @@ the proper permission, it can generate credentials.
84
84
username v-vaultuse-my-role-x
85
85
```
86
86
87
+ ## Rootless Configuration and Password Rotation for Static Roles
88
+
89
+ <EnterpriseAlert product = " vault" />
90
+
91
+ The PostgreSQL secrets engine supports using Static Roles and its password rotation mechanisms with a Rootless
92
+ DB connection configuration. In this workflow, a static DB user can be onboarded onto Vault's static role rotation
93
+ mechanism without the need of privileged root accounts to configure the connection. Instead of using a single root
94
+ connection, multiple dedicated connections to the DB are made for each static role. This workflow does not support
95
+ dynamic roles/credentials.
96
+
97
+ ~ > Note: It is ** highly recommended** that the DB users being onboarded as static roles
98
+ have the minimum set of privileges. Each static role will open a new connection into the DB.
99
+ Granting minimum privileges to the DB users being onboarded ensures that multiple
100
+ highly-privileged connections to an external system are not being made.
101
+
102
+ ~ > Note: Out-of-band password rotations will cause Vault to be out of sync with the state of
103
+ the DB user, and will require manually updating the user's password in the external PostgreSQL
104
+ DB in order to resolve any errors encountered during rotation.
105
+
106
+ 1 . Enable the database secrets engine if it is not already enabled:
107
+
108
+ ``` shell-session
109
+ $ vault secrets enable database
110
+ Success! Enabled the database secrets engine at: database/
111
+ ```
112
+
113
+ By default, the secrets engine will enable at the name of the engine. To
114
+ enable the secrets engine at a different path, use the ` -path ` argument.
115
+
116
+ 1 . Configure connection to DB without root credentials and enable the rootless
117
+ workflow by setting the ` self_managed ` parameter:
118
+
119
+ ``` shell-session
120
+ $ vault write database/config/my-postgresql-database \
121
+ plugin_name="postgresql-database-plugin" \
122
+ allowed_roles="my-role" \
123
+ connection_url="postgresql://{{username}}:{{password}}@localhost:5432/database-name" \
124
+ self_managed=true
125
+ ```
126
+
127
+ 1 . Configure a static role that creates a dedicated connection to a user in the DB with
128
+ the ` self_managed_password ` parameter:
129
+
130
+ ``` shell-session
131
+ $ vault write database/static-roles/my-static-role \
132
+ db_name="my-postgresql-database" \
133
+ username="staticuser" \
134
+ self_managed_password="password" \
135
+ rotation_period="1h"
136
+ ```
137
+
138
+ 1 . Read static credentials:
139
+
140
+ ``` shell-session
141
+ $ vault read database/static-creds/static-test
142
+ Key Value
143
+ --- -----
144
+ last_vault_rotation 2024-09-11T14:15:13.764783-07:00
145
+ password XZY42BVc-UO5bMsbgxrW
146
+ rotation_period 1h
147
+ ttl 59m55s
148
+ username staticuser
149
+ ```
150
+
87
151
## Client x509 certificate authentication
88
152
89
153
This plugin supports using PostgreSQl's [ x509 Client-side Certificate Authentication] ( https://www.postgresql.org/docs/16/libpq-ssl.html#LIBPQ-SSL-CLIENTCERT ) .
0 commit comments