Communitygithub.com

Netzwerk-Konfigurationsvalidierung

Überprüfungen vor dem Deployment von Router- und Switch-Konfigurationen, inklusive gefährlicher Befehle, doppelter Adressen, Subnetz-Überlappungen, veralteter Referenzen, Management-Ebene-Risiken und IOS-Sicherheitshygiene. Verwenden Sie diese Überprüfung, bevor Sie eine Router- oder Switch-Konfiguration deployen.

Was ist Netzwerk-Konfigurationsvalidierung?

Dieser Skill dient der validierenden Überprüfung von Netzwerkkonfigurationen (z.B. Cisco IOS/IOS-XE) vor einem Change-Fenster oder vor der Produktionsberührung durch Automatisierung. Er führt eine geschichtete Analyse durch: Erkennung destruktiver Befehle (reload, erase, format), Überprüfung auf doppelte IP-Adressen und Subnetz-Überlappungen, Analyse der Management-Ebene (VTY-Blöcke auf Telnet, fehlende Access-Class und exec-timeout) sowie Sicherheits- und Best-Practice-Checks (z.B. SNMP-Community-Strings, SSH-Version, enable secret). Die Implementierung erfolgt als Python-Code mit regulären Ausdrücken und ipaddress-Bibliothek – sie ist kein vollständiger Parser, sondern liefert schnelle Preflight-Warnungen. Der Skill ist für Ingenieure gedacht, die manuelle oder automatisierte Konfigurationsprüfungen durchführen, und unterstützt Plattformen wie Cisco IOS, IOS-XE und generische router/switch-Konfigurationen.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/network-config-validation

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Was macht Netzwerk-Konfigurationsvalidierung?

Verwenden Sie diesen Skill, um die Netzwerkkonfiguration vor einem Change-Fenster oder bevor eine Automatisierung Produktionsgeräte berührt, zu überprüfen.

Wann Verwenden

  • Überprüfung von Cisco IOS- oder IOS-XE-ähnlichen Snippets vor dem Deployment.
  • Audit von generierten Konfigurationen aus Skripten oder Templates.
  • Suche nach gefährlichen Befehlen, doppelten IP-Adressen oder Subnetz-Überlappungen.
  • Prüfung, ob ACLs, Route-Maps, Prefix-Listen oder Line-Policies referenziert, aber nicht definiert sind.
  • Erstellung von schlanken Preflight-Skripten für die Netzwerkautomatisierung.

Wie es Funktioniert

Behandeln Sie die Konfigurationsvalidierung als schichtweise Evidenz, nicht als vollständigen Parser. Regex-Prüfungen sind nützlich für Preflight-Warnungen, aber die endgültige Freigabe erfordert weiterhin einen Netzwerktechniker, der die Absicht, die Plattformsyntax und die Rollback-Schritte überprüft.

Validieren Sie in dieser Reihenfolge:

  1. Destruktive Befehle.
  2. Credential- und Management-Ebene-Exposition.
  3. Doppelte Adressen und überlappende Subnetze.
  4. Veraltete Referenzen auf ACLs, Route-Maps, Prefix-Listen und Interfaces.
  5. Betriebshygiene wie NTP, Zeitstempel, Remote-Logging und Banner.

Erkennung Gefährlicher Befehle

import re

GEFAHRLICHE_MUSTER: list[tuple[re.Pattern[str], str]] = [
    (re.compile(r"\breload\b", re.I), "Reload verursacht Ausfallzeit"),
    (re.compile(r"\berase\s+(startup|nvram|flash)", re.I), "löscht persistenten Speicher"),
    (re.compile(r"\bformat\b", re.I), "formatiert ein Geräte-Dateisystem"),
    (re.compile(r"\bno\s+router\s+(bgp|ospf|eigrp)\b", re.I), "entfernt einen Routing-Prozess"),
    (re.compile(r"\bno\s+interface\s+\S+", re.I), "entfernt Interface-Konfiguration"),
    (re.compile(r"\baaa\s+new-model\b", re.I), "ändert das Authentifizierungsverhalten"),
    (re.compile(r"\bcrypto\s+key\s+(zeroize|generate)\b", re.I), "ändert Geräte-SSH-Schlüssel"),
]

def finde_gefaehrliche_befehle(zeilen: list[str]) -> list[dict[str, str | int]]:
    funde = []
    for zeilennummer, zeile in enumerate(zeilen, start=1):
        bereinigt = zeile.strip()
        for muster, grund in GEFAHRLICHE_MUSTER:
            if muster.search(bereinigt):
                funde.append({
                    "zeile": zeilennummer,
                    "befehl": bereinigt,
                    "grund": grund,
                })
    return funde

Doppelte IPs und Subnetz-Überlappungen

import ipaddress
import re
from collections import Counter

IP_ADRESSE_RE = re.compile(
    r"^\s*ip address\s+"
    r"(?P<ip>\d{1,3}(?:\.\d{1,3}){3})\s+"
    r"(?P<maske>\d{1,3}(?:\.\d{1,3}){3})\b",
    re.I | re.M,
)

def extrahiere_interfaces(config: str) -> list[dict[str, str]]:
    ergebnisse = []
    aktuell = None
    for zeile in config.splitlines():
        if zeile.startswith("interface "):
            aktuell = zeile.split(maxsplit=1)[1]
            continue
        treffer = IP_ADRESSE_RE.match(zeile)
        if aktuell and treffer:
            ip = treffer.group("ip")
            maske = treffer.group("maske")
            netzwerk = ipaddress.ip_interface(f"{ip}/{maske}").network
            ergebnisse.append({"interface": aktuell, "ip": ip, "netzwerk": str(netzwerk)})
    return ergebnisse

