DBSheriff connects to every database it monitors with its own service
accounts — never your application's credentials, never a shared admin
login. This page is the at-a-glance summary across all twelve engines: what
accounts DBSheriff needs, what each is for, and whether the grant is
straightforward SQL or something else (a cloud IAM role, a service
principal, a key pair). For the exact CREATE USER/GRANT statements,
follow the link to that engine's own setup guide — this page tells you
what to expect before you get there, not the copy-paste commands.
The commands on this page and in the engine guides are written as
python3 scripts/<name>.py ..., the form for a source checkout or a package
that carries the scripts/ folder. On a host installed with install.sh
the same four tools (setup_dbsheriff, create_reset_dbuser,
install_prereqs, onboard_target) run from the DBSheriff image, so there is
no scripts/ folder to find and nothing to install on the host:
sudo /opt/dbsheriff/current/deploy/onprem/stack.sh tool setup_dbsheriff postgresql db1.acme.internal
sudo /opt/dbsheriff/current/deploy/onprem/stack.sh tool create_reset_dbuser mysql prod-mysql.rds.amazonaws.com --dry-run
Everything after the tool name is the command line shown in this guide. The
tool uses your terminal (it asks questions), runs as the user who ran sudo, not
as root, and writes any file it produces (a credentials file, a generated password) to the
directory you ran it from, so run it from a directory of yours: it refuses /, and
refuses, where it can tell, a directory the user behind sudo cannot write to
(sudo -i starts in /root, which that user cannot enter) before it starts anything. It reaches the Admin Console at
http://admin-console:8502 on the stack's own network, and a database your
DBSheriff host can reach is reached from the container the same way.
setup_dbsheriff.pypython3 scripts/setup_dbsheriff.py postgresql db1.acme.internal
python3 scripts/setup_dbsheriff.py hana hana-01.acme.internal
python3 scripts/setup_dbsheriff.py snowflake myorg-myaccount
python3 scripts/setup_dbsheriff.py mongodb mongo1.acme.internal
python3 scripts/setup_dbsheriff.py redshift mycluster.abc123.us-east-1.redshift.amazonaws.com
The engine is one of postgresql, mysql, oracle, mssql, hana, snowflake,
mongodb, redshift (use mssql, not sqlserver, for SQL Server).
Covers PostgreSQL, MySQL, Oracle, SQL Server, SAP HANA, Snowflake, MongoDB
(self-managed and Atlas both) and Redshift. Checks/enables the server
prerequisites and creates all five DBSheriff roles in one run, behind a
single "proceed? [y/N]" — --roles=monitor,kill to create fewer than all
five, --optional-prereqs=pgaudit to also enable an engine's
recommended-but-not-required extras (pgaudit for PostgreSQL, the
DBSHERIFF_AUTH audit policy for HANA, Snowflake's network policy, and so
on — each engine's setup guide names its own; MongoDB's profiling prerequisite
is required, so it's already included by default, and --optional-prereqs=profile_size
adds the recommended system.profile size), --dry-run to
preview. It never restarts the database server under any circumstance; if
a restart is still needed when it finishes, it tells you the exact
command and stops there. It's a thin wrapper over the two scripts below —
same logic, same tests — for when you'd rather run one command than two.
create_reset_dbuser.pyFor nine of the twelve engines below, you don't have to run any of this by
hand at all. scripts/create_reset_dbuser.py connects to the target as
your database admin, creates or resets any of the accounts below with the
exact grants its setup guide documents, and (if the server is already
registered in the Admin Console) updates the stored credential for you:
python3 scripts/create_reset_dbuser.py postgresql db1.acme.internal
python3 scripts/create_reset_dbuser.py mysql prod-mysql.rds.amazonaws.com --dry-run
python3 scripts/create_reset_dbuser.py postgresql prod.rds.amazonaws.com --ca-file rds-global-bundle.pem
It asks which platform the target runs on (self-managed, AWS, GCP, Azure),
whether you're creating a new account or resetting an existing one, and
which account types to provision. --dry-run prints every statement it
would run without touching anything. Snowflake and MongoDB are partially
automated (Snowflake generates a key pair instead of asking for a
password, signs in as your ACCOUNTADMIN by password, key pair, single
sign-on or password with a second factor, asks which databases DBSheriff
may read and checks the new key works before it finishes: the Snowflake
setup guide lists the options; MongoDB Atlas's lock account needs a manual
one-time step the tool explains when you hit it). Databricks, BigQuery, and Cloud Spanner
have no SQL/password concept at all — the tool tells you so and points at
the setup guide.
The administrator password and every new account's password cross the scripts' connection to the target, so all four scripts (setup_dbsheriff.py, create_reset_dbuser.py, install_prereqs.py, onboard_target.py) verify the server's certificate by default (--ssl-mode verify-full):
--ca-file <bundle> names the CA that signed the server's certificate (Amazon RDS / Aurora: the RDS CA bundle for your region; Amazon Redshift, a cluster or a serverless workgroup: amazon-trust-ca-bundle.crt, https://s3.amazonaws.com/redshift-downloads/amazon-trust-ca-bundle.crt; a private or self-signed server: its CA or its own certificate). Without it the system trust store is used.--ssl-mode require encrypts without verifying (an explicit opt-down that prints a warning); --ssl-mode disable --allow-plaintext sends everything in clear text, for a trusted private link only. Oracle and self-managed MongoDB connect without TLS in the engine's default configuration: enable TLS on the listener, or use the plaintext flag over a private link.--credentials-file, default ./dbsheriff-credentials-<server>-<time>.txt) whose path is shown: move it into your password manager and delete the file.onboard_target.py reads an RDS instance's or Redshift cluster's AWS-managed master secret only when you pass --use-master-secret; otherwise it asks for a database administrator login.--client-host with the address DBSheriff connects from (onboard_target.py asks for it). When that address cannot be read the scripts stop and ask for --client-host, never creating an account for '%'.SELECT on performance_schema.threads (and on no other performance_schema table), so that DBSheriff's classification sessions can recognise their own thread; it shows that login the server's live process list. A server set up before this grant existed gets it when the reset of dbsheriff_classify is run (a reset repeats this one grant and no other server-level privilege). A server that has no such table to grant on (MariaDB) skips it with a note.[A-Za-z][A-Za-z0-9_]*; every database, schema or warehouse name the scripts discover is quoted as an identifier before it goes into a statement.setup_dbsheriff.py (pass --roles to leave it out) and is included in create_reset_dbuser.py's "all" choice: SELECT on the schemas and nothing else, the login DBSheriff's EXPLAIN of a captured statement can run under. onboard_target.py creates it only when --roles names it (for example --roles=monitor,kill,lock,posture,classify,plan).install_prereqs.pyBefore creating any accounts, the target server itself needs certain
settings in place (PostgreSQL's pg_stat_statements extension, HANA's
global_auditing_state parameter, Snowflake's network policy, MongoDB's
profiling command, Redshift's enable_user_activity_logging parameter,
and so on) — covers PostgreSQL, MySQL, Oracle, SQL Server, SAP HANA,
Snowflake, MongoDB and Redshift:
python3 scripts/install_prereqs.py postgresql db1.acme.internal
python3 scripts/install_prereqs.py hana hana-01.acme.internal
python3 scripts/install_prereqs.py snowflake myorg-myaccount
python3 scripts/install_prereqs.py mongodb mongo1.acme.internal
python3 scripts/install_prereqs.py redshift mycluster.abc123.us-east-1.redshift.amazonaws.com
The engine names are the same as for setup_dbsheriff.py above (mssql, not
sqlserver).
It checks what's already in place and, for whatever isn't, asks
apply this now? [y/N] before running anything. It never restarts (or,
for Redshift, reboots) the database server itself — some of these
settings only take effect after a restart, and the script always tells
you that up front and points at the exact restart command for your
platform, so you restart on your own schedule and re-run it afterward. On
a managed platform it detects which settings aren't reachable over a
database connection at all (Redshift's parameter isn't readable over SQL
at all, even for the master user) and prints the exact cloud CLI command
from the setup guide instead of guessing. HANA needs no restart at all for
either of its two prerequisites — both apply live. Snowflake needs no
restart at all either — its one prerequisite applies live, and it asks
for the DBSheriff host's own public IP instead of a platform choice (it's
SaaS-only, nothing to choose). MongoDB also needs no restart at all — neither
of its two prerequisites (profiling, and the recommended system.profile
size) needs one, and it asks which database you're
registering instead of a platform-specific cloud identifier (identical
question and command on self-managed and Atlas).
Across every engine that supports the full set, DBSheriff uses up to five accounts, each scoped to exactly what its job needs:
| Account | What it's for |
|---|---|
| monitor | Reads live and completed statements, session/lock state, and (where available) the audit trail — never writes anything |
| kill | Terminates or cancels a statement/session DBSheriff has decided to stop |
| lock | Deactivates a compromised account, restores it later, and runs the graduated-response ladder (throttle, revoke, disable) |
| posture | Evaluates security-configuration checks and feeds the hourly governance/compliance-evidence import — falls back to the monitor credential if you don't set up a dedicated one |
| classify | Reads column metadata and samples values so DBSheriff can find and tag sensitive data — it holds SELECT on everything it scans |
| plan (PostgreSQL, MySQL, Redshift) | The login an EXPLAIN of a captured statement can run under: SELECT on the schemas and nothing else |
Each engine's setup guide ends with a table of what each account can do if its password leaks: the lock account is data-access-equivalent on Oracle, SQL Server, MySQL, PostgreSQL and Snowflake (it can re-password or take over the accounts it locks), so create it only if you use the lock response.
Not every engine keeps all five separate — some combine kill+lock, some fold posture into monitor by convention, and a few have no SQL concept of "account" at all and use cloud IAM instead. The table below is exact per engine.
| Engine | Model | Accounts | Platform notes | Setup guide |
|---|---|---|---|---|
| PostgreSQL / Aurora PostgreSQL | Plain roles | monitor, kill, lock, posture, classify — all five, fully split | RDS/Aurora: no filesystem access for the optional server-log path (use log_fdw instead) |
Setup guide |
| MySQL / Aurora MySQL | Plain users | monitor, kill, lock, posture, classify — all five, fully split | RDS/Aurora and Azure Flexible Server: CONNECTION_ADMIN isn't grantable — kill/lock use mysql.rds_kill/rds_kill_query (RDS/Aurora) or mysql.az_kill/az_kill_query (Azure) instead |
Setup guide |
| SQL Server (self-managed, RDS, Azure SQL DB, GCP Cloud SQL) | Logins | monitor, kill, lock, posture (optional), classify | The most platform-fragmented engine here — Azure SQL Database and GCP Cloud SQL each have real structural differences; read the guide's platform sections before choosing a plan | Setup guide |
| Oracle (self-managed, RDS, GCP/Azure VM, Oracle Database Free) | Users, created inside the PDB | monitor, kill, lock, posture (optional), classify | RDS: ALTER SYSTEM and AUDIT_VIEWER aren't grantable directly — the guide has the RDS-specific substitutes; GCP/Azure are self-managed Oracle on a VM, same grants as onprem |
Setup guide |
| SAP HANA | Users, created inside the tenant DB (never SYSTEMDB) | monitor, kill, lock, posture (optional), classify | No cloud-managed variant — the same grants apply everywhere HANA runs | Setup guide |
| AWS Redshift | Plain users + RBAC roles | monitor, kill, lock, posture (optional), classify | SYSLOG ACCESS UNRESTRICTED is required on the monitor, kill, lock and posture accounts (classify and plan do not get it) or every system view silently narrows to just that account's own rows |
Setup guide |
| Snowflake | Users with key-pair auth, no passwords | monitor, kill, lock, posture, classify | MONITOR/OPERATE grants are per-warehouse and per-user — re-run the setup script whenever you add either | Setup guide |
| MongoDB (self-managed and Atlas) | Database users + custom roles | monitor, kill, lock, classify, plus dbsheriff_view_users (self-managed only) and dbsheriff_profiler (enableProfiler on the monitored database for the monitor; not on Amazon DocumentDB) |
Atlas structurally blocks direct user/role changes — real lock/unlock goes through a separate Atlas Admin API Service Account, not a database login | Setup guide |
| Google BigQuery | GCP IAM service accounts, JSON key or Workload Identity | monitor, response (kill+lock combined), posture, classify | No SQL at all — this is IAM role bindings, not CREATE USER |
Setup guide |
| Databricks | OAuth service principals | monitor, response (kill+lock combined), posture, classify | Requires Unity Catalog attached to the workspace; Community Edition can't be monitored at all | Setup guide |
| Google Cloud Spanner | GCP IAM service accounts | monitor, kill, lock, posture (optional), classify | Pure IAM — Spanner has no login/password concept whatsoever | Setup guide |
| Azure Synapse Analytics | SQL logins (dedicated pool only) | monitor, classify are grantable; kill, lock need the workspace's own SQL administrator credentials; posture is an Azure AD app registration | Serverless SQL pools aren't supported — dedicated pool only | Setup guide |
Whichever way you create them — by hand from the setup guide, or via
create_reset_dbuser.py — the username and password (or key) for each
account is what you'll enter when you register the server in the Admin
Console's Monitored Servers tab. That's the only place these credentials
get stored (encrypted at rest); nothing needs to go in a config file or
environment variable. See
first login quick start for that step.
Questions, or something in this guide doesn't match what you see: SECURITY.md
in your release package, or support@dbsheriff.ai.