The devsec.hardening collection supplies Ansible roles to harden Linux, OpenSSH, MySQL, and nginx hosts against common misconfigurations.
Overview
devsec.hardening is an Ansible Galaxy collection that packages battle-tested hardening roles for operating systems and daemons. Supported Linux targets include Debian, Ubuntu, AlmaLinux, Rocky, CentOS Stream, and several others depending on the role.
Roles cover OS baseline settings, SSH configuration, MySQL or MariaDB, and nginx. Settings aim to align with InSpec DevSec baselines used for compliance checking.
Install via ansible-galaxy collection install devsec.hardening, then apply roles from playbooks following each role's examples. Apache and Windows hardening roles are marked in progress.
The collection supersedes older standalone dev-sec roles that were split into archives.
Key features
- oshardening role for Linux baselines
- sshhardening for OpenSSH settings
- mysqlhardening for database servers
- nginxhardening for web servers
- Galaxy collection packaging
- Inspec DevSec baseline alignment
Use cases
- OS hardening via Ansible
- Locking down SSH in automated deployments
- Securing MySQL or nginx before production cutover