
Firewalls haven’t changed much in 20 years. They still expose a web UI, expect humans to click buttons, and rely on manual rule updates.
What has changed is how we automate infrastructure — and how AI can reason about network events faster than any human.
AI‑assisted infrastructure is no longer a future concept — it’s here.
But when it comes to firewalls, the stakes are higher than anywhere else in your stack.
A misconfigured rule can take down production, expose internal systems, or break VPNs.
This article shows how to safely automate firewall management using any AI model:
…and how to do it for free, using:
This works with any firewall vendor, including:
The goal:
AI proposes. You approve. GitHub executes. The firewall stays isolated.
Modern LLMs can:
But they should never have direct access to your firewall.
The solution is a zero‑trust automation pipeline:
Code
AI Model → Validation Layer → GitHub Action → WireGuard → Firewall API/CLIThis gives you:
No public API.
No exposed ports.
No inbound access.
Works with Palo Alto, Fortinet, Check Point, Cisco, OPNsense, pfSense, VyOS, Linux.
Claude, Gemini, OpenAI, local LLMs — all compatible.
WireGuard: free
GitHub Actions: free
Local LLMs: free
AI proposes.
You approve.
GitHub executes.
The design is intentionally simple
Local LLM only

Hybrid

The architecture prevents the AI from ever "touching" the firewall directly. Instead, it follows a strict Proposal -> Review -> Execution pipeline

The model never touches the firewall directly.
A small script or prompt template that:
Executes commands inside a controlled environment.
Creates a private, encrypted path from GitHub to your firewall.
Receives commands via:
WireGuard is perfect for this:
Example firewall‑side config:
Code
[Interface]
Address = 10.10.10.1/24
PrivateKey = <FIREWALL_PRIVATE_KEY>
ListenPort = 51820
[Peer]
PublicKey = <GITHUB_PUBLIC_KEY>
AllowedIPs = 10.10.10.2/32
GitHub runner config:
Code
[Interface]
Address = 10.10.10.2/32
PrivateKey = <GITHUB_PRIVATE_KEY>
[Peer]
PublicKey = <FIREWALL_PUBLIC_KEY>
Endpoint = <your-public-ip>:51820
AllowedIPs = 10.10.10.1/32
PersistentKeepalive = 25Every vendor supports scoped automation:
sudoersThis is the secure execution layer.
.github/workflows/firewall.ymlyaml
name: Firewall Automation
on:
workflow_dispatch:
inputs:
command:
description: "Command to run on firewall"
required: true
jobs:
run-command:
runs-on: ubuntu-latest
steps:
- name: Install WireGuard
run: sudo apt-get install -y wireguard
- name: Configure WireGuard
run: |
echo "${{ secrets.WG_CONF }}" > wg0.conf
sudo wg-quick up ./wg0.conf
- name: Execute Command
run: |
ssh -o StrictHostKeyChecking=no \
-i <(echo "${{ secrets.FW_SSH_KEY }}") \
automation@10.10.10.1 \
"${{ github.event.inputs.command }}"
This works for:
curl API calls)Your AI model becomes the “brain” of the system.
Best for reasoning, policy validation, and explaining logs.
Excellent for structured output and network diagrams.
Strong at generating vendor‑specific API calls.
Perfect for offline or sensitive environments.
Use this template to keep the AI safe:
You are a network automation assistant.
You generate firewall commands following zero‑trust principles.
Output only the command.
No explanations.
No destructive actions.
Allowed operations:Add temporary rulesModify address objectsQuery system statusRead logs
The command will be executed via GitHub Actions over WireGuard.
Example AI output:
Code
curl -k -X POST https://10.10.10.1/api/v2/cmdb/firewall/address \
-H "Authorization: Bearer $TOKEN" \
-d '{"name":"temp-block","subnet":"8.8.8.8/32"}'For an AI agent to reason about firewall behavior, it first needs a read‑only snapshot of the configuration.
This is done safely — without giving the model write access or admin privileges.
Each firewall vendor provides a way to export or query configuration data:
Palo Alto NetworksXML or REST API (/api/?type=config&action=show)curl -k -u $API_KEY https://fw/api/?type=config&action=showFortinet FortiGateREST API (/api/v2/cmdb/firewall/policy)curl -H "Authorization: Bearer $TOKEN" https://fw/api/v2/cmdb/firewall/policyCheck PointManagement API (show-objects, show-access-rulebase)mgmt_cli show access-rulebase name "Network" --format jsonCisco ASA/FTDREST API or CLI export (show running-config)curl -u admin:pass https://fw/api/configOPNsense / pfSenseBuilt‑in API (/api/firewall/rule/searchRule)curl -u key:secret https://fw/api/firewall/rule/searchRuleVyOS / LinuxSSH read‑only user (sudo vtysh -c "show configuration")ssh readonly@vyos "show configuration"
All these methods return structured data — XML, JSON, or plain text — that can be parsed safely.
The AI agent never reads raw text directly.
Instead, a parser script converts the configuration into a normalized JSON schema:
json
{
"interfaces": ["eth0", "eth1"],
"zones": ["LAN", "WAN"],
"rules": [
{"src": "LAN", "dst": "WAN", "action": "allow", "service": "HTTPS"},
{"src": "LAN", "dst": "Internet", "action": "block", "service": "SSH"}
],
"nat": [{"src": "LAN", "dst": "WAN", "type": "masquerade"}]
}
This schema is then passed to the AI model.
The AI (Claude, Gemini, OpenAI, or a local LLM) reads the normalized JSON and performs:
Example prompt to the model:
“Analyze this firewall configuration JSON. Identify redundant rules, missing deny policies, and potential misconfigurations. Output a summary and recommended changes.”
The model’s output is then reviewed by a human or validated by a script before any change is applied.
When AI interacts with network infrastructure, security controls are not optional — they are the foundation.
This section defines how to protect your environment when integrating AI models (Claude, Gemini, OpenAI, local LLMs) with firewalls through GitHub Actions and WireGuard.