def finde_doppelte_ips(config: str) -> list[str]:
    ips = [eintrag["ip"] for eintrag in extrahiere_interfaces(config)]
    zaehlung = Counter(ips)
    return sorted(ip for ip, anzahl in zaehlung.items() if anzahl > 1)

def finde_subnetz_ueberlappungen(config: str) -> list[tuple[str, str]]:
    netzwerke = [ipaddress.ip_network(eintrag["netzwerk"]) for eintrag in extrahiere_interfaces(config)]
    ueberlappungen = []
    for index, links in enumerate(netzwerke):
        for rechts in netzwerke[index + 1:]:
            if links.overlaps(rechts):
                ueberlappungen.append((str(links), str(rechts)))
    return ueberlappungen

Management-Ebene-Checks

VTY-Blöcke abschnittsweise parsen, damit Access-Class-Prüfungen nicht auf unabhängige Zeilen übergreifen.

import re

def iteriere_bloecke(config: str, beginnt_mit: str) -> list[str]:
    bloecke = []
    aktuell: list[str] = []
    for zeile in config.splitlines():
        if zeile.startswith(beginnt_mit):
            if aktuell:
                bloecke.append("\n".join(aktuell))
            aktuell = [zeile]
            continue
        if aktuell:
            if zeile and not zeile.startswith(" "):
                bloecke.append("\n".join(aktuell))
                aktuell = []
            else:
                aktuell.append(zeile)
    if aktuell:
        bloecke.append("\n".join(aktuell))
    return bloecke

def pruefe_vty_bloecke(config: str) -> list[str]:
    probleme = []
    for block in iteriere_bloecke(config, "line vty"):
        if re.search(r"transport\s+input\s+.*telnet", block, re.I):
            probleme.append("VTY erlaubt Telnet; nur SSH zulassen.")
        if not re.search(r"\baccess-class\s+\S+\s+in\b", block, re.I):
            probleme.append("VTY-Block hat keine eingehende Access-Class-Quellenbeschränkung.")
        if not re.search(r"\bexec-timeout\s+\d+\s+\d+\b", block, re.I):
            probleme.append("VTY-Block hat kein explizites exec-timeout.")
    return probleme

Sicherheitshygiene-Checks

SICHERHEITS_MUSTER = [
    (re.compile(r"\bsnmp-server community\s+(public|private)\b", re.I),
     "Standard-SNMP-Community konfiguriert"),
    (re.compile(r"\bsnmp-server community\s+\S+", re.I),
     "SNMPv2-Community-String konfiguriert; SNMPv3 authPriv bevorzugen"),
    (re.compile(r"\bip ssh version 1\b", re.I),
     "SSH Version 1 aktiviert"),
    (re.compile(r"\benable password\b", re.I),
     "enable password vorhanden; enable secret verwenden"),
    (re.compile(r"\busername\s+\S+\s+password\b", re.I),
     "Lokaler Benutzername verwendet Passwort statt Secret"),
]

BEST_PRACTICE_MUSTER = [
    (re.compile(r"\bntp server\b", re.I), "NTP-Server"),
    (re.compile(r"\bservice timestamps\b", re.I), "Log-Zeitstempel"),
    (re.compile(r"\blogging\s+\S+", re.I), "Logging-Ziel oder -Puffer"),
    (re.compile(r"\bsnmp-server group\s+\S+\s+v3\s+priv\b", re.I), "SNMPv3 authPriv-Gruppe"),
    (re.compile(r"\bbanner\s+(login|motd)\b", re.I), "Login-Banner"),
]

def pruefe_sicherheit(config: str) -> list[str]:
    return [meldung for muster, meldung in SICHERHEITS_MUSTER if muster.search(config)]

def pruefe_fehlende_hygiene(config: str) -> list[str]:
    return [
        f"Fehlend: {beschreibung}"
        for muster, beschreibung in BEST_PRACTICE_MUSTER
        if not muster.search(config)
    ]

Beispiele

Change-Fenster-Preflight

  1. Führen Sie Checks auf gefährliche Befehle für das exakte einzufügende Snippet durch.
  2. Führen Sie Checks auf doppelte IPs und Subnetz-Überlappungen für die vollständige Kandidatenkonfiguration durch.
  3. Bestätigen Sie, dass jede referenzierte ACL, Route-Map und Prefix-Liste existiert.
  4. Bestätigen Sie Rollback-Befehle und Out-of-Band-Zugriff vor jeder Änderung an der Management-Ebene.

Automatisierungs-Preflight

Verwenden Sie die Validierung als blockierendes Gate, bevor Netmiko, NAPALM, Ansible oder eine API-Automatisierung eine generierte Konfiguration pusht. Fail closed bei gefährlichen Befehlen und Credentials. Warnen Sie bei Best-Practice-Lücken, die außerhalb des Change-Umfangs liegen.

Anti-Patterns

  • Regex-Validierung als Geräteparser behandeln.
  • Generierte Konfiguration ohne Dry-Run-Diff anwenden.
  • SNMPv2-Community-Strings als Überwachungsanforderung empfehlen.
  • VTY-Blöcke mit Regex prüfen, die versehentlich auf unabhängige Abschnitte übergreifen können.
  • Firewall-Verhalten testen, indem ACLs deaktiviert werden, anstatt Zähler/Logs zu lesen.

Siehe Auch

  • Agent: network-config-reviewer
  • Agent: network-troubleshooter
  • Skill: network-interface-health

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

Verwandte Skills