Projects
111 · Security · Infrastructure
Server Hardening
A server hardening project in Ansible that starts by auditing the server instead of changing it.
Problem
I have one server that runs my site and my email. Most guides I read started with steps that could lock me out of it if done in the wrong order.
What I did
- Built an audit step that changes nothing by default; it only reads and writes a report.
- Made every fix, like SSH, the firewall and fail2ban, its own category; each is turned on one at a time and can be dry-run first.
- Wrote a rollback playbook that backs up the original files before any change and can restore all of them.
Flow
- Audit
- Plan
- Apply one category
- Verify
- Roll back
Result
After an SSH change, a new connection is opened to check that login still works; the firewall won't close a running service without approval. CI applies everything twice and fails if the second run changes anything.