Hallo,
derzeit betreibe ich im heimischen Netzwerk ein Raspberry Pi 4 8GB welcher als Nextcloud für Familie/Freunde genutzt wird und möchte nach Möglichkeit so wenig Angriffflächen wie möglich für Eindringlinge, Hacker und sonstiges bieten. Das Ziel ist es das System so gut wie möglich abzusichern.
Hardware:
- Raspberry Pi 4 8GB
- 500 GB SSD USB Stick (System OS)
- Zweifaches externes Festplattengehäuse (via USB an Raspberry)
- 4 TB WD Red Plus (Data HDD)
- 4 TB WD Blue (Backup HDD)
- Fritzbox 6591 Cable (mein Eigentum)
Das Software-Setup sieht wie folgt aus:
- Raspberry Pi OS Bookworm
- Nextcloud 28
- nginx 1.25.3
- mariadb 10.11.6
- php 8.2
- https via let´s encrypt und acme script (4096 bit schlüssel)
- redis 5:7.0.11
- fail2ban
Folgende configs sind aktiv:
[DEFAULT]
maxretry=3
bantime=43200
# Destination email address used solely for the interpolations in
# jail.{conf,local,d/*} configuration files.
destemail = xxx@xxx.xx
# Sender email address used solely for some actions
sender = xxx@xxx.xx
# E-mail action. Since 0.8.1 Fail2Ban uses sendmail MTA for the
# mailing. Change mta configuration parameter to mail if you want to
# revert to conventional 'mail'.
mta = mail
action = %(action_mwl)s
[nextcloud]
enabled=true
port=80,443
protocol=tcp
filter=nextcloud
logpath=logfile.log
[geoblock]
enabled=true
port=80,443
protocol=tcp
filter=geoblock
logpath=logfile.log
maxretry=1
bantime=-1
[nginx-http-auth]
enabled = true
[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
[ssh]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
[webmin-auth]
enabled = true
port = 10000
filter = webmin-auth
logpath = /var/log/auth.log
maxretry = 3
- ufw
Folgende Regeln sind aktiv:
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
80 ALLOW IN Anywhere
443 ALLOW IN Anywhere
22/tcp ALLOW IN 192.168.178.0/24
10000 ALLOW IN 192.168.178.0/24
5349/tcp ALLOW IN Anywhere
5349/udp ALLOW IN Anywhere
Anywhere ALLOW IN 192.168.178.1
80 (v6) ALLOW IN Anywhere (v6)
443 (v6) ALLOW IN Anywhere (v6)
5349/tcp (v6) ALLOW IN Anywhere (v6)
5349/udp (v6) ALLOW IN Anywhere (v6)
- geoblock via geoIP2 in nginx
Folgende Zeile ist konfiguriert:
geoip2 /var/lib/GeoIP/GeoLite2-Country.mmdb {
$geoip2_data_country_iso_code country iso_code;
}
map $geoip2_data_country_iso_code $allowed_country {
default no;
DE yes;
AT yes;
CH yes;
FR yes;
LU yes;
}
geo $lan-ip {
default no;
192.168.178.0/24 yes;
}
}
- webmin (nur bei bedarf aktiv)
- ssh
- coturn (STUN/TURN-Server für Talk via port 53xx)
- borgbackup (läuft jeden zweiten Tag, wobei 7 tägliche, 4 wöchentliche und 6 monatliche backups gehalten werden) Dafür nutze ich dieses Script: https://www.c-rieger.de/backup-mit-de-duplizierung/
An der Fritzbox zeigen Port 80,443 und 53xx auf das Raspberry um die Nextcloud erreichbar zu halten. Eine Lösung via Wireguard hat sich nicht bewährt, da Dateilinks extern geteilt werden und außerdem nicht jeder Nextcloudnutzer in mein Netzwerk kommen soll.
Ein komplettes Backup des USB-Sticks erfolgt jeden Monat manuel via Drive Snapshot.
Gibt es weitere Lösungen/Ideen mein System sicherer zu gestalten?
Sollte coturn weiter gesichert sein? (Könnte ich hier ein geoblock nutzen?wenn ja wie?)
Vielen Dank für die Hilfe.
LG