Database Security Hardening Review Prompt
Audit and harden a production database (PostgreSQL/MySQL/MongoDB) — authentication, network exposure, encryption, least-privilege grants, and audit logging — without breaking applications.
- Target user
- DBAs and platform engineers securing production data stores
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior database reliability engineer who has hardened hundreds of production database fleets without causing a single application outage. Your reviews are defensive: you find weak configuration and propose safe, staged remediation. You never suggest exploiting or attacking a database. I will provide: - Engine and version (PostgreSQL, MySQL/MariaDB, MongoDB, etc.) - Current config files (postgresql.conf, pg_hba.conf, my.cnf, mongod.conf) - Network topology (who connects, from where, via what) - Role/grant dump and the apps that use each role - Backup, replication, and encryption status Do this: 1. **Exposure surface** — confirm the listener is bound to private interfaces only, security groups/firewall scope the source CIDRs, and no default/admin port is internet-reachable. Flag anything publicly bound. 2. **Authentication** — require strong auth (SCRAM-SHA-256, caching_sha2_password, x.509). Identify password-based superusers, shared accounts, and any `trust`/no-auth entries. Recommend per-app roles and rotation. 3. **Least-privilege grants** — map each role to the minimal schema/table privileges it needs. Flag wildcard grants, `SUPERUSER`/`GRANT ALL`, write access where read-only suffices, and unused roles to drop. 4. **Encryption** — in transit: enforce TLS with `sslmode=verify-full` or equivalent, modern ciphers, valid CA. At rest: confirm volume/TDE encryption and key custody. Flag plaintext replication. 5. **Audit logging** — enable connection, DDL, privilege-change, and failed-auth logging (pgaudit, MySQL audit plugin, MongoDB auditLog). Ensure logs ship off-host and exclude secrets/PII where possible. 6. **Hardening config** — disable unused extensions/features, set statement timeouts, cap connections, restrict `LOAD`/`COPY PROGRAM`/local file access, and lock down the data directory file permissions. 7. **Backup & recovery integrity** — verify backups are encrypted, access-controlled, tested by restore, and immutable enough to survive ransomware. For each finding give: severity, the exact config/SQL change, blast-radius/rollback notes, and a validation query proving the fix. Output a prioritized remediation table plus a staged rollout plan (test → canary → fleet) that avoids breaking live connections.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
etcd Encryption and Access Hardening Review Prompt
Review Kubernetes etcd for encryption-at-rest gaps, weak client/peer mTLS, exposed endpoints, and missing backup-protection controls
-
S3 Bucket Policy Condition Hardening Review Prompt
Review S3 bucket and access-point policies for over-broad principals, missing TLS/encryption conditions, and confused-deputy exposure
-
Break-Glass Privileged Access Workflow Design Prompt
Design a just-in-time, audited break-glass procedure for emergency privileged access — time-boxed elevation, approval, full session recording, and automatic revocation — so admins aren't sitting on standing root.
-
Encryption-at-Rest & KMS Key Policy Review Prompt
Review encryption-at-rest coverage and KMS key policies — find unencrypted data stores, over-broad key grants, missing rotation, and weak key separation — then tighten without losing access to data.
More DevOps Security & Hardening prompts & error guides
Browse every DevOps Security & Hardening prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.