harden_bastion
Harden the sshd configuration of an Ankra-provisioned cluster's SSH bastion by applying a curated, lockout-safe action set as a revertable drop-in under /etc/ssh/sshd_config.d: disable_password_auth (also disables keyboard-interactive auth), disable_x11_forwarding, restrict_root_login (root becomes key-only), tighten_auth_limits (MaxAuthTries 3, LoginGraceTime 20, MaxStartups 10:30:200), or revert_hardening to remove the drop-in and restore the previous configuration. Omitting actions applies the full hardening set. It does NOT run arbitrary commands - only these curated actions, with every guardrail enforced server-side. The job validates the new configuration with sshd -t BEFORE activating it, rolls back automatically if validation fails, reloads (never restarts) sshd so existing sessions survive, and proves a fresh SSH connection still authenticates afterwards. The platform's own key-authenticated connection is the lockout backstop: disabling password auth cannot cut off platform access. It refuses to disable password authentication while the journal shows password logins in the last 7 days unless acknowledge_password_lockout is true - run diagnose_bastion first and confirm those consumers hold working keys. The result's report is authoritative: 'applied' true or false, 'refused' with 'refusal_reason' when a guardrail stopped it, 'validation'/'reload' when the new configuration was rejected or the reload failed, and 'fully_effective' plus 'shadowed_directives' when the drop-in is live but an earlier-matching sshd directive overrides part of it. Use this after diagnose_bastion reports password authentication enabled, sustained brute-force pressure, or MaxStartups throttling.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actions | No | Curated hardening actions to apply. Omit for the full hardening set (an empty list is rejected, never widened). revert_hardening must be the only action when used. | |
| cluster_id | No | UUID of the cluster. Optional when a cluster is selected. | |
| cluster_name | No | Exact name of the cluster. Optional when a cluster is selected. | |
| acknowledge_password_lockout | No | Set true only after confirming every consumer seen authenticating with a password holds a working SSH key; required when the journal shows password logins in the last 7 days. |