Skip to content

Compliance & hardening

Netpilot can audit a device’s running-config against a security hardening baseline and produce a scored deviation report. For network gear there is no OpenSCAP/CIS-CAT equivalent, so Netpilot’s YAML baseline engine is the assessor: you upload a config, it checks every control, and tells you exactly what is non-compliant and how to fix it.

  1. Back up the device (or drop a .cfg into the backup directory).
  2. Run the compliance check against a vendor baseline.
  3. Review the deviation report (CSV, or a formatted Excel checklist).
  4. Remediate — each failed control ships the exact config to apply.
Terminal window
python -m src --baseline nexus

This loads config/compliance/baselines/nexus.yml, finds the latest backup for each device, evaluates every check, and writes SUMMARY/YYYY-MM/COMPLIANCE_timestamp.csv.

A baseline is a YAML file at config/compliance/baselines/<name>.yml. The file name is the value you pass to --baseline. Each baseline is one vendor’s hardening standard expressed as machine-checkable controls.

name: Cisco NX-OS Hardening (SSOE2 v2.0)
categories:
- name: Access Control
checks:
- id: NX-4.3.7
name: Telnet feature disabled
expect: 'feature telnet'
expect_type: not_exists
severity: critical
ref: SSOE2 4.3.7
rationale: Telnet is clear-text; credentials are interceptable.
remediation: |
no feature telnet
FieldRequiredPurpose
idyesControl ID, traceable to the benchmark clause
nameyesShort control title
expectyesConfig pattern to match
expect_typeyesregex, exists, or not_exists
severityyescritical / high / medium / low
applies_ifnoGuard pattern — see Not Applicable
refnoCIS / standard clause reference
rationalenoWhy the control exists (shown in reports)
remediationnoExact config to apply the fix (push-ready)

The engine reads id/name/expect/expect_type/severity/applies_if. ref, rationale, and remediation are surfaced by the Excel report.

expect_typeCompliant when
regexthe pattern matches a line (multiline, case-insensitive)
existsthe literal string is present
not_existsthe literal string is absent (use for prohibited config)

Absence in a config does not always mean non-compliance. A control for a feature the device does not run (EIGRP auth on a switch with no EIGRP) should be Not Applicable, not a failure.

Add applies_if with a guard pattern: the check only runs when the feature is present. Otherwise it is marked N/A and excluded from the score.

- id: NX-4.15.2
name: OSPF authentication configured
applies_if: '^feature ospf' # only check if OSPF is enabled
expect: 'ip ospf authentication'
expect_type: regex
severity: high

For an auditor-ready checklist (one row per control, colour-coded result, rationale, and remediation), generate an Excel workbook:

Terminal window
python scripts/compliance_to_excel.py \
--config config/compliance/pdf/DEVICE.cfg \
--baseline nexus \
--pdf "config/compliance/pdf/Benchmark.pdf"

The workbook mirrors the benchmark checklist columns, auto-fills the Deviation (Y/N/NA) column from the live result, and includes a Remediation column on every failed control. Pass the --pdf to also emit reference rows for benchmark items that are reviewed manually.

ResultMeaning
PASSControl satisfied
FAILDeviation — apply the remediation
N/AFeature not in use, excluded from score

Netpilot’s engine is vendor-agnostic — adding a vendor is just authoring its baseline:

  1. Obtain the vendor’s hardening benchmark (CIS, vendor guide, or internal SOP).
  2. Create config/compliance/baselines/<vendor>.yml following the schema above.
  3. Calibrate the expect patterns against one known-good config for that vendor — inferred regexes need validation against real output.
  4. Add applies_if guards to any feature-conditional controls.
  5. Run python -m src --baseline <vendor> and confirm the score is sane.