This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: cilium-ebpf-wireguard-mutual-auth-standard

Cilium eBPF WireGuard Node-to-Node Mutual Authentication and Encryption Standard

Enforces strict kernel-level mutual authentication and transparent cryptographic encapsulation using Cilium eBPF and in-kernel WireGuard. Eliminates user-space proxy latency and ensures all inter-node pod and host traffic remains strictly zero-trust and tamper-proof.

Prohibited Anti-Pattern: Unencrypted inter-node transit and fallback configurations exposing overlay traffic to unauthenticated snooping

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium eBPF WireGuard Node-to-Node Mutual Authentication and Encryption Standard - Enforces strict kernel-level mutual authentication and transparent cryptographic encapsulation using Cilium eBPF and in-kernel WireGuard. Eliminates user-space proxy latency and ensures all inter-node pod and host traffic remains strictly zero-trust and tamper-proof.
globs: charts/**/cilium/**/values.yaml, helm/**/cilium/**/values.yaml, infra/**/*.tf, k8s/**/*.yaml, manifests/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-wireguard-mutual-auth-standard"
---

# Cilium eBPF WireGuard Node-to-Node Mutual Authentication and Encryption Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Unencrypted inter-node transit and fallback configurations exposing overlay traffic to unauthenticated snooping

## System Constraints
You are a Principal Infrastructure Architect enforcing zero-trust networking using Cilium eBPF and native Linux WireGuard integration. You must mandate in-kernel encapsulation, dynamic key rotation, node-to-node mutual cryptographic authentication, and zero fallback to unencrypted pod-to-pod or host-to-host transit.

## Strict Guidelines
- Engineers MUST ALWAYS enable native WireGuard transparent encryption (`encryption.type: wireguard`) across all Cilium nodes.
- Engineers MUST ALWAYS enable node-to-node encryption (`encryption.wireguard.encryptNode: true`) to cryptographically seal host-networked endpoints.
- Engineers MUST NOT permit unencrypted fallback traffic or insecure transit routes between cluster nodes.
- Engineers MUST configure MTU adjustment accounting for the 60-byte WireGuard overhead (IPv4) or 80-byte overhead (IPv6) relative to underlying network MTU.
- Services MUST enforce CiliumNetworkPolicies with explicit identity-based egress and ingress isolation, relying on eBPF identity tokens across the authenticated WireGuard links.
- Cluster deployments MUST NEVER operate with `kube-proxy` enabled when using Cilium WireGuard; `kubeProxyReplacement` MUST be set to `true` to ensure deterministic eBPF socket load balancing.

## Bad vs Good Implementations
### Cilium Helm Values: Insecure Plaintext Fallback vs Deterministic In-Kernel WireGuard

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Disabling encryption exposes all pod-to-pod and host-to-host overlay traffic across VPC/LAN to packet sniffing and spoofing. Relying on iptables-based kube-proxy introduces connection-tracking table exhaustion and bypasses eBPF-native identity verification.
```yaml
# INSECURE: WireGuard disabled or partial, allowing plaintext inter-node transport
encryption:
  enabled: false

kubeProxyReplacement: false
tunnelProtocol: vxlan
```

#### Production Standard (Correct)
> **Standard**: Enforces hardware/kernel-level WireGuard encryption with `encryptNode: true`, protecting host and pod communications. Native routing with eBPF kube-proxy replacement guarantees deterministic socket routing and avoids proxy latency.
```yaml
# SECURE: In-kernel WireGuard with host mutual auth and direct eBPF routing
encryption:
  enabled: true
  type: wireguard
  wireguard:
    encryptNode: true

kubeProxyReplacement: true
bpf:
  masquerade: true
routingMode: native
ipv4NativeRoutingCIDR: "10.0.0.0/8"
mtu: 1420
```

