Security Fortress: Protecting Your Data Kingdom
The Reader's Dilemma
Dear Marilyn,I just read about another massive data breach. As a DBA, I'm terrified that I'm missing something obvious. What are the essential security measures I should implement, and how do I prioritize them?
Marilyn's Reply
Database security is like defending a castle—you need multiple layers of protection. A single wall can be breached, but an attacker facing walls, moats, guards, and locked vaults will likely give up or be caught. Let me show you how to build your fortress.
The Spark: Defense in Depth
Layer 1: Authentication
Authentication answers: "Who are you?" It's your first line of defense.
Common Authentication Mistakes:
- Using default credentials (sa/sa, root/root)
- Sharing service account passwords
- Storing passwords in connection strings
- No password rotation policy
- Allowing remote root/sa login
Best Practices:
- Use certificate-based authentication where possible
- Implement multi-factor authentication for admin access
- Use secrets management (HashiCorp Vault, AWS Secrets Manager)
- Rotate credentials automatically
- Disable or rename default accounts
Quick Check
What is the most secure way to manage database credentials for applications?
Layer 2: Authorization (RBAC)
Authorization answers: "What are you allowed to do?" Use the principle of least privilege.
| Role | Permissions | Use Case |
|---|---|---|
| read_only | SELECT | Reporting, analytics |
| app_user | SELECT, INSERT, UPDATE, DELETE | Application service accounts |
| schema_admin | + CREATE, ALTER, DROP | Migration scripts |
| dba | Full administrative access | Database administrators only |
Quick Check
What permission level should a typical application service account have?
Layer 3: Encryption
Encryption protects data even if other defenses fail. Implement it at multiple levels:
Encryption in Transit (TLS)
All connections to the database should use TLS. This prevents eavesdropping on the network. Enforce minimum TLS 1.2, preferably 1.3.
Encryption at Rest (TDE)
Transparent Data Encryption encrypts data files on disk. If someone steals the hard drive, they can't read the data without the encryption key.
Column-Level Encryption
For highly sensitive data (SSN, credit cards), encrypt specific columns. Even DBAs can't read the plaintext without the application key.
Quick Check
What does TDE (Transparent Data Encryption) protect against?
Layer 4: Auditing
You can't protect what you can't see. Comprehensive auditing catches attacks and proves compliance.
What to Audit:
- Authentication events: Successful and failed logins
- Privilege changes: GRANT, REVOKE, role modifications
- Schema changes: CREATE, ALTER, DROP statements
- Data access: SELECT on sensitive tables
- Data modifications: INSERT, UPDATE, DELETE on critical data
Quick Check
Why is it important to audit failed login attempts?
Layer 5: Network Security
Your database should never be directly accessible from the internet.
| Control | Purpose |
|---|---|
| Private Subnet | No public IP, only internal access |
| Security Groups | Allow only specific IPs/ports |
| Bastion Host | Single audited entry point for admin access |
| VPN/Private Link | Encrypted tunnel for remote access |
Quick Check
What is the purpose of a bastion host for database access?