Skip to content

maxwellokumu/okaudit-claude-skills / hardware-physical/hardware-physical-playbook

hardware-physical-playbook

Verified

Guide Claude through a structured hardware and physical security audit covering inventory, access control, firmware posture, environmental controls, and reporting.

FileKindSize
README.mdmarkdown635 B
SKILL.mdskill md1.6 KB
main.pyscript11.2 KB
skill.yamlconfig691 B
"""Hardware & Physical Security Audit Playbook.

Outputs a structured step-by-step guide for conducting a hardware and
physical security audit, covering asset reconciliation, access review,
firmware patching, environmental controls, and remediation reporting.
"""

import argparse
import sys
from typing import Dict, List

STEPS: Dict[int, Dict] = {
    1: {
        "title": "Asset Inventory & Reconciliation",
        "objective": (
            "Establish a complete, accurate record of all hardware assets and reconcile "
            "the authorised inventory against devices observed on the network and physical premises."
        ),
        "artefacts": [
            "CMDB or asset register export (CSV)",
            "Network scan results (Nmap, Nessus, or SCCM discovery output)",
            "Physical walkthrough checklist signed by facilities",
            "Asset Validation Report (generated by asset-validator)",
        ],
        "tools_commands": [
            "python asset-validator/main.py --inventory inventory.csv --discovered discovered.csv",
            "nmap -sn 10.0.0.0/8 -oG - | awk '/Up$/{print $2}' > discovered_ips.txt",
            "python asset-validator/main.py --inventory inventory.csv --discovered discovered.csv --output json > asset_report.json",
        ],
        "must_do_checks": [
            "Verify asset_id and hostname match between CMDB and network scan",
            "Investigate ALL rogue (undiscovered) assets — escalate Critical/High risk immediately",
            "Reconcile ghost assets: confirm decommission, update CMDB, or re-scan",
            "Confirm physical walkthrough matches both inventory and discovered lists",
            "Check for assets in DMZ, OT/ICS networks, and branch offices separately",
            "Verify asset owner and last-seen date currency (flag anything >90 days stale)",
        ],
        "linked_skills": ["hardware-physical/asset-validator"],
    },
    2: {
        "title": "Physical Access Review",
        "objective": (
            "Audit all physical access control events to identify after-hours access, "
            "failed attempt patterns, tailgating, forced entries, and role-based access violations."
        ),
        "artefacts": [
            "Badge access system logs (90-day minimum, CSV export)",
            "Role and door permission matrix (roles.json)",
            "CCTV footage index for flagged events",
            "Physical Access Audit Report (generated by physical-access-review)",
        ],
        "tools_commands": [
            "python physical-access-review/main.py --logs badge_logs.csv --roles roles.json",
            "python physical-access-review/main.py --logs badge_logs.csv --roles roles.json --hours 08:00-18:00 --failed-threshold 5",
        ],
        "must_do_checks": [
            "Obtain minimum 90 days of badge logs; 12 months preferred",
            "Cross-reference all TAILGATE and FORCED events with CCTV footage",
            "Verify that leaver accounts are deprovisioned within 24 hours of departure",
            "Confirm server room and data centre access is restricted to authorised roles only",
            "Check that visitor badges are time-limited and logged",
            "Review privileged area access (DC, comms rooms, MDF/IDFs) against HR records",
            "Confirm no shared badge IDs in use",
        ],
        "linked_skills": ["hardware-physical/physical-access-review"],
    },
    3: {
        "title": "Firmware & Patch Status",
        "objective": (
            "Identify all network-connected devices running firmware versions with known CVEs "
            "and prioritise remediation based on severity and exploitability."
        ),
        "artefacts": [
            "Device inventory with firmware versions (CSV)",
            "Vendor security advisories and CVE feeds",
            "Firmware Vulnerability Report (generated by firmware-checker)",
            "Patch schedule and change management tickets",
        ],
        "tools_commands": [
            "python firmware-checker/main.py --devices devices.csv",
            "python firmware-checker/main.py --devices devices.csv --cve-db custom_cves.csv",
        ],
        "must_do_checks": [
            "Run firmware-checker against ALL network devices including OT/ICS and IoT",
            "Escalate Critical CVEs for emergency patching within 24–72 hours",
            "Confirm patch testing process exists before production deployment",
            "Check end-of-life (EOL) status for all device models — EOL = automatic Critical finding",
            "Verify firmware update integrity (checksums/signatures) before deployment",
            "Confirm automated firmware update capability is disabled on critical infrastructure",
            "Document exceptions with risk acceptance sign-off for unpatched devices",
        ],
        "linked_skills": ["hardware-physical/firmware-checker"],
    },
    4: {
        "title": "Environmental Controls Assessment",
        "objective": (
            "Evaluate physical environmental safeguards in data centres and server rooms including "
            "power, cooling, fire suppression, water detection, and physical perimeter controls."
        ),
        "artefacts": [
            "Data centre environmental monitoring system reports",
            "UPS test logs and battery replacement records",
            "HVAC maintenance and temperature/humidity logs",
            "Fire suppression system inspection certificates",
            "Physical perimeter inspection checklist",
        ],
        "tools_commands": [
            "# Review environmental sensor data from DCIM system",
            "# Export temperature/humidity logs: dcim_export --range 90d --format csv > env_logs.csv",
            "# Check UPS runtime capacity: check-ups-runtime --threshold 30min",
        ],
        "must_do_checks": [
            "Confirm temperature maintained between 18–27°C and humidity 40–60% (ASHRAE A1)",
            "Verify UPS provides minimum 30-minute runtime for graceful shutdown",
            "Check that generator auto-start is tested quarterly under full load",
            "Confirm redundant cooling (N+1 minimum) is operational in all DC zones",
            "Verify fire suppression (FM-200, Novec, or inert gas) is tested annually",
            "Check water/leak detection sensors are positioned under raised floors and near CRAC units",
            "Confirm CCTV coverage is 100% at entry/exit points and server cage perimeters",
            "Verify mantrap/airlock is operational at DC entry and exit",
            "Check that physical security reviews occur at least annually",
        ],
        "linked_skills": [],
    },
    5: {
        "title": "Reporting & Remediation",
        "objective": (
            "Consolidate findings from all hardware and physical audit steps into a prioritised "
            "remediation plan and executive-ready report."
        ),
        "artefacts": [
            "Asset Validation Report (from Step 1)",
            "Physical Access Audit Report (from Step 2)",
            "Firmware Vulnerability Report (from Step 3)",
            "Environmental Controls Assessment checklist (from Step 4)",
            "Final Hardware & Physical Audit Report with risk register",
            "Remediation tracking spreadsheet with owners and due dates",
        ],
        "tools_commands": [
            "python asset-validator/main.py --inventory inventory.csv --discovered discovered.csv --output json > asset_findings.json",
            "python firmware-checker/main.py --devices devices.csv > firmware_findings.md",
            "python physical-access-review/main.py --logs badge_logs.csv --roles roles.json > access_findings.md",
            "# Combine into exec summary: python ../../lead-it-auditor/exec-summary-writer/main.py --findings combined_findings.json",
        ],
        "must_do_checks": [
            "Assign a risk rating (Critical/High/Medium/Low) to each finding",
            "Map each finding to a control framework (ISO 27001 A.11, CIS Controls 1-2)",
            "Set remediation deadlines: Critical=7 days, High=30 days, Medium=90 days, Low=180 days",
            "Obtain management sign-off on the risk register",
            "Schedule follow-up verification for all Critical and High findings",
            "Include positive findings (controls working well) in the executive summary",
            "Archive all artefacts with version control and access logging",
        ],
        "linked_skills": [
            "hardware-physical/asset-validator",
            "hardware-physical/firmware-checker",
            "hardware-physical/physical-access-review",
            "lead-it-auditor/exec-summary-writer",
        ],
    },
}