### Terraform / Cilium Agent Configuration Validation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Explicitly disables encryption or relies on high-latency L7 proxies to achieve security boundaries instead of kernel eBPF cryptographic encapsulation.
```typescript
// INSECURE: Omitting encryption parameters during automated cluster bootstrapping
export const ciliumConfig = {
  cluster: 'prod-eu-west-1',
  helmValues: {
    'l7Proxy': true,
    'encryption.enabled': false
  }
};
```

#### Production Standard (Correct)
> **Standard**: Typescript configuration schema strictly validates that encryption is explicitly typed to WireGuard, host encryption is mandated, and proper encapsulation MTU offsets are pre-calculated.
```typescript
// SECURE: Enforce immutable WireGuard and strict MTU bounds in IaC orchestration
export interface CiliumEncryptionConfig {
  enabled: boolean;
  type: 'wireguard' | 'ipsec';
  wireguard: {
    encryptNode: boolean;
  };
}

export const ciliumConfig: { helmValues: { encryption: CiliumEncryptionConfig; kubeProxyReplacement: boolean; mtu: number } } = {
  helmValues: {
    encryption: {
      enabled: true,
      type: 'wireguard',
      wireguard: {
        encryptNode: true
      }
    },
    kubeProxyReplacement: true,
    mtu: 1420 // 1480 base - 60 bytes WireGuard IPv4 encapsulation
  }
};
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Cilium eBPF WireGuard Node-to-Node Mutual Authentication and Encryption Standard

Cilium eBPF WireGuard Node-to-Node Mutual Authentication and Encryption Standard defines an industrial-grade behavioral standard for devops engineering. Enforces strict kernel-level mutual authentication and transparent cryptographic encapsulation using Cilium eBPF and in-kernel WireGuard. Eliminates user-space proxy latency and ensures all inter-node pod and host traffic remains strictly zero-trust and tamper-proof. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Unencrypted inter-node transit and fallback configurations exposing overlay traffic to unauthenticated snooping Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftUnencrypted inter-node transit and fallback configurations exposing overlay traffic to unauthenticated snoopingCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS enable native WireGuard transparent encryption (`encryption.type

Engineers MUST ALWAYS enable native WireGuard transparent encryption (`encryption.type: wireguard`) across all Cilium nodes.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST ALWAYS enable node-to-node encryption (`encryption.wireguard.encryptNode

Engineers MUST ALWAYS enable node-to-node encryption (`encryption.wireguard.encryptNode: true`) to cryptographically seal host-networked endpoints.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Engineers MUST NOT permit unencrypted fallback traffic or insecure transit routes between cluster nodes.

Engineers MUST NOT permit unencrypted fallback traffic or insecure transit routes between cluster nodes.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Engineers MUST configure MTU adjustment accounting for the 60-byte WireGuard overhead (IPv4) or 80-byte overhead (IPv6) relative to underlying network MTU.

Engineers MUST configure MTU adjustment accounting for the 60-byte WireGuard overhead (IPv4) or 80-byte overhead (IPv6) relative to underlying network MTU.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Services MUST enforce CiliumNetworkPolicies with explicit identity-based egress and ingress isolation, relying on eBPF identity tokens across the authenticated WireGuard links.

Services MUST enforce CiliumNetworkPolicies with explicit identity-based egress and ingress isolation, relying on eBPF identity tokens across the authenticated WireGuard links.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
6

Cluster deployments MUST NEVER operate with `kube-proxy` enabled when using Cilium WireGuard

Cluster deployments MUST NEVER operate with `kube-proxy` enabled when using Cilium WireGuard; `kubeProxyReplacement` MUST be set to `true` to ensure deterministic eBPF socket load balancing.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Cilium eBPF WireGuard Node-to-Node Mutual Authentication and Encryption Standard critical for AI coding assistants?

Enforces strict kernel-level mutual authentication and transparent cryptographic encapsulation using Cilium eBPF and in-kernel WireGuard. Eliminates user-space proxy latency and ensures all inter-node pod and host traffic remains strictly zero-trust and tamper-proof. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Unencrypted inter-node transit and fallback configurations exposing overlay traffic to unauthenticated snooping) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Cilium