Every component operates under least privilege and explicit verification:
This ensures that even if an AI model or runner is compromised, the firewall remains unreachable from the public internet.
Each automation user has a minimal privilege profile:
Vendors like Palo Alto, Fortinet, and OPNsense support granular API roles — use them to enforce separation of duties.
Secrets are never hard‑coded or stored in plaintext.
Before any AI‑generated command executes, it passes through a validation filter:
delete all, flush, reboot).This layer ensures that AI suggestions are interpreted, not blindly executed.
Every action is traceable:
Together, these logs create a complete forensic trail — essential for regulated environments.
AI models only process non‑sensitive metadata:
This protects both organizational and personal data while maintaining analytical depth.
Integrate your AI‑driven automation pipeline with existing SOC tools:
Automation doesn’t replace monitoring — it enhances it.
AI proposes, humans approve, GitHub executes.
This triad keeps control in human hands while leveraging AI’s analytical power.
Governance ensures that automation remains predictable, auditable, and reversible.
Each firewall vendor offers unique security features — use them:
Combine these with your AI pipeline for maximum resilience.
Automation environments should be stateless:
This minimizes exposure and ensures clean recovery after every run.
AI must never be allowed to:
Add:

Expose read‑only endpoints:
The AI can then:
This diagram illustrates how telemetry moves safely from the protected segment to the AI Agent.

AI‑assisted firewall automation is not only possible — it’s safe, free, and enterprise‑ready when designed correctly.
By combining:
…you get a modern, zero‑trust automation pipeline that works with any firewall and any AI model.
If you're running a similar setup or have questions, reach out in the comments or on LinkedIn.
— Antonio | AboutCloud
arusso@aboutcloud.io

I run an always-on AI agent in my private and public cloud infrastructure. It lives on Telegram or WhatsApp, it remembers who I am between conversations, and it has a sysadmin's hands — terminal, code execution, the works. For a while, the engine behind that was OpenClaw. It isn't anymore. This is the story of why I tore it down and rebuilt on Hermes Agent from Nous Research, backed by a self-hosted Honcho memory layer. Two things forced the decision: a billing change that exposed how fragile m
By Antonio Russo

When Microsoft pushed passkeys from future direction to deploy now, I started getting the same question from every IT lead I spoke to: Who in our tenant can actually adopt passkeys this week? And who can't, and why? It's a deceptively simple question. The tooling situation around it is not. The Entra admin portal has the answer spread across four blades. The Microsoft Graph API has the right primitives, but no single endpoint that combines them. The hosted SaaS scanners want either a privilege
By Antonio Russo