Exercise 3: What host_key_checking = False Gives Up, and a Better Testing-Environment Approach — Possible Solution ==================================================================== -- What's actually being given up -- -- -- SSH host key checking is what protects the FIRST connection to any -- given host from being silently intercepted -- it's how SSH confirms -- "the server I'm connecting to is genuinely the one I expect, -- not an attacker sitting in between." Setting host_key_checking = -- False in a production ansible.cfg removes this check entirely, -- for every host, every time -- meaning a man-in-the-middle attack on -- a production connection would go completely undetected. This isn't -- a cosmetic convenience setting; it's turning off a real security -- control, applied blanket-wide to an environment where the servers -- being managed are genuinely important and not disposable. -- A better approach for the testing environment specifically -- -- -- The chapter's own warn-box frames this as a deliberate, -- per-environment decision rather than a universal default -- and -- that's exactly the fix here. Rather than disabling host key -- checking globally in a shared ansible.cfg that also governs -- production, the testing environment should use its OWN separate -- ansible.cfg (or an environment-specific override), scoped only to -- the disposable test hosts that get recreated constantly -- where -- host keys genuinely do change often enough that checking them adds -- real friction with little real security benefit, since these hosts -- aren't handling anything sensitive. Production's own ansible.cfg -- should keep host_key_checking at its default (enabled), preserving -- the real protection it provides for the environment that actually -- needs it. WHY THIS WORKS AS AN ANSWER ------------------------------ This explains the concrete security property being disabled (protection against a first-connection MITM attack) rather than a vague "it's less secure," then proposes a specific fix -- environment-scoped config rather than one shared setting -- matching the chapter's own framing of this as a deliberate per-environment tradeoff.