A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.hashicorp.com/vault/api-docs/secret/databases/postgresql below:

PostgreSQL - Database - Secrets Engines - HTTP API | Vault

PostgreSQL database plugin HTTP API

The PostgreSQL database plugin is one of the supported plugins for the database secrets engine. This plugin generates database credentials dynamically based on configured roles for the PostgreSQL database.

In addition to the parameters defined by the Database Backend, this plugin has a number of parameters to further configure a connection.

Method Path POST /database/config/:name Parameters Default Username Template
{{ printf "v-%s-%s-%s-%s" (.DisplayName | truncate 8) (.RoleName | truncate 8) (random 20) (unix_time) | truncate 63 }}
Example Usernames: Example DisplayName token RoleName myrolename Username v-token-myrolena-jNFRlKsZZMxJEx60o66i-1614294836 Example DisplayName amuchlonger_dispname RoleName role-name-with-dashes Username v-amuchlon-role-nam-LUHU9xqm6YNisikA3iCQ-1614294836 Sample payload with URI-format connection string
{
  "plugin_name": "postgresql-database-plugin",
  "allowed_roles": "readonly",
  "connection_url": "postgresql://{{username}}:{{password}}@localhost:5432/postgres",
  "max_open_connections": 5,
  "max_connection_lifetime": "5s",
  "username": "username",
  "password": "password"
}
Sample payload with Keyword/Value-format connection string
{
  "plugin_name": "postgresql-database-plugin",
  "allowed_roles": "readonly",
  "connection_url": "host=localhost port=5432 user={{username}} password={{password}}",
  "max_open_connections": 5,
  "max_connection_lifetime": "5s",
  "username": "username",
  "password": "password"
}
Sample request
$ curl \
    --header "X-Vault-Token: ..." \
    --request POST \
    --data @payload.json \
    http://127.0.0.1:8200/v1/database/config/postgresql
Connection strings with multiple hosts

Postgres supports multiple hosts in the connection string. An example use-case for this might be having Postgres set up with Replication Manager. However, there are some formatting rules to consider when using this feature. Please refer to the "Specifying Multiple Hosts" section of the official Postgres documentation for more information. Below are two small examples.

URI-format Multi-Host string:
{
  "connection_url": "postgresql://{{username}}:{{password}}@hostone:5432,hosttwo:5432,hostthree:9999/postgres"
}
Keyword/Value-format Multi-Host string:
{
  "connection_url": "host=hostone,hosttwo,hostthree port=5432,5432,9999 user={{username}} password={{password}} dbname=postgres"
}

Statements are configured during role creation and are used by the plugin to determine what is sent to the database on user creation, renewing, and revocation. For more information on configuring roles see the Role API in the database secrets engine docs.

Parameters

The following are the statements used by this plugin. If not mentioned in this list the plugin does not support that statement type.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4