finds.dev

dev-sec/ansible-collection-hardening

This Ansible collection provides battle tested hardening for Linux, SSH, nginx, MySQL

View on GitHubHomepage ↗

★ 5,524JinjaApache-2.0updated Nov 2026

// the take

A set of four Ansible roles (OS, SSH, nginx, MySQL) that apply hardening configurations mapped to DevSec's InSpec compliance baselines. It's for ops/infra people who want a config-as-code hardening pass across a mixed Linux fleet, rather than a security scanner or audit tool.

The hardening actually ties back to verifiable baselines (linux-baseline, ssh-baseline, mysql-baseline, nginx-baseline), so you can check compliance with InSpec after applying the role instead of just trusting the defaults. CI runs real Molecule convergence tests against VMs for each role (os_hardening_vm, ssh_hardening_vm) across a wide OS matrix — CentOS Stream, AlmaLinux, Rocky, Debian, Ubuntu, even FreeBSD/OpenBSD for SSH — so the matrix claims aren't just aspirational. argument_specs.yml on each role gives you input validation and decent IDE/ansible-doc support instead of guessing variable names from defaults/main.yml.

Coverage is narrower than the name implies: only OS, SSH, nginx, and MySQL actually work — apache_hardening and windows_hardening are explicitly called out as 'in progress, not working', and there's nothing for Postgres, Docker, or Kubernetes. The SSH and OS roles change ciphers, kex algorithms, PAM stacks, and sysctl values that can break existing automation or lock you out of a box if applied without reading the defaults first — this is not a safe blind-apply role. Minimum Ansible 2.16 will exclude anyone on an older or vendor-pinned AWX/Tower install. The standalone per-service roles were archived in favor of this collection, so if you're migrating from the old ansible-ssh-hardening etc. repos, expect some variable renaming.

We read the README, the directory tree and a key source file in November 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
5,524
Forks
839
Language
Jinja
License
Apache-2.0
Last commit
2 Nov 2026

// nearby

If ansible-collection-hardening isn't quite it.

All repos →