def render_step(step_num: int, step: Dict) -> str:
    """Render a single playbook step as Markdown.

    Args:
        step_num: Step number.
        step: Step data dictionary.

    Returns:
        Markdown string for the step.
    """
    lines: List[str] = []
    lines.append(f"## Step {step_num}: {step['title']}\n")
    lines.append(f"**Objective:** {step['objective']}\n")

    lines.append("### Artefacts to Collect\n")
    for a in step["artefacts"]:
        lines.append(f"- {a}")

    lines.append("\n### Tools & Commands\n")
    lines.append("```bash")
    for cmd in step["tools_commands"]:
        lines.append(cmd)
    lines.append("```")

    lines.append("\n### Must-Do Checks\n")
    for i, check in enumerate(step["must_do_checks"], start=1):
        lines.append(f"{i}. {check}")

    if step["linked_skills"]:
        lines.append("\n### Linked Skills\n")
        for skill in step["linked_skills"]:
            lines.append(f"- `{skill}`")

    return "\n".join(lines)


def parse_args() -> argparse.Namespace:
    """Parse CLI arguments."""
    parser = argparse.ArgumentParser(
        description="Hardware & Physical Security Audit Playbook"
    )
    parser.add_argument(
        "--step",
        default="full",
        help="Step number (1-5) or 'full' to display all steps (default: full)",
    )
    return parser.parse_args()


def main() -> None:
    """Main entry point."""
    args = parse_args()

    lines: List[str] = []
    lines.append("# Hardware & Physical Security Audit Playbook\n")
    lines.append(
        "A structured guide for auditing hardware assets, physical access controls, "
        "firmware patch status, and environmental safeguards.\n"
    )
    lines.append("| Step | Title |")
    lines.append("|------|-------|")
    for num, step in STEPS.items():
        lines.append(f"| {num} | {step['title']} |")

    if args.step == "full":
        lines.append("")
        for num, step in STEPS.items():
            lines.append("")
            lines.append(render_step(num, step))
    else:
        try:
            step_num = int(args.step)
        except ValueError:
            print(
                f"ERROR: --step must be an integer 1-5 or 'full', got '{args.step}'",
                file=sys.stderr,
            )
            sys.exit(1)
        if step_num not in STEPS:
            print(
                f"ERROR: Step {step_num} does not exist. Valid steps: 1-5.",
                file=sys.stderr,
            )
            sys.exit(1)
        lines.append("")
        lines.append(render_step(step_num, STEPS[step_num]))

    print("\n".join(lines))


if __name__ == "__main__":
    main()
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall