Maschinenraum/cp.uugrn.org: Unterschied zwischen den Versionen

Aus UUGRN
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 2: Zeile 2:


{| class="wikitable"
{| class="wikitable"
|-
! Bereich
! URL


| ! Wert                      |
| --------------------------- |
| URL                        |
| https://cp.uugrn.org        |
| https://cp.uugrn.org        |
| --------------------------- |
| -                           |
| ! System                    |
| Sandbox                    |
| https://sandboxcp.uugrn.org |
| -                           |
| Betriebssystem              |
| Debian 13.6 (Trixie)        |
| Debian 13.6 (Trixie)        |
| -                          |
| -                          |
| ! Anwendung                |
| CryptPad                    |
| CryptPad v2026.5.1         |
| v2026.5.1                   |
| -                          |
| -                          |
| ! Webserver                |
| nginx                      |
| nginx 1.30.4               |
| 1.30.4                     |
| -                          |
| -                          |
| ! Node.js                   |
| Node.js                     |
| 24.18.1                    |
| 24.18.1                    |
| -                          |
| -                          |
| ! Sandbox                  |
| Installation                |
| https://sandboxcp.uugrn.org |
| /home/cryptpad/cryptpad    |
| -                          |
| Dienstbenutzer              |
| cryptpad                    |
| }                          |
| }                          |


== Aufbau ==
CryptPad dient zur verschlüsselten gemeinsamen Bearbeitung von Dokumenten. Der öffentliche Zugriff erfolgt über nginx. CryptPad selbst ist nur über Loopback erreichbar.
 
CryptPad läuft als Benutzer <code>cryptpad</code> unter:
 
<pre>
/home/cryptpad/cryptpad
</pre>
 
Der öffentliche Zugriff erfolgt ausschließlich über nginx.
 
CryptPad lauscht intern nur auf Loopback:
 
<pre>
[::1]:3000
[::1]:3003
</pre>


Öffentlich erreichbar sind:
**TOC**


<pre>
== Betrieb ==
22/tcp  SSH
80/tcp  HTTP
443/tcp  HTTPS
</pre>


== Dienste ==
Wichtige Dienste:


<pre>
* CryptPad: systemctl status cryptpad
systemctl status cryptpad
* nginx: systemctl status nginx
systemctl status nginx
* SSH: systemctl status ssh
systemctl status ssh
* Firewall: systemctl status nftables
systemctl status nftables
* Fail2ban: systemctl status fail2ban
systemctl status fail2ban
* Fehlerhafte Dienste: systemctl --failed
</pre>


CryptPad neu starten:
CryptPad:


<pre>
* Starten: systemctl start cryptpad
systemctl restart cryptpad
* Stoppen: systemctl stop cryptpad
</pre>
* Neustarten: systemctl restart cryptpad
* Log anzeigen: journalctl -u cryptpad -f


nginx-Konfiguration prüfen und neu laden:
nginx:


<pre>
* Konfiguration prüfen: nginx -t
nginx -t
* Konfiguration neu laden: systemctl reload nginx
systemctl reload nginx
</pre>


CryptPad-Logs:
Diagnose:


<pre>
* https://cp.uugrn.org/checkup/
journalctl -u cryptpad
</pre>


== SSH ==
== SSH ==


Administrativer Benutzer:
Administrativer Benutzer: adminBenutzer
 
<pre>
adminBenutzer
</pre>


Anmeldung:
Anmeldung:


<pre>
* ssh -4 -i ~/.ssh/ssh-rsa-private-4096-key [adminBenutzer@cp.uugrn.org](mailto:adminBenutzer@cp.uugrn.org)
ssh -4 -i ~/.ssh/ssh-rsa-private-4096-key adminBenutzer@cp.uugrn.org
* anschließend sudo -i
</pre>
 
Root-Rechte:
 
<pre>
sudo -i
</pre>
 
SSH ist gehärtet:


<pre>
Härtung:
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
AllowGroups sshusers


LoginGraceTime 30
* direkter Root-Login deaktiviert
MaxAuthTries 3
* Passwort-Login deaktiviert
MaxStartups 10:30:30
* ausschließlich Public-Key-Authentifizierung
PerSourceMaxStartups 3
* SSH nur für Mitglieder der Gruppe sshusers
</pre>
* LoginGraceTime 30
* MaxAuthTries 3
* MaxStartups 10:30:30
* PerSourceMaxStartups 3


Prüfung:
Prüfung:


<pre>
* sshd -t
sshd -t
* sshd -T
sshd -T
</pre>


== Firewall ==
== Netzwerk und Firewall ==


nftables-Konfiguration:
{| class="wikitable"
! Port


<pre>
| ! Dienst |
/etc/nftables.conf
| -------- |
</pre>
| 22/tcp  |
| SSH      |
| -        |
| 80/tcp  |
| HTTP    |
| -        |
| 443/tcp  |
| HTTPS    |
| }        |


Regeln anzeigen:
CryptPad lauscht intern auf Loopback, unter anderem auf Port 3000 und 3003.


<pre>
nftables:
nft list ruleset
</pre>


Eingehend erlaubt:
* Konfiguration: /etc/nftables.conf
* Regeln anzeigen: nft list ruleset
* Tabellen anzeigen: nft list tables


<pre>
Standardrichtlinien:
22/tcp
80/tcp
443/tcp
ICMP
ICMPv6
DHCPv4
Loopback
established/related
</pre>


Standard:
* INPUT DROP
* FORWARD DROP
* OUTPUT ACCEPT


<pre>
Zusätzlich erlaubt sind Loopback, bestehende Verbindungen, ICMP, ICMPv6 und DHCPv4.
INPUT    DROP
FORWARD  DROP
OUTPUT  ACCEPT
</pre>


== Fail2ban ==
== Fail2ban ==
Zeile 158: Zeile 124:
Konfiguration:
Konfiguration:


<pre>
* /etc/fail2ban/jail.d/sshd.local
/etc/fail2ban/jail.d/sshd.local
</pre>


SSH-Jail:
SSH-Jail:


<pre>
* 4 Fehlversuche innerhalb von 10 Minuten
maxretry = 4
* Sperrdauer 1 Stunde
findtime = 10m
* Backend systemd
bantime = 1h
* Sperren über nftables
backend = systemd
* DNS-Auflösung deaktiviert
usedns = no
</pre>


Status:
Status:


<pre>
* fail2ban-client status sshd
fail2ban-client status sshd
</pre>


nftables enthält zusätzlich die von Fail2ban verwaltete Tabelle:
nftables enthält normalerweise:


<pre>
* table inet filter
table inet f2b-table
* table inet f2b-table
</pre>


Nach einem manuellen Neustart von nftables auch Fail2ban neu starten:
Nach einem manuellen Neustart von nftables:


<pre>
# systemctl restart nftables
systemctl restart nftables
 
systemctl restart fail2ban
# systemctl restart fail2ban
</pre>


== Updates ==
== Updates ==


Debian-Sicherheitsupdates werden automatisch über <code>unattended-upgrades</code> installiert.
Debian-Sicherheitsupdates werden automatisch mit unattended-upgrades installiert.


Nicht automatisch aktualisiert werden:
Nicht automatisch aktualisiert werden:


* normale Debian-Updates
* normale Debian-Updates
* Node.js / NodeSource
* Node.js
* nginx
* nginx
* CryptPad
* CryptPad
Zeile 204: Zeile 162:
Automatische Neustarts sind deaktiviert.
Automatische Neustarts sind deaktiviert.


Updates prüfen:
Manuelle Kontrolle:
 
* apt update
* apt list --upgradable
* unattended-upgrade --dry-run
 
Neustart erforderlich:
 
* test -f /var/run/reboot-required && cat /var/run/reboot-required
 
== CryptPad aktualisieren ==
 
Vor einem Update:
 
# Release Notes lesen.
 
# Wartung ankündigen.
 
# Backup mit /root/sichercp erstellen.
 
# CryptPad stoppen.
 
# Update durchführen.
 
# CryptPad starten.
 
# Funktion prüfen.
 
Update:
 
# systemctl stop cryptpad
 
# su - cryptpad
 
# cd /home/cryptpad/cryptpad
 
# git fetch --depth 1 origin tag VERSION


<pre>
# git checkout VERSION
apt update
apt list --upgradable
</pre>


Automatische Security-Updates testen:
# npm ci


<pre>
# npm run install:components
unattended-upgrade --dry-run
</pre>


Neustartbedarf prüfen:
# ./install-onlyoffice.sh


