Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions osism/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ def run_ansible_in_environment(
# This ensures Ansible's Python process flushes stdout immediately
env["PYTHONUNBUFFERED"] = "1"

# Disable SSH host key checking to prevent intermittent "Host key verification
# failed" errors. With high fork counts (e.g. 50), multiple SSH processes within
# a single ansible-playbook run read/write the shared known_hosts file
# simultaneously, causing race conditions and file corruption.
env["ANSIBLE_HOST_KEY_CHECKING"] = "False"
Comment on lines +180 to +184
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): Disabling SSH host key checking globally has significant security implications.

Unconditionally setting ANSIBLE_HOST_KEY_CHECKING to False disables host key pinning for all Ansible SSH connections from this helper, enabling possible MITM and misbinding to the wrong host, particularly in shared environments. Please make this opt‑in (e.g., via a parameter or config flag) with a secure default, or strictly scope the override to known-safe environments where the risk is explicitly accepted.


# Use a unique SSH ControlPath directory per task to prevent race conditions
# when multiple Celery workers connect to the same host simultaneously.
# Without this, concurrent Ansible runs share the same ControlMaster socket,
Expand Down