BASTIONOSDocs
bastion-os.com
EN

Connect

Databases

Your usual client - psql, mysql, DBeaver, DataGrip, mongosh, redis-cli - connects to the bastion. The bastion connects to the database with the account's secret, checks each statement and records it.

Get a connection token#

In My access, click Native client on the database's row (or open Databases and pick the account). Choose how long the token lasts: 1, 8 or 24 hours. The console shows the token once, with the command for your client.

  • The token is the password. The user name is always <you>#<account>@<asset>.
  • The connection is always encrypted between your client and the bastion.
  • Databases lists your tokens: revoke one as soon as you no longer need it.
  • A token is refused when your access ends, even before it expires.

Clients#

Database Example
PostgreSQL psql "host=bastion.example.com port=15432 user=alice#app@db-01 dbname=app sslmode=require"
MySQL, MariaDB mysql -h bastion.example.com -P 13306 -u 'alice#app@db-02' -p --ssl-mode=REQUIRED
ClickHouse through its MySQL interface, as MySQL, port 13306
MongoDB mongosh --tls --host bastion.example.com --port 17017 --authenticationMechanism PLAIN --authenticationDatabase '$external' -u 'alice#app@mongo-01' -p
Redis, Valkey redis-cli --tls -h bastion.example.com -p 16379 --user 'alice#default@cache-01' --askpass
SQL Server (Enterprise) sqlcmd -S 'tcp:bastion.example.com,11433' -U 'alice#sa@db-03'

Graphical tools (DBeaver, DataGrip, pgAdmin, MySQL Workbench, SSMS) take the same host, port, user name and token. Turn on SSL or TLS in the connection settings.

For Oracle Database, see Oracle Database. For Kubernetes, see Kubernetes.

Which database, which account#

The account decides the database role you act as: app, readonly, sa. For PostgreSQL and MySQL, the database name you give in the client is passed to the server; the account's default applies when you give none.

SQL Server accounts may also be Windows (Active Directory) accounts of the server, which the bastion signs in with on your behalf.

Statements that are refused#

Command policies apply to statements too: a DROP TABLE can be refused before the server sees it, or flagged in the audit. A refused statement returns an error to your client with the policy's name.

Accounts with data masking open from the SQL workbench only, never from a native client.

What is recorded#

Each statement, before the server receives it, and each execution of a prepared statement with its parameters. Never the results. A password written in a statement (CREATE USER ... PASSWORD '...') is recorded as ***.

© 2026 BastionOS · Source-available, self-hosted privileged access Contact