From c8422fa10f8444ddc11ceb5a7366513ec6f77f32 Mon Sep 17 00:00:00 2001 From: Peter Spark Date: Sun, 5 Apr 2026 19:27:40 +0000 Subject: [PATCH] docs(devops): runbook and verify script for Importer SSH (BIT-1044) Add operational checklist for Paperclip host to WDMI Importer (192.168.1.123): network prerequisites, authorized_keys for paperclip@bitreport-cto, Proxmox alternative path, and an executable acceptance script. Cross-link from RUNBOOK_REPORTER_WDMI_CACHE_MKDIR.md. Paperclip-Issue: BIT-1044 Paperclip-Run: b99b90b0-311f-442e-82ce-5c8644abffb1 --- docs/RUNBOOK_DEVOPS_IMPORTER_SSH_BIT1044.md | 70 +++++++++++++++++++ docs/RUNBOOK_REPORTER_WDMI_CACHE_MKDIR.md | 1 + scripts/devops/verify_importer_ssh_bit1044.sh | 41 +++++++++++ 3 files changed, 112 insertions(+) create mode 100644 docs/RUNBOOK_DEVOPS_IMPORTER_SSH_BIT1044.md create mode 100755 scripts/devops/verify_importer_ssh_bit1044.sh diff --git a/docs/RUNBOOK_DEVOPS_IMPORTER_SSH_BIT1044.md b/docs/RUNBOOK_DEVOPS_IMPORTER_SSH_BIT1044.md new file mode 100644 index 0000000..b99e541 --- /dev/null +++ b/docs/RUNBOOK_DEVOPS_IMPORTER_SSH_BIT1044.md @@ -0,0 +1,70 @@ +# DevOps runbook — SSH from Paperclip host to WDMI Importer (BIT-1044) + +**Issue:** [BIT-1044](/BIT/issues/BIT-1044) +**Unblocks:** [BIT-1041](/BIT/issues/BIT-1041) (Importer maintenance scripts on the production guest, not in `WDMI_UBUNTU` git). + +## Goal + +From the Paperclip execution host (**`10.10.50.17`**, user **`paperclip`**), run: + +```bash +ssh -o BatchMode=yes -o ConnectTimeout=10 root@192.168.1.123 echo ok +``` + +Expected stdout: `ok` (no password prompt). + +Canonical Importer LAN IP and deploy path: [WDMI deploy runbook](https://git.bitreport.pt/BitReport.pt/paperclip/src/branch/main/docs/WDMI_DEPLOY_RUNBOOK.md) §2. + +## Prerequisites (network) + +The host has **dual homing**: VLAN **1050** (`10.10.50.17`) and LAN **`192.168.1.0/24`** (`192.168.1.239` on `eth1`). Traffic to **`192.168.1.123`** must leave via **`eth1`** with working L2/L3 to the Importer. + +**Typical failure (pre-fix):** `ip neigh show 192.168.1.123` stays **`INCOMPLETE`** / **`FAILED`**; `ping` loss; SSH **`No route to host`**. + +**Operator actions (edge firewall / switch / guest):** + +1. Confirm **`192.168.1.123`** is the live Importer address (vault / inventory). +2. Allow **TCP/22** from at least: + - **`192.168.1.239`** (Paperclip `eth1`), and + - **`192.168.1.17`** (CT 220 `wdmi-store` `eth1`, if CTO uses that hop). +3. Ensure the Importer OS is up, `sshd` listening on **`:22`**, and no host firewall drops those sources. + +## SSH key (Paperclip → `root` on Importer) + +Use the same **Ed25519** public key as [BIT-720](/BIT/issues/BIT-720) / [BIT-721](/BIT/issues/BIT-721) (`paperclip@bitreport-cto`): + +On **`10.10.50.17`** as **`paperclip`**: + +```bash +cat ~/.ssh/id_ed25519.pub +``` + +On **`192.168.1.123`** as a user with privilege to edit **`root`** keys (console, IPMI, or existing SSH): + +```bash +install -d -m 700 /root/.ssh +touch /root/.ssh/authorized_keys +chmod 600 /root/.ssh/authorized_keys +grep -qF '' /root/.ssh/authorized_keys || echo '' >> /root/.ssh/authorized_keys +``` + +**Do not** commit private keys or paste them into issues. + +## Alternative path (Proxmox guest) + +If the Importer is an LXC/VM on **node9** and LAN routing cannot be fixed quickly, **`root`** on the Paperclip host may use **`pct`** via **`ssh root@192.168.1.9`** after one-time trust — see Paperclip meta-repo `docs/runbooks/AUTOMATION_PAPERCLIP_HOST_NODE9.md` and `tools/proxmox/push_pubkey_to_lxc_via_node9.sh` (workstation or **`root`** on **10.10.50.17** with node9 key). The unprivileged **`paperclip`** account does not perform that hop unless explicitly configured. + +## Verification (automation-friendly) + +From the **`errors.bitreport.pt`** repo on a machine that should have access (normally **10.10.50.17**): + +```bash +./scripts/devops/verify_importer_ssh_bit1044.sh +``` + +Exit code **0** only when the BatchMode SSH check succeeds. + +## Related hub docs + +- [RUNBOOK_REPORTER_WDMI_CACHE_MKDIR.md](RUNBOOK_REPORTER_WDMI_CACHE_MKDIR.md) — Importer reachability note for runners. +- [RUNBOOK_REPORTER_WDMI_FLEXIT_XML.md](RUNBOOK_REPORTER_WDMI_FLEXIT_XML.md) — Importer deploy references. diff --git a/docs/RUNBOOK_REPORTER_WDMI_CACHE_MKDIR.md b/docs/RUNBOOK_REPORTER_WDMI_CACHE_MKDIR.md index 84a8055..f7e139c 100644 --- a/docs/RUNBOOK_REPORTER_WDMI_CACHE_MKDIR.md +++ b/docs/RUNBOOK_REPORTER_WDMI_CACHE_MKDIR.md @@ -104,6 +104,7 @@ Opcional — hub sem incidentes abertos para o cluster: ## Ver também +- [RUNBOOK_DEVOPS_IMPORTER_SSH_BIT1044.md](RUNBOOK_DEVOPS_IMPORTER_SSH_BIT1044.md) — rede + SSH Paperclip → Importer **192.168.1.123** ([BIT-1044](/BIT/issues/BIT-1044)). - [RUNBOOK_TRIAGE.md](RUNBOOK_TRIAGE.md) — triagem e fecho no hub. - [RUNBOOK_REPORTER_WDMI_FEED_UPLOAD.md](RUNBOOK_REPORTER_WDMI_FEED_UPLOAD.md) — upload de feeds (`clients.wdmi.pt`). - [RUNBOOK_OPERATIONS.md](RUNBOOK_OPERATIONS.md) — cenários CLI. diff --git a/scripts/devops/verify_importer_ssh_bit1044.sh b/scripts/devops/verify_importer_ssh_bit1044.sh new file mode 100755 index 0000000..6be7409 --- /dev/null +++ b/scripts/devops/verify_importer_ssh_bit1044.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Acceptance check for BIT-1044: BatchMode SSH from this host to WDMI Importer (LAN). +# See docs/RUNBOOK_DEVOPS_IMPORTER_SSH_BIT1044.md +# +# Usage: +# ./scripts/devops/verify_importer_ssh_bit1044.sh +# IMPORTER_HOST=192.168.1.123 SSH_USER=root ./scripts/devops/verify_importer_ssh_bit1044.sh +# ./scripts/devops/verify_importer_ssh_bit1044.sh --diagnose # print route/neigh/ping, then SSH; exit code from SSH only +set -euo pipefail + +readonly IMPORTER_HOST="${IMPORTER_HOST:-192.168.1.123}" +readonly SSH_USER="${SSH_USER:-root}" +readonly CONNECT_TIMEOUT="${SSH_CONNECT_TIMEOUT:-10}" + +_diagnose=0 +if [[ "${1:-}" == "--diagnose" ]]; then + _diagnose=1 +fi + +if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then + sed -n '1,20p' "$0" + exit 0 +fi + +if [[ -n "${1:-}" && "${1}" != "--diagnose" ]]; then + echo "unknown argument: $1 (use --diagnose or no args)" >&2 + exit 2 +fi + +if ((_diagnose)); then + echo "verify_importer_ssh_bit1044: route to ${IMPORTER_HOST}" + ip route get "${IMPORTER_HOST}" 2>/dev/null || true + echo "verify_importer_ssh_bit1044: neighbour ${IMPORTER_HOST}" + ip neigh show "${IMPORTER_HOST}" 2>/dev/null || true + echo "verify_importer_ssh_bit1044: ping (2 probes, 2s max wait)" + ping -c 2 -W 2 "${IMPORTER_HOST}" 2>&1 || true +fi + +echo "verify_importer_ssh_bit1044: ssh BatchMode ${SSH_USER}@${IMPORTER_HOST} echo ok" +exec ssh -o BatchMode=yes -o ConnectTimeout="${CONNECT_TIMEOUT}" -o StrictHostKeyChecking=accept-new \ + "${SSH_USER}@${IMPORTER_HOST}" echo ok