Database, Mail and DNS Hardening
Beyond binding and authentication: the option-file settings that limit what a compromised database credential can do, make mail and database traffic encrypted by rule, and keep DNS honest.
OpenVAPT Academy handout. Online, with the self-check quiz: https://openvapt.com/academy/p19.html. Offline: openvapt learn P19.
Read First: P8
You Will Be Able To
- Read MySQL, PostgreSQL and Redis option files and name the setting behind each finding.
- Explain why secure_file_priv, symbolic links and Redis administrative commands turn a database credential into a server compromise.
- Move PostgreSQL from md5 to SCRAM-SHA-256 without locking users out.
- Harden Postfix and Dovecot TLS, disable VRFY, and hide the BIND version while keeping DNSSEC validation on.
When a Database Credential Becomes a Shell
A database server runs as its own user with read and write access to its data folder, and sometimes more. MySQL's LOAD DATA and SELECT ... INTO OUTFILE read and write files with that access; secure_file_priv confines them to one folder or, set to NULL, disables them. With symbolic links allowed, a table can point outside the data directory. Redis CONFIG SET can change the directory and file name it saves to. That is the classic route from an exposed Redis to a cron job or an SSH key. FLUSHALL wipes every key in one command. Renaming those commands, or better an ACL that denies @dangerous for application users, limits what a stolen credential can do.
These are configuration-file signals only. OpenVAPT never connects to the database, so it cannot see anonymous users or a leftover test database; check those with the vendor's own tools under administrator credentials.
Passwords and Transport
PostgreSQL's md5 method stores a value that works as the password itself, so a copied catalog is a copied set of credentials. The password method sends the password in the clear unless the session is encrypted. SCRAM-SHA-256 fixes both and is the default since PostgreSQL 14. Migrating safely means setting password_encryption first, having every role reset its password so a SCRAM verifier exists, and only then changing the pg_hba.conf methods.
ssl = on in PostgreSQL and require_secure_transport = ON in MySQL make encryption a server rule rather than a client option. skip-name-resolve in MySQL stops grants depending on DNS answers that an attacker on the path can forge. log_error and log_connections turn silent events, including every successful login, into evidence.
Mail: Offer TLS, Require TLS, Say Nothing Extra
Postfix smtpd_tls_security_level = may with a real certificate is what other mail servers expect; none means every message arrives in the clear. The default protocol list still admits TLS 1.0 and 1.1, so set smtpd_tls_protocols and smtpd_tls_mandatory_protocols to >=TLSv1.2. disable_vrfy_command = yes stops address enumeration. Dovecot ssl = required refuses any command before TLS, which completes the plaintext-authentication control: with ssl = yes a client may still keep the whole session unencrypted.
DNS: Hide the Version, Validate the Answers
A CHAOS query for version.bind returns the exact BIND release unless options sets a version string. DNSSEC validation (dnssec-validation auto) lets a recursive resolver reject forged answers for signed zones. BIND 9.16 and newer enable it by default. An explicit no is a deliberate weakening and the one state OpenVAPT flags.
In Summary
Databases, mail and DNS fail the same way: they listen too widely, trust too much and say too much. Bind to what you need, and require strong password verifiers and TLS on the wire. Rename or restrict dangerous commands, and offer and require TLS for mail. Hide the DNS version and validate answers with DNSSEC.
Apply It
These OpenVAPT checks put this module into practice. Open one to see its detection logic and source code.
| Check | Title | Severity |
|---|---|---|
NET-DB-014 | MySQL Symbolic Links Allowed for Tables | Medium |
NET-DB-015 | MySQL secure_file_priv Not Restricted | Medium |
NET-DB-016 | MySQL Does Not Require Encrypted Client Connections | Medium |
NET-DB-017 | MySQL Error Log Not Configured | Low |
NET-DB-018 | MySQL Resolves Client Host Names | Low |
NET-DB-019 | PostgreSQL Uses md5 or password Authentication | Medium |
NET-DB-020 | PostgreSQL SSL Not Enabled | Medium |
NET-DB-021 | PostgreSQL Connection Logging Off | Low |
NET-DB-022 | PostgreSQL Password Encryption Not SCRAM | Medium |
NET-DB-023 | Redis Dangerous Commands Not Restricted | Medium |
NET-DNS-001 | BIND Version String Disclosed | Low |
NET-DNS-002 | BIND DNSSEC Validation Disabled | Medium |
NET-MAIL-001 | Postfix SMTP TLS Not Offered or Has No Certificate | Medium |
NET-MAIL-002 | Postfix Allows TLS 1.0 or 1.1 | Medium |
NET-MAIL-003 | Postfix VRFY Command Enabled | Low |
NET-MAIL-004 | Dovecot Does Not Require TLS | Medium |
Printable Worksheet · Teacher Answer Key · For Teachers · Print this page with your browser's Print command for a handout.
Also available as plain Markdown for notes, scripts and AI tools. Same facts, same source, no styling.
Lab
Run: openvapt demo --only NET-DB-,NET-MAIL-,NET-DNS- --out p16 and group the findings into three buckets: limits what a credential can do, makes transport encrypted, produces evidence.Read /etc/mysql/conf.d/hardening.cnf, the PostgreSQL files and redis.conf in the hardened lab (internal/lab/fixtures_servers_db_mail.go) and write one sentence per line on what it prevents.Write the ordered steps to move a PostgreSQL 13 cluster from md5 to scram-sha-256 without locking out the application, and say what breaks if the order is wrong.On a test resolver: dig @127.0.0.1 version.bind txt chaos +short and dig @127.0.0.1 dnssec-failed.org a ; explain what each answer shows.
Check Yourself
Answers are checked in your browser and never stored or sent.
References
- MySQL 8.4 Reference Manual, Security Guidelines
- PostgreSQL, Password Authentication
- Redis Security
- Postfix TLS Support
- Dovecot SSL/TLS Configuration
- NIST SP 800-81 Rev. 2, Secure Domain Name System Deployment Guide
- NIST SP 800-177 Rev. 1, Trustworthy Email
Adapted from the OpenVAPT Academy (openvapt.com), built by AI Cybersecurity Engineers, used under the OpenVAPT Source-Available Licence 1.3. Free teaching use under Teaching With OpenVAPT. Pre-release material may be wrong or unstable; use at your own risk.
Cite This Page
If this page helped your work, please cite it. The version and web address are filled in; the access date is today's date in your browser. Every other style, and when credit is required, is on How to Cite OpenVAPT.
OpenVAPT. (2026). P19: Database, Mail and DNS Hardening (Version 0.1.0-alpha.6). OpenVAPT Academy. Retrieved October 16, 2026, from https://openvapt.com/academy/p19.html
In text: (OpenVAPT, 2026). Accessed: the date shown is today's date from your own browser (the site's build date without JavaScript); change it to the day you read the page.
@misc{openvapt_p19,
author = {{OpenVAPT}},
title = {{P19: Database, Mail and DNS Hardening}},
year = {2026},
howpublished = {\url{https://openvapt.com/academy/p19.html}},
note = {OpenVAPT Academy, version 0.1.0-alpha.6. Accessed 16 October 2026}
}
Accessed: the date shown is today's date from your own browser (the site's build date without JavaScript); change it to the day you read the page.
Citing OpenVAPT does not mean OpenVAPT endorses, approves or has reviewed your work.