<pre>
# exit
test -f /var/run/reboot-required && cat /var/run/reboot-required
</pre>


== CryptPad-Daten ==
# systemctl start cryptpad


Wichtige persistente Daten:
Anschließend prüfen:


<pre>
* systemctl status cryptpad
/home/cryptpad/cryptpad/data
* journalctl -u cryptpad -n 100
/home/cryptpad/cryptpad/datastore
* https://cp.uugrn.org/checkup/
/home/cryptpad/cryptpad/block
 
/home/cryptpad/cryptpad/blob
Zusätzlich Anmeldung, Pads, Datei-Upload und OnlyOffice testen.
/home/cryptpad/cryptpad/config/config.js
/home/cryptpad/cryptpad/customize
</pre>


== Backup ==
== Backup ==
Zeile 240: Zeile 224:
Backup-Skript:
Backup-Skript:


<pre>
* /root/sichercp
/root/sichercp
</pre>


Backups:
Backup-Verzeichnis:


<pre>
* /root/backups/
/root/backups
</pre>


Aufbewahrung:
Aufbewahrung:


<pre>
* 180 Tage
180 Tage
</pre>
 
Aktuelle Backupgröße: etwa 133 MB.


Gesichert werden:
Gesichert werden:


* CryptPad-Daten
* data/
* <code>config.js</code>
* datastore/
* Anpassungen unter <code>customize/</code>
* block/
* blob/
* config/config.js
* customize/
* onlyoffice-conf/
* nginx-Konfiguration
* nginx-Konfiguration
* SSH-Konfiguration
* SSH-Konfiguration
Zeile 273: Zeile 253:
Nicht gesichert werden reproduzierbare Daten:
Nicht gesichert werden reproduzierbare Daten:


<pre>
* .git/
.git
* node_modules/
node_modules
* www/
www
* OnlyOffice-Distribution
www/common/onlyoffice/dist
</pre>


Backup starten:
Backup starten:


<pre>
* /root/sichercp
/root/sichercp
</pre>


Backups anzeigen:
Backups anzeigen:


<pre>
* ls -lh /root/backups/
ls -lh /root/backups
</pre>


Das Backup liegt derzeit nur lokal auf dem Server. Ein zusätzliches externes Backup sollte eingerichtet werden, sobald ein geeignetes Ziel verfügbar ist.
Die Backups liegen derzeit nur lokal auf dem Server. Gegen einen vollständigen Verlust der VM besteht damit noch kein Schutz.


== Restore ==
== Restore ==
Zeile 298: Zeile 272:
Backup testweise entpacken:
Backup testweise entpacken:


<pre>
# BACKUP=$(ls -1t /root/backups/cp-backup-*.tar.gz | head -1)
BACKUP=$(ls -1t /root/backups/cp-backup-*.tar.gz | head -1)


mkdir -p /root/restore-test
# mkdir -p /root/restore-test


tar \
# tar --acls --xattrs --numeric-owner -C /root/restore-test -xzf "$BACKUP"
  --acls \
  --xattrs \
  --numeric-owner \
  -C /root/restore-test \
  -xzf "$BACKUP"
</pre>


Danach Daten und Konfiguration prüfen und das Testverzeichnis wieder entfernen:
Nach der Kontrolle:


<pre>
# rm -rf /root/restore-test
rm -rf /root/restore-test
</pre>


Bei einem vollständigen Serverausfall:
=== Notfall-Restore ===


# Debian 13 installieren
Bei vollständigem Serververlust:


# Node.js, nginx und CryptPad in passender Version installieren
# Debian 13 installieren.


# OnlyOffice und npm-Abhängigkeiten neu installieren
# Node.js 24, nginx und CryptPad in passender Version installieren.


# CryptPad stoppen
# npm-Abhängigkeiten und OnlyOffice installieren.


# Backup zurückspielen
# CryptPad stoppen.


# Rechte auf <code>cryptpad:cryptpad</code> prüfen
# CryptPad-Daten aus dem Backup zurückspielen.


# nginx, SSH, nftables, Fail2ban und systemd-Konfiguration wiederherstellen
# Besitzer cryptpad:cryptpad prüfen.


# Dienste starten
# Serverkonfiguration wiederherstellen.


# CryptPad vollständig testen
# Dienste starten.


