126 lines
3.2 KiB
Markdown
126 lines
3.2 KiB
Markdown
# Grafana VPN - N?chste Schritte
|
|
|
|
## Aktueller Status ?
|
|
|
|
**Grafana ist erreichbar** - sowohl mit als auch ohne VPN
|
|
- ? Tempor?re L?sung aktiv: ?ffentliche IP (`89.246.96.244`) ist in der IP-Allowlist
|
|
- ?? **Sicherheitsrisiko**: Grafana ist ?ffentlich erreichbar
|
|
|
|
## Ziel ??
|
|
|
|
Grafana sollte **nur ?ber VPN** erreichbar sein:
|
|
- ? Mit VPN: Grafana erreichbar
|
|
- ? Ohne VPN: 403-Fehler
|
|
|
|
## Problem
|
|
|
|
Der Traffic l?uft **nicht ?ber VPN**, auch wenn VPN verbunden ist:
|
|
- Traefik sieht die ?ffentliche Client-IP (`89.246.96.244`) statt der VPN-IP (`10.8.0.7`)
|
|
- Ursache: DNS-Aufl?sung verwendet ?ffentliche DNS-Server statt VPN-DNS (`10.8.0.1`)
|
|
|
|
## L?sung: VPN-Routing fixen
|
|
|
|
### Option 1: DNS auf VPN-DNS setzen (EMPFOHLEN)
|
|
|
|
**Pr?fe deine WireGuard-Config:**
|
|
```
|
|
[Interface]
|
|
DNS = 10.8.0.1
|
|
```
|
|
|
|
**Falls nicht gesetzt:**
|
|
1. ?ffne deine WireGuard-Config
|
|
2. F?ge hinzu: `DNS = 10.8.0.1`
|
|
3. Speichere und starte VPN neu
|
|
|
|
**Test:**
|
|
```bash
|
|
dig +short grafana.michaelschiemer.de
|
|
# Sollte zur?ckgeben: 10.8.0.1 (nicht 94.16.110.151!)
|
|
```
|
|
|
|
**Browser testen:**
|
|
1. Browser-Cache leeren (oder Inkognito-Modus)
|
|
2. ?ffne: `https://grafana.michaelschiemer.de`
|
|
3. Sollte funktionieren, wenn DNS auf `10.8.0.1` zeigt
|
|
|
|
### Option 2: Hosts-Datei verwenden (TEMPOR?R)
|
|
|
|
**Linux/Mac:**
|
|
```bash
|
|
echo "10.8.0.1 grafana.michaelschiemer.de" | sudo tee -a /etc/hosts
|
|
```
|
|
|
|
**Windows:**
|
|
```
|
|
# C:\Windows\System32\drivers\etc\hosts (als Administrator bearbeiten)
|
|
10.8.0.1 grafana.michaelschiemer.de
|
|
```
|
|
|
|
## Pr?fen ob Traffic ?ber VPN l?uft
|
|
|
|
Nach dem Fix kannst du pr?fen:
|
|
|
|
```bash
|
|
# Auf dem Server
|
|
ssh deploy@94.16.110.151
|
|
cd ~/deployment/stacks/traefik
|
|
tail -5 logs/access.log | grep grafana | grep -oP '"ClientHost":"[^"]*"'
|
|
```
|
|
|
|
**Erwartet:**
|
|
- **Mit VPN**: `"ClientHost":"10.8.0.7"` (VPN-IP) ?
|
|
- **Ohne VPN**: Keine Logs oder 403-Fehler ?
|
|
|
|
**Aktuell:**
|
|
- **Mit VPN**: `"ClientHost":"89.246.96.244"` (?ffentliche IP) ?
|
|
- **Ohne VPN**: `"ClientHost":"89.246.96.244"` (?ffentliche IP) ?
|
|
|
|
## Tempor?re IP-Erlaubnis entfernen
|
|
|
|
Sobald das VPN-Routing funktioniert (Traffic kommt ?ber VPN), entferne die tempor?re IP-Erlaubnis:
|
|
|
|
### Automatisch (via Ansible)
|
|
|
|
```bash
|
|
cd deployment/ansible
|
|
ansible-playbook -i inventory/production.yml playbooks/remove-temporary-grafana-ip.yml
|
|
```
|
|
|
|
### Manuell
|
|
|
|
```bash
|
|
# Auf dem Server
|
|
ssh deploy@94.16.110.151
|
|
cd ~/deployment/stacks/traefik/dynamic
|
|
|
|
# Entferne tempor?re IP
|
|
sed -i '/89.246.96.244\/32/d' middlewares.yml
|
|
|
|
# Restart Traefik
|
|
cd ~/deployment/stacks/traefik
|
|
docker compose restart traefik
|
|
```
|
|
|
|
## Test nach Entfernung
|
|
|
|
1. **Mit VPN**: `https://grafana.michaelschiemer.de` sollte funktionieren ?
|
|
2. **Ohne VPN**: `https://grafana.michaelschiemer.de` sollte 403-Fehler geben ?
|
|
|
|
## Zusammenfassung
|
|
|
|
**JETZT:**
|
|
1. ? Grafana funktioniert (tempor?re IP-Erlaubnis)
|
|
2. ?? Funktioniert auch ohne VPN (Sicherheitsrisiko)
|
|
|
|
**N?CHSTE SCHRITTE:**
|
|
1. Fixe VPN-Routing (DNS auf `10.8.0.1` oder Hosts-Datei)
|
|
2. Pr?fe dass Traffic ?ber VPN kommt (ClientHost: 10.8.0.7)
|
|
3. Entferne tempor?re IP-Erlaubnis (via Playbook oder manuell)
|
|
4. Teste: Mit VPN = OK, Ohne VPN = 403
|
|
|
|
**Dokumentation:**
|
|
- `docs/deployment/GRAFANA-VPN-SECURITY-PLAN.md` - Detaillierter Plan
|
|
- `docs/deployment/VPN-ROUTING-FIX-DETAILED.md` - VPN-Routing Fix
|
|
- `docs/deployment/VPN-ROUTING-CLIENT-CHECK.md` - Client-Side Checks
|