Runbook: Firewall-Regeln

Dauer: ~10 Minuten
Rolle: Network-Admin, Security-Admin
Voraussetzung: Root/Admin-Rechte

Zugriffskontrolle für das Data Gateway auf Netzwerkebene.


Workflow

flowchart TD A[Start] --> B[Ports identifizieren] B --> C{Plattform?} C -->|Windows| D[Windows Firewall] C -->|Linux| E[iptables/firewalld] C -->|Cloud| F[Security Groups] D --> G[Regel erstellen] E --> G F --> G G --> H[Testen] H --> I{Zugriff OK?} I -->|Ja| J[Dokumentieren] I -->|Nein| K[Regel anpassen] style J fill:#e8f5e9 style K fill:#ffebee


Benötigte Ports

Port Protokoll Richtung Beschreibung
—————–———-————–
443 TCP Eingehend HTTPS (Produktion)
5000 TCP Eingehend HTTP (nur Entwicklung)
9090 TCP Ausgehend Prometheus (optional)
1433 TCP Ausgehend SQL Server
5432 TCP Ausgehend PostgreSQL
3306 TCP Ausgehend MySQL

1. Windows Firewall

PowerShell (als Admin):

# Eingehend: HTTPS erlauben
New-NetFirewallRule -DisplayName "Data Gateway HTTPS" `
    -Direction Inbound -Action Allow -Protocol TCP -LocalPort 443
 
# Eingehend: Nur von bestimmten IPs
New-NetFirewallRule -DisplayName "Data Gateway HTTPS Restricted" `
    -Direction Inbound -Action Allow -Protocol TCP -LocalPort 443 `
    -RemoteAddress "10.0.0.0/8","192.168.0.0/16"
 
# Ausgehend: SQL Server erlauben
New-NetFirewallRule -DisplayName "Data Gateway to SQL Server" `
    -Direction Outbound -Action Allow -Protocol TCP -RemotePort 1433
 
# Regeln auflisten
Get-NetFirewallRule -DisplayName "Data Gateway*" | Format-Table Name, Enabled, Direction, Action
 
# Regel entfernen
Remove-NetFirewallRule -DisplayName "Data Gateway HTTPS"

2. Linux: firewalld (RHEL/CentOS)

# HTTPS Port öffnen
sudo firewall-cmd --permanent --add-port=443/tcp
 
# Nur aus bestimmtem Netz
sudo firewall-cmd --permanent --add-rich-rule='
    rule family="ipv4"
    source address="10.0.0.0/8"
    port protocol="tcp" port="443"
    accept'
 
# Änderungen anwenden
sudo firewall-cmd --reload
 
# Regeln anzeigen
sudo firewall-cmd --list-all
 
# Regel entfernen
sudo firewall-cmd --permanent --remove-port=443/tcp
sudo firewall-cmd --reload

3. Linux: ufw (Ubuntu/Debian)

# HTTPS erlauben
sudo ufw allow 443/tcp
 
# Von bestimmtem Netz
sudo ufw allow from 10.0.0.0/8 to any port 443 proto tcp
 
# Status anzeigen
sudo ufw status verbose
 
# Regel entfernen
sudo ufw delete allow 443/tcp

4. Linux: iptables (manuell)

# HTTPS erlauben
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
 
# Nur von bestimmtem Netz
sudo iptables -A INPUT -p tcp --dport 443 -s 10.0.0.0/8 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j DROP
 
# Regeln speichern
sudo iptables-save > /etc/iptables/rules.v4
 
# Regeln anzeigen
sudo iptables -L -n --line-numbers
 
# Regel entfernen (nach Nummer)
sudo iptables -D INPUT 3

5. Cloud: AWS Security Group

# Security Group erstellen
aws ec2 create-security-group \
    --group-name gateway-sg \
    --description "Data Gateway Security Group" \
    --vpc-id vpc-12345678
 
# HTTPS von überall
aws ec2 authorize-security-group-ingress \
    --group-id sg-12345678 \
    --protocol tcp \
    --port 443 \
    --cidr 0.0.0.0/0
 
# HTTPS nur aus VPN
aws ec2 authorize-security-group-ingress \
    --group-id sg-12345678 \
    --protocol tcp \
    --port 443 \
    --cidr 10.0.0.0/8

6. Cloud: Azure NSG

# NSG erstellen
az network nsg create \
    --resource-group rg-gateway \
    --name gateway-nsg
 
# HTTPS-Regel
az network nsg rule create \
    --resource-group rg-gateway \
    --nsg-name gateway-nsg \
    --name AllowHTTPS \
    --priority 100 \
    --direction Inbound \
    --access Allow \
    --protocol Tcp \
    --destination-port-ranges 443 \
    --source-address-prefixes '10.0.0.0/8'

7. IP-Whitelist im Gateway

Alternative zur Firewall: In der Anwendung filtern.

appsettings.json:

{
  "Security": {
    "AllowedIPs": [
      "10.0.0.0/8",
      "192.168.0.0/16",
      "172.16.0.0/12"
    ]
  }
}

8. Testen

# Lokal
curl https://localhost/health
 
# Vom erlaubten Netz
curl https://gateway.example.com/health
 
# Von außen (sollte blockiert sein)
curl --connect-timeout 5 https://gateway.example.com/health
# Erwartung: Connection refused oder Timeout

9. Checkliste

# Prüfpunkt
———–
1 Port 443 eingehend erlaubt
2 Port 5000 (HTTP) blockiert
3 Nur notwendige IPs erlaubt
4 Ausgehend zu DB erlaubt
5 Von außen getestet
6 Regeln dokumentiert

Troubleshooting

Problem Ursache Lösung
————————–
Connection refused Port nicht offen Firewall-Regel hinzufügen
Connection timeout Firewall blockiert Regel/Source-IP prüfen
Zugriff von überall Keine Einschränkung Source-IP limitieren
DB-Verbindung fehlgeschlagen Ausgehend blockiert Outbound-Regel hinzufügen

Best Practices

Principle of Least Privilege:

  • Nur notwendige Ports öffnen
  • Nur notwendige IPs erlauben
  • HTTP (5000) in Produktion blockieren
  • Regelmäßig Regeln auditieren

Verwandte Runbooks


« ← Zertifikat erneuern | → Operator-Übersicht »


Wolfgang van der Stille @ EMSR DATA d.o.o. - Data Gateway Professional

Zuletzt geändert: den 29.01.2026 um 15:12