== CryptPad-Update ==
# CryptPad vollständig testen.


Vor jedem Update:
== Wichtige Pfade ==


# Release Notes lesen
{| class="wikitable"
! Bereich


# Backup erstellen
| ! Pfad                                  |
| ---------------------------------------- |
| CryptPad                                |
| /home/cryptpad/cryptpad                  |
| -                                        |
| Konfiguration                            |
| /home/cryptpad/cryptpad/config/config.js |
| -                                        |
| Anpassungen                              |
| /home/cryptpad/cryptpad/customize/      |
| -                                        |
| nginx                                    |
| /etc/nginx/                              |
| -                                        |
| SSH                                      |
| /etc/ssh/                                |
| -                                        |
| Firewall                                |
| /etc/nftables.conf                      |
| -                                        |
| Fail2ban                                |
| /etc/fail2ban/                          |
| -                                        |
| Backup-Skript                            |
| /root/sichercp                          |
| -                                        |
| Backups                                  |
| /root/backups/                          |
| }                                        |


# CryptPad stoppen
== Regelmäßige Kontrolle ==
 
Update als Benutzer <code>cryptpad</code> durchführen:
 
<pre>
su - cryptpad
cd /home/cryptpad/cryptpad
 
git fetch --tags
git checkout VERSION
 
npm ci
npm run install:components
./install-onlyoffice.sh
</pre>
 
Anschließend als root:
 
<pre>
systemctl start cryptpad
systemctl status cryptpad
</pre>
 
Danach prüfen:
 
<pre>
https://cp.uugrn.org/checkup/
</pre>


Zusätzlich Anmeldung, Pads, Datei-Upload und OnlyOffice testen.
* Dienste: systemctl --failed
* Ports: ss -lntup
* Firewall: nft list ruleset
* Fail2ban: fail2ban-client status sshd
* Updates: apt list --upgradable
* Speicherplatz: df -h
* Warnungen: journalctl -p warning..alert --since today


== Regelmäßige Kontrolle ==
== Dokumentation ==


