Add optional Nginx IP whitelist hardening
This commit is contained in:
@@ -161,6 +161,35 @@ curl -I https://ics.example.de
|
||||
|
||||
Erwartung: zuerst `401 Unauthorized`, mit Login im Browser dann Zugriff.
|
||||
|
||||
### 2c) IP-Whitelist (optional, zusätzlich)
|
||||
|
||||
Wenn nur bestimmte Netze zugreifen sollen, kann Nginx den Zugriff auf IP-Bereiche begrenzen.
|
||||
|
||||
Beispiel (lokales Netz + einzelne feste IP):
|
||||
|
||||
```nginx
|
||||
location / {
|
||||
allow 192.168.178.0/24;
|
||||
allow 203.0.113.10;
|
||||
deny all;
|
||||
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
```
|
||||
|
||||
Danach prüfen und neu laden:
|
||||
|
||||
```bash
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
Kombiniert mit Basic Auth ist das eine robuste Mindestabsicherung.
|
||||
|
||||
### 3) HTTPS mit Let's Encrypt
|
||||
|
||||
```bash
|
||||
@@ -178,5 +207,6 @@ sudo certbot renew --dry-run
|
||||
### 4) Mindest-Sicherheit
|
||||
|
||||
- Zugriffe absichern (mindestens Basic Auth)
|
||||
- Optional zusätzlich per IP-Whitelist einschränken
|
||||
- Upload-Limit klein halten (`client_max_body_size`)
|
||||
- Server und Pakete regelmäßig aktualisieren
|
||||
|
||||
Reference in New Issue
Block a user