Cloudflare Tunnel
Firewall Rules & Zero Trust Access
Sichere interne Services ohne Öffnen von Ports. WAF, DDoS Protection, Bot Management & Access Policies in einem.
Warum Cloudflare Tunnel?
Cloudflare Tunnel (früher Argo Tunnel) ermöglicht sicheren Zugriff auf interne Services ohne VPN und ohne Öffnen von Firewall-Ports. Der Traffic wird über Cloudflares globales Netzwerk mit integriertem DDoS-Schutz und WAF geroutet.
Traditionell (Alt)
- ✗VPN-Server öffentlich exponiert
- ✗Ports 443/80 öffnen
- ✗DDoS-Anfälligkeit
- ✗Statische IP-Whitelists
- ✗Komplexe VPN-Config
Cloudflare Tunnel (Modern)
- ✓Keine öffentlichen Ports nötig
- ✓Ausgehende Verbindung nur (HTTPS)
- ✓Integrierter DDoS-Schutz
- ✓Identity-basierter Zugriff
- ✓Globale Edge-Performance
Cloudflare Tunnel Architektur
SSO Auth
WAF + DDoS + Access
No public IP
cloudflared Installation
Docker Compose
services:
cloudflared:
image: cloudflare/cloudflared:latest
command: tunnel --no-autoupdate run
environment:
- TUNNEL_TOKEN=$TUNNEL_TOKEN
restart: unless-stopped
# Your internal service
web:
image: nginx:alpine
networks:
- internalKubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloudflared
spec:
replicas: 2
selector:
matchLabels:
app: cloudflared
template:
spec:
containers:
- name: cloudflared
image: cloudflare/cloudflared:latest
args:
- tunnel
- --no-autoupdate
- run
- --token
- $(TUNNEL_TOKEN)
env:
- name: TUNNEL_TOKEN
valueFrom:
secretKeyRef:
name: tunnel-token
key: tokenToken Management
Speichern Sie den Tunnel-Token sicher in Kubernetes Secrets, Docker Secrets oder Vault. Niemals in Git committen!
Cloudflare Access Policies
Cloudflare Access Policies definieren wer Zugriff auf Ihre Tunnels erhält. Integriert mit OIDC, SAML, OTP und Service Tokens.
Access Policy Configuration
# cloudflare-access.yaml
name: "Internal Dashboard"
include:
# Require SSO authentication
- idp:
name: "Company Okta"
# OR require Service Token (for APIs)
- service_token:
name: "api-service-token"
# AND require specific email domains
- email:
domain: "company.com"
# AND require country
- geo:
country: ["DE", "AT", "CH"]
exclude:
# Block specific users
- email:
email: "ex-employee@company.com"
require:
# Require MFA
- authentication_method:
methods: ["mfa"]IdP Integration
- • Okta / Azure AD / Google
- • OneLogin / Ping Identity
- • GitHub / GitLab OAuth
- • Generic OIDC / SAML 2.0
Service Tokens
- • API-to-API Authentication
- • CI/CD Pipeline Access
- • Service Mesh Integration
- • mTLS Alternative
WAF & Security Integration
Security Layers
Layer 3/4/7 DDoS mitigation automatisch
AI-gestützte Bot-Erkennung
OWASP Top 10, SQLi, XSS Protection
Identity-based access control
Custom WAF Rule for Tunnel
resource "cloudflare_ruleset" "tunnel_waf" {
zone_id = var.zone_id
name = "Tunnel Security Rules"
kind = "zone"
phase = "http_request_firewall_custom"
# Block known bad bots
rules {
action = "block"
expression = "(cf.bot_management.score lt 10)"
description = "Block low-reputation bots"
}
# Rate limiting per IP
rules {
action = "block"
expression = "(http.request.uri.path contains "/api/" and cf.threat_score gt 50)"
description = "Block high-risk IPs on API"
}
# Geo-blocking if needed
rules {
action = "block"
expression = "(not ip.geoip.country in {"DE" "AT" "CH"})"
description = "Block non-DACH countries"
}
}Best Practices 2026
High Availability
- ✓Mindestens 2 cloudflared Replicas
- ✓Multi-Region Deployment
- ✓Health Checks konfigurieren
- ✓Automatisches Failover
Security
- ✓SSO für alle internen Services
- ✓Service Tokens für APIs
- ✓Audit Logging aktivieren
- ✓Session timeouts konfigurieren
Bereit für Zero Trust?
Migrieren Sie Ihre internen Services zu Cloudflare Tunnel. Keine öffentlichen Ports mehr nötig.
Migration Assessment