Skip to content

Recover from SSH, Docker, and Timeout Failures

Read Error & Alert Matrix before you start.

Prerequisites

  1. Confirm shell access on the audit controller host.
  2. Collect the target key, transport flags, and stderr text.

Safety Instructions

CAUTION: Never add 2>/dev/null to diagnostic commands. Masked stderr hides TIMEOUT, MISSING_BINARY, and PERMISSION_DENIED faults.

CAUTION: Verify change approval before you start a stopped database container. An unapproved container start can disrupt cluster quorum or lock data files.

Procedure

  1. Set mode 0600 on the SSH private key (chmod 0600 ~/.ssh/id_ed25519).
  2. Test non-interactive SSH access on the target port:
ssh -o BatchMode=yes -o ConnectTimeout=10 -p 2222 -i ~/.ssh/id_ed25519 admin@192.168.1.50 true
  1. If PERMISSION_DENIED or code 126 occurs, test passwordless sudo -n:
ssh -o BatchMode=yes -p 2222 -i ~/.ssh/id_ed25519 admin@192.168.1.50 "sudo -n true"
  1. Re-run the remote SSH audit with --ssh-port, -i, and --sudo:
python3 audit_cis.py -t rhel9 -m ssh -r admin@192.168.1.50 --ssh-port 2222 -i ~/.ssh/id_ed25519 --sudo -f json -o reports/rhel9.json
  1. If Docker reports CONNECTION_ERROR, inspect container state:
docker inspect --format "{{.State.Running}} {{.State.Status}}" prod-pg17
  1. If docker inspect prints false, run docker start prod-pg17 after approval.
  2. Re-run the local or remote container audit with -c:
python3 audit_cis.py -t postgresql17 -c prod-pg17 -f json -o reports/pg17.json
python3 audit_cis.py -t postgresql17 -r admin@192.168.1.50 --ssh-port 2222 -i ~/.ssh/id_ed25519 -c prod-pg17 -f json -o reports/pg17_ssh.json
  1. If MISSING_BINARY or code 127 occurs, verify client binaries on the target:
command -v mariadb psql mongosh cqlsh

Install the missing client package on the target host or container.

  1. If TIMEOUT or code -1 occurs, inspect host load with uptime and ss -tlnp. Re-run one single target after host load drops.

NOTE: SSH drivers enforce BatchMode=yes and ConnectTimeout=10 to avoid interactive hangs.

Verification

  1. Confirm that audit_cis.py exits with code 0.
  2. Confirm zero Error entries in reports/pg17_ssh.json:
python3 -c "import json; r=json.load(open('reports/pg17_ssh.json')); rows=r['results'] if isinstance(r['results'],list) else sum(r['results'].values(),[]); assert not [x for x in rows if str(x.get('status','')).upper()=='ERROR']"
  1. Run transport and diagnostic unit tests:
python3 -m unittest tests/test_execution_drivers.py tests/test_audit_diagnostics.py -v

Rollback

  1. If maintenance policy requires a halt, stop containers started for diagnostics.
  2. Revert temporary sudoers rules or firewall overrides on the remote host.
  3. Delete temporary JSON files from reports/.
  4. Escalate persistent SSH or Docker daemon outages to platform operations.