Fix: rotate root credentials for database plugins using WAL (#8782)

* fix: rotate root credentials for database plugins using WAL

* test: adds a test for WAL rollback logic

* fix: progress on wal rollback

* docs: updates some comments

* docs: updates some comments

* test: adds additional test coverage for WAL rollback

* chore: remove unneeded log

* style: error handling, imports, signature line wraps

* fix: always close db plugin connection
This commit is contained in:
Austin Gebauer
2020-04-22 16:21:28 -07:00
committed by GitHub
parent 8f834b3e76
commit 7807d451d9
9 changed files with 611 additions and 27 deletions

View File

@@ -112,7 +112,7 @@ func (p *PostgreSQL) getConnection(ctx context.Context) (*sql.DB, error) {
// Vault's storage.
func (p *PostgreSQL) SetCredentials(ctx context.Context, statements dbplugin.Statements, staticUser dbplugin.StaticUserConfig) (username, password string, err error) {
if len(statements.Rotation) == 0 {
return "", "", errors.New("empty rotation statements")
statements.Rotation = []string{defaultPostgresRotateRootCredentialsSQL}
}
username = staticUser.Username