<pre>
* [https://docs.cryptpad.org/en/admin_guide/ CryptPad Admin Guide]
systemctl --failed
* [https://docs.cryptpad.org/en/admin_guide/maintenance.html CryptPad Wartung]
systemctl status cryptpad nginx ssh nftables fail2ban
* [https://github.com/cryptpad/cryptpad/releases CryptPad Releases]
nft list ruleset
* [https://forum.cryptpad.org/ CryptPad Forum]
fail2ban-client status sshd
apt list --upgradable
df -h
journalctl -p warning..alert --since today
</pre>

Version vom 2. August 2026, 10:54 Uhr

cp.uugrn.org

Bereich

CryptPad dient zur verschlüsselten gemeinsamen Bearbeitung von Dokumenten. Der öffentliche Zugriff erfolgt über nginx. CryptPad selbst ist nur über Loopback erreichbar.

    • TOC**

Betrieb

Wichtige Dienste:

  • CryptPad: systemctl status cryptpad
  • nginx: systemctl status nginx
  • SSH: systemctl status ssh
  • Firewall: systemctl status nftables
  • Fail2ban: systemctl status fail2ban
  • Fehlerhafte Dienste: systemctl --failed

CryptPad:

  • Starten: systemctl start cryptpad
  • Stoppen: systemctl stop cryptpad
  • Neustarten: systemctl restart cryptpad
  • Log anzeigen: journalctl -u cryptpad -f

nginx:

  • Konfiguration prüfen: nginx -t
  • Konfiguration neu laden: systemctl reload nginx

Diagnose:

SSH

Administrativer Benutzer: adminBenutzer

Anmeldung:

Härtung:

  • direkter Root-Login deaktiviert
  • Passwort-Login deaktiviert
  • ausschließlich Public-Key-Authentifizierung
  • SSH nur für Mitglieder der Gruppe sshusers
  • LoginGraceTime 30
  • MaxAuthTries 3
  • MaxStartups 10:30:30
  • PerSourceMaxStartups 3

Prüfung:

  • sshd -t
  • sshd -T

Netzwerk und Firewall

Port

CryptPad lauscht intern auf Loopback, unter anderem auf Port 3000 und 3003.

nftables:

  • Konfiguration: /etc/nftables.conf
  • Regeln anzeigen: nft list ruleset
  • Tabellen anzeigen: nft list tables

Standardrichtlinien:

  • INPUT DROP
  • FORWARD DROP
  • OUTPUT ACCEPT

Zusätzlich erlaubt sind Loopback, bestehende Verbindungen, ICMP, ICMPv6 und DHCPv4.

Fail2ban

Konfiguration:

  • /etc/fail2ban/jail.d/sshd.local

SSH-Jail:

  • 4 Fehlversuche innerhalb von 10 Minuten
  • Sperrdauer 1 Stunde
  • Backend systemd
  • Sperren über nftables
  • DNS-Auflösung deaktiviert

Status:

  • fail2ban-client status sshd

nftables enthält normalerweise:

  • table inet filter
  • table inet f2b-table

Nach einem manuellen Neustart von nftables:

  1. systemctl restart nftables
  1. systemctl restart fail2ban

Updates

Debian-Sicherheitsupdates werden automatisch mit unattended-upgrades installiert.

Nicht automatisch aktualisiert werden:

  • normale Debian-Updates
  • Node.js
  • nginx
  • CryptPad

Automatische Neustarts sind deaktiviert.

Manuelle Kontrolle:

  • apt update
  • apt list --upgradable
  • unattended-upgrade --dry-run

Neustart erforderlich:

  • test -f /var/run/reboot-required && cat /var/run/reboot-required

CryptPad aktualisieren

Vor einem Update:

  1. Release Notes lesen.
  1. Wartung ankündigen.
  1. Backup mit /root/sichercp erstellen.
  1. CryptPad stoppen.
  1. Update durchführen.
  1. CryptPad starten.
  1. Funktion prüfen.

Update:

  1. systemctl stop cryptpad
  1. su - cryptpad
  1. cd /home/cryptpad/cryptpad
  1. git fetch --depth 1 origin tag VERSION
  1. git checkout VERSION
  1. npm ci
  1. npm run install:components
  1. ./install-onlyoffice.sh
  1. exit
  1. systemctl start cryptpad

Anschließend prüfen:

Zusätzlich Anmeldung, Pads, Datei-Upload und OnlyOffice testen.

Backup

Backup-Skript:

  • /root/sichercp

Backup-Verzeichnis:

  • /root/backups/

Aufbewahrung:

  • 180 Tage

Gesichert werden:

  • data/
  • datastore/
  • block/
  • blob/
  • config/config.js
  • customize/
  • onlyoffice-conf/
  • nginx-Konfiguration
  • SSH-Konfiguration
  • nftables
  • Fail2ban
  • APT-Konfiguration
  • systemd-Konfiguration
  • Paket- und Versionsinformationen

Nicht gesichert werden reproduzierbare Daten:

  • .git/
  • node_modules/
  • www/
  • OnlyOffice-Distribution

Backup starten:

  • /root/sichercp

Backups anzeigen:

  • ls -lh /root/backups/

Die Backups liegen derzeit nur lokal auf dem Server. Gegen einen vollständigen Verlust der VM besteht damit noch kein Schutz.

Restore

Backup testweise entpacken:

  1. BACKUP=$(ls -1t /root/backups/cp-backup-*.tar.gz | head -1)
  1. mkdir -p /root/restore-test
  1. tar --acls --xattrs --numeric-owner -C /root/restore-test -xzf "$BACKUP"

Nach der Kontrolle:

  1. rm -rf /root/restore-test

Notfall-Restore

Bei vollständigem Serververlust:

  1. Debian 13 installieren.
  1. Node.js 24, nginx und CryptPad in passender Version installieren.
  1. npm-Abhängigkeiten und OnlyOffice installieren.
  1. CryptPad stoppen.
  1. CryptPad-Daten aus dem Backup zurückspielen.
  1. Besitzer cryptpad:cryptpad prüfen.
  1. Serverkonfiguration wiederherstellen.
  1. Dienste starten.
  1. CryptPad vollständig testen.

Wichtige Pfade

Bereich

Regelmäßige Kontrolle

  • Dienste: systemctl --failed
  • Ports: ss -lntup
  • Firewall: nft list ruleset
  • Fail2ban: fail2ban-client status sshd
  • Updates: apt list --upgradable
  • Speicherplatz: df -h
  • Warnungen: journalctl -p warning..alert --since today

Dokumentation