ProficientNowTechRFCs

7. Database Access

RFC-PAM-0001                                                    Section 7
Category: Standards Track                                Database Access

7. Database Access

← Previous: SSH Access | Index | Next: Kubernetes Governance →


7.1 Dynamic Credential Model

7.1.1 Overview

Database access uses dynamic credentials generated on-demand by Vault. Each session receives unique, short-lived credentials that are automatically revoked at expiry.

7.1.2 Static vs Dynamic Credentials

AspectStatic CredentialsDynamic Credentials
LifetimeIndefiniteTime-limited (TTL)
UniquenessShared across sessionsUnique per session
RevocationManual password changeAutomatic at expiry
AccountabilityDifficult to attributeIndividual session attribution
RotationDisruptive, coordinatedContinuous, automatic

7.1.3 Credential Properties

Dynamic credentials have these properties:

PropertyValueRationale
Unique usernameGenerated per sessionIndividual accountability
Random passwordCryptographically randomNo credential reuse
TTL1-4 hoursLimit exposure window
Auto-revocationAt TTL expiryNo stale credentials
RenewabilityWithin max TTLSupport long sessions

7.2 Vault Database Engine Integration

7.2.1 Database Secrets Engine

Vault's database secrets engine manages dynamic credentials:

7.2.2 Database Connections

Vault maintains administrative connections to managed databases:

ConnectionDatabase TypePurpose
postgres-prodPostgreSQLProduction database
postgres-stagingPostgreSQLStaging database
mysql-analyticsMySQLAnalytics database
mongo-appMongoDBApplication database

7.2.3 Connection Configuration

Each connection specifies:

ParameterDescription
plugin_nameDatabase plugin (e.g., postgresql-database-plugin)
connection_urlDatabase connection string
allowed_rolesWhich Vault roles can use this connection
usernameVault's administrative username
passwordVault's administrative password (stored in Vault)

7.2.4 Dynamic Roles

Vault defines roles that specify credential properties:

RoleDatabasePermissionsTTLMax TTL
postgres-readonlypostgres-prodSELECT1h4h
postgres-readwritepostgres-prodSELECT, INSERT, UPDATE, DELETE2h4h
postgres-adminpostgres-prodALL PRIVILEGES30m1h
mysql-readonlymysql-analyticsSELECT1h4h

7.3 Supported Database Protocols

7.3.1 Protocol Support Matrix

DatabaseProtocolPortQuery LoggingConnection Pooling
PostgreSQLPostgreSQL wire protocol5432Full SQLYes
MySQLMySQL wire protocol3306Full SQLYes
MariaDBMySQL wire protocol3306Full SQLYes
MongoDBMongoDB wire protocol27017CommandsYes
RedisRESP protocol6379CommandsYes
SQL ServerTDS protocol1433Full SQLYes
OracleOracle Net1521LimitedYes

7.3.2 Teleport Database Agent

The Database Agent handles protocol-specific proxying:

7.3.3 Client Compatibility

Users connect using standard database clients:

DatabaseSupported Clients
PostgreSQLpsql, pgAdmin, DBeaver, any JDBC/ODBC client
MySQLmysql, MySQL Workbench, DBeaver
MongoDBmongosh, MongoDB Compass
Redisredis-cli, RedisInsight

7.4 Credential Lifecycle

7.4.1 Complete Lifecycle

7.4.2 Credential States

StateDescriptionDuration
RequestedUser requests database accessMilliseconds
ActiveCredentials valid, session usableTTL (e.g., 1 hour)
RenewedTTL extendedUntil max TTL
ExpiredTTL reached, credentials revokedPermanent
RevokedManually or on disconnectPermanent

7.4.3 Renewal

Sessions can be renewed within the max TTL:

ScenarioRenewal Behavior
Active session, TTL approachingAuto-renew if configured
User requests renewalExtend TTL up to max
Max TTL reachedMust disconnect and reconnect

7.5 Query Logging

7.5.1 Logging Scope

All database queries are logged:

DatabaseLogging Detail
PostgreSQLFull SQL statements
MySQLFull SQL statements
MongoDBCommand documents
RedisAll commands

7.5.2 Log Content

Each query log entry includes:

FieldDescriptionExample
TimestampWhen query executed2026-02-10T14:30:22Z
UserTeleport user (not DB user)jane.doe
DatabaseTarget databasepostgres-prod
QuerySQL/command textSELECT * FROM users
DurationExecution time42ms
RowsRows affected/returned156

7.5.3 Sensitive Data Handling

Query logging has configurable redaction:

OptionBehavior
Full loggingAll query text captured
Parameter redactionBind parameters redacted
Query hash onlyOnly query fingerprint stored
DisabledNo query logging (audit metadata only)

Default: Full logging with parameter redaction for sensitive databases.

7.6 Access Control

7.6.1 RBAC for Databases

Teleport roles define database access:

RoleDatabasesVault RolePermissions
developerpostgres-stagingpostgres-readonlySELECT
data-analystmysql-analyticsmysql-readonlySELECT
dba-oncallAll databasespostgres-adminALL
sre-oncallProduction databasespostgres-readwriteDML

7.6.2 Label-Based Access

Databases are labeled similar to SSH hosts:

LabelValuesPurpose
envproduction, stagingEnvironment access
teamplatform, analyticsTeam ownership
sensitivitypublic, confidential, restrictedData classification

7.6.3 Example Role Definition

A data-analyst role might allow:

Role: data-analyst
  Allow:
    - Database labels: team=analytics AND sensitivity!=restricted
    - Database roles: readonly
  Deny:
    - Database labels: env=production AND sensitivity=restricted

7.7 Separation from Service Access

7.7.1 Human vs Service Access

AspectHuman Access (RFC-PAM)Service Access (RFC-WORKLOAD-IDENTITY)
IdentityKeycloak userKubernetes ServiceAccount
CredentialsTeleport + Vault dynamicVault dynamic directly
Query loggingRequiredOptional (application logs)
Session recordingRequiredNot applicable
Access brokerTeleportDirect to Vault

7.7.2 Why Separate?

Services accessing databases do not require:

  • Interactive session recording (no human session)
  • Query attribution to human identity (application context suffices)
  • JIT approval workflows (pre-authorized via policy)

Services use Vault directly via Kubernetes auth, as defined in RFC-WORKLOAD-IDENTITY.


Document Navigation


End of Section 7