Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| computer:debian:hp-thinclient:versuch-2-debian-thinc [2025/12/27 14:23] – removed - external edit (Unknown date) 127.0.0.1 | computer:debian:hp-thinclient:versuch-2-debian-thinc [2025/12/27 14:23] (current) – ↷ Page moved from computer:hp-thinclient:versuch-2-debian-thinc to computer:debian:hp-thinclient:versuch-2-debian-thinc spring | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Verschlüsselter Docker-Server thinc ====== | ||
| + | Siehe [[computer: | ||
| + | |||
| + | Hardware: HP t520 thin client mit 120GB SSD | ||
| + | |||
| + | OS: debian-bookworm | ||
| + | * Minimum-Installation | ||
| + | * Alle Updates | ||
| + | |||
| + | apt update && apt upgrade | ||
| + | apt install \ | ||
| + | vim \ | ||
| + | openssh-server \ | ||
| + | dropbear-initramfs \ | ||
| + | apache2-utils \ | ||
| + | mc \ | ||
| + | rcs \ | ||
| + | rsync \ | ||
| + | swaks \ | ||
| + | ufw \ | ||
| + | inetutils-tools \ | ||
| + | net-tools \ | ||
| + | fuse \ | ||
| + | at \ | ||
| + | samba \ | ||
| + | nullmailer \ | ||
| + | mailutils \ | ||
| + | hdparm \ | ||
| + | sudo \ | ||
| + | golang \ | ||
| + | ethtool \ | ||
| + | hwinfo \ | ||
| + | hdparm \ | ||
| + | pv \ | ||
| + | gdu \ | ||
| + | iw wpasupplicant wireless-tools | ||
| + | |||
| + | ====== springm zur Gruppe sudoers hinzufügen ====== | ||
| + | |||
| + | su - | ||
| + | usermod -aG sudo springm | ||
| + | |||
| + | Achtung: wird erst nach ausloggen wirksam | ||
| + | | ||
| + | |||
| + | Netzwerk: *.zalmoxis.aberdoch.de registriert | ||
| + | Boot-Disk verschlüsseln | ||
| + | |||
| + | |||
| + | ====== ssh passwordless login ====== | ||
| + | ssh-copy-id -i .ssh/ | ||
| + | ssh zalmoxis | ||
| + | sudo cp ~/ | ||
| + | ====== dropbear-initramfs ====== | ||
| + | |||
| + | Entsprechend c' | ||
| + | |||
| + | Die ssh-public-keys der Benutzer, die das System per ssh entsperren sollen können, liegen in ''/ | ||
| + | |||
| + | Minimum-Inhalt für die Konfigurationsdatei: | ||
| + | <file / | ||
| + | # | ||
| + | # Command line options to pass to dropbear(8) | ||
| + | # | ||
| + | DROPBEAR_OPTIONS=" | ||
| + | </ | ||
| + | |||
| + | Die '' | ||
| + | sudo cp ~springm/ | ||
| + | |||
| + | Nach Änderung muss das initramfs aktualisiert werden: | ||
| + | |||
| + | update-initramfs -u | ||
| + | |||
| + | Entsperren mit '' | ||
| + | |||
| + | Das ganze mit Wifi: | ||
| + | * https:// | ||
| + | * https:// | ||
| + | ===== Wifi in initramfs einschalten ===== | ||
| + | Wird gebraucht um später die Platte nach dem Booten über WLAN entschlüsseln zu können. | ||
| + | |||
| + | Rezept von https:// | ||
| + | |||
| + | wlan0 beim Boot bekanntmachen: | ||
| + | <file bash / | ||
| + | ... | ||
| + | GRUB_CMDLINE_LINUX=" | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | Benötigte Module für das initramfs | ||
| + | <file bash / | ||
| + | rtlwifi | ||
| + | rtl8xxxu | ||
| + | mac80211 | ||
| + | usbcore | ||
| + | rtl8192eu_nic.bin | ||
| + | </ | ||
| + | |||
| + | <file bash / | ||
| + | #!/bin/sh | ||
| + | PREREQ="" | ||
| + | prereqs() | ||
| + | { | ||
| + | echo " | ||
| + | } | ||
| + | |||
| + | case $1 in | ||
| + | prereqs) | ||
| + | prereqs | ||
| + | exit 0 | ||
| + | ;; | ||
| + | esac | ||
| + | |||
| + | . / | ||
| + | |||
| + | AUTH_LIMIT=30 | ||
| + | INTERFACE=" | ||
| + | alias WPACLI="/ | ||
| + | |||
| + | log_begin_msg " | ||
| + | ### mws | ||
| + | rmmod rtl8xxxu | ||
| + | modprobe rtl8xxxu | ||
| + | sleep 2 | ||
| + | ### end mws | ||
| + | / | ||
| + | |||
| + | # Wait for AUTH_LIMIT seconds, then check the status | ||
| + | limit=${AUTH_LIMIT} | ||
| + | |||
| + | echo -n " | ||
| + | while [ $limit -ge 0 -a `WPACLI status | grep wpa_state` != " | ||
| + | do | ||
| + | sleep 1 | ||
| + | echo -n " | ||
| + | limit=`expr $limit - 1` | ||
| + | done | ||
| + | echo "" | ||
| + | |||
| + | if [ `WPACLI status | grep wpa_state` != " | ||
| + | ONLINE=0 | ||
| + | log_failure_msg "WLAN offline after timeout" | ||
| + | panic | ||
| + | else | ||
| + | ONLINE=1 | ||
| + | log_success_msg "WLAN online" | ||
| + | fi | ||
| + | |||
| + | configure_networking | ||
| + | </ | ||
| + | |||
| + | <file bash / | ||
| + | #!/bin/sh | ||
| + | PREREQ="" | ||
| + | prereqs() | ||
| + | { | ||
| + | echo " | ||
| + | } | ||
| + | |||
| + | case $1 in | ||
| + | prereqs) | ||
| + | prereqs | ||
| + | exit 0 | ||
| + | ;; | ||
| + | esac | ||
| + | |||
| + | echo " | ||
| + | kill `cat / | ||
| + | </ | ||
| + | |||
| + | Eintrag in / | ||
| + | <file bash / | ||
| + | ... | ||
| + | auto wlan0 | ||
| + | iface wlan0 inet dhcp | ||
| + | wpa-conf / | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | Passwort in / | ||
| + | <file bash / | ||
| + | ctrl_interface=/ | ||
| + | update_config=1 | ||
| + | |||
| + | network={ | ||
| + | ssid=" | ||
| + | psk=langundverschlüsselt | ||
| + | } | ||
| + | </ | ||
| + | Die wpa_supplicant.conf findet sich identisch an 3 verschiedenen Stellen :( | ||
| + | * / | ||
| + | * / | ||
| + | * / | ||
| + | |||
| + | ==== ESSID und/oder Wifi-Passwort ändern ==== | ||
| + | |||
| + | wpa_passphrase " | ||
| + | / | ||
| + | |||
| + | rm / | ||
| + | cp -l / | ||
| + | rm / | ||
| + | cp -l / | ||
| + | Kontrollieren auf Gleichheit mit | ||
| + | sum $(find / -name wpa_supplicant.conf -not -path "/ | ||
| + | Dann initramfs neu erstellen | ||
| + | update-initramfs -u -k all | ||
| + | | ||
| + | |||
| + | ==== Wlan als Dienst starten ==== | ||
| + | Nach dem Entsperren wird das Wlan über einen Dienst gestartet ( https:// | ||
| + | {{ : | ||
| + | |||
| + | <file bash / | ||
| + | [Unit] | ||
| + | Description=DHCP Client | ||
| + | Before=network.target | ||
| + | After=wpa_supplicant.service | ||
| + | |||
| + | [Service] | ||
| + | Type=forking | ||
| + | ExecStart=/ | ||
| + | ExecStop=/ | ||
| + | Restart=always | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | </ | ||
| + | Starten mit | ||
| + | systemctl enable dhclient | ||
| + | systemctl restart wpa_supplicant | ||
| + | systemctl restart networking | ||
| + | Kontrollieren mit | ||
| + | ip a | ||
| + | |||
| + | ===== ufw ===== | ||
| + | ufw allow proto tcp from any to any port 22, | ||
| + | ufw allow proto udp from any to any port 137,138 | ||
| + | ufw enable | ||
| + | |||
| + | ===== email senden ===== | ||
| + | Emails sollen für Statusmails versendet werden können. Nullmailer ist einfach, 3 Konfigurationsdateien stehen in ''/ | ||
| + | Links | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | ===== debian packages sichern (und später wiederherstellen) ===== | ||
| + | von https:// | ||
| + | |||
| + | dpkg --get-selections | grep -v deinstall | awk ' | ||
| + | |||
| + | kommt in die / | ||
| + | Restore erfolgt dann mit | ||
| + | apt-get clean && apt-get update && apt-get install --reinstall $(/ | ||
| + | ===== docker ===== | ||
| + | from https:// | ||
| + | sudo apt install -y \ | ||
| + | lsb-release \ | ||
| + | gnupg2 \ | ||
| + | apt-transport-https \ | ||
| + | ca-certificates \ | ||
| + | curl \ | ||
| + | software-properties-common | ||
| + | curl -fsSL https:// | ||
| + | add-apt-repository "deb [arch=$(dpkg --print-architecture)] https:// | ||
| + | apt update | ||
| + | apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin | ||
| + | usermod -aG docker springm | ||
| + | newgrp docker | ||
| + | |||
| + | |||
| + | systemctl status docker | ||
| + | docker.service - Docker Application Container Engine | ||
| + | | ||
| + | | ||
| + | TriggeredBy: | ||
| + | Docs: https:// | ||
| + | Main PID: 9365 (dockerd) | ||
| + | Tasks: 9 | ||
| + | | ||
| + | CPU: 1.391s | ||
| + | | ||
| + | | ||
| + | | ||
| + | Aug 28 15:07:04 debian-thinc systemd[1]: Starting docker.service - Docker Appli> | ||
| + | Aug 28 15:07:04 debian-thinc dockerd[9365]: | ||
| + | Aug 28 15:07:06 debian-thinc dockerd[9365]: | ||
| + | Aug 28 15:07:08 debian-thinc dockerd[9365]: | ||
| + | Aug 28 15:07:08 debian-thinc dockerd[9365]: | ||
| + | Aug 28 15:07:08 debian-thinc dockerd[9365]: | ||
| + | Aug 28 15:07:09 debian-thinc dockerd[9365]: | ||
| + | Aug 28 15:07:09 debian-thinc systemd[1]: Started docker.service - Docker Applic> | ||
| + | |||
| + | docker version | ||
| + | Client: Docker Engine - Community | ||
| + | | ||
| + | API version: | ||
| + | Go version: | ||
| + | Git commit: | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | Server: Docker Engine - Community | ||
| + | | ||
| + | Version: | ||
| + | API version: | ||
| + | Go version: | ||
| + | Git commit: | ||
| + | Built: | ||
| + | OS/ | ||
| + | Experimental: | ||
| + | | ||
| + | Version: | ||
| + | GitCommit: | ||
| + | runc: | ||
| + | Version: | ||
| + | GitCommit: | ||
| + | | ||
| + | Version: | ||
| + | GitCommit: | ||
| + | |||
| + | ==== lazydocker ==== | ||
| + | https:// | ||
| + | go install github.com/ | ||
| + | mv /root/go /usr/local | ||
| + | ln -s / | ||
| + | |||
| + | |||
| + | ==== Docker-Dienste ==== | ||
| + | === Traefik === | ||
| + | === pihole === | ||
| + | === restic-restserver === | ||
| + | === resticinfo === | ||
| + | === mailserver === | ||
| + | === calibre === | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== Wake-on-Lan ===== | ||
| + | * https:// | ||
| + | * https:// | ||
| + | Datei ''/ | ||
| + | auto enp1s0 | ||
| + | iface enp1s0 inet dhcp | ||
| + | ethernet-wol g | ||
| + | booten um die Änderung wirksam zu machen. | ||
| + | |||
| + | ===== Zeitgesteuert schlafen/ | ||
| + | von https:// | ||
| + | |||
| + | Achtung: Mit Verschlüsselung funktioniert nur suspend-to-memory | ||
| + | |||
| + | ===== Traefik ===== | ||
| + | |||
| + | Traefik ist der router für die Docker-Container. Da alle Dienste nur im LAN zur Verfügung stehen, müssen dafür *keine* Zertifikate zur Verfügung gestellt werden. | ||
| + | |||
| + | ===== pihole ===== | ||
| + | <code yaml docker-compose.yml> | ||
| + | # from https:// | ||
| + | # adapted for usage of .env file | ||
| + | version: " | ||
| + | |||
| + | services: | ||
| + | pihole: | ||
| + | image: pihole/ | ||
| + | container_name: | ||
| + | restart: always | ||
| + | ports: | ||
| + | - " | ||
| + | - " | ||
| + | dns: | ||
| + | - 127.0.0.1 | ||
| + | - 9.9.9.9 | ||
| + | environment: | ||
| + | TZ: ' | ||
| + | WEBPASSWORD: | ||
| + | PIHOLE_DNS_: | ||
| + | DNSSEC: ' | ||
| + | ServerIP: ${SERVERIP} | ||
| + | VIRTUAL_HOST: | ||
| + | DNSMASQ_LISTENING: | ||
| + | DHCP_ACTIVE: | ||
| + | DHCP_START: ${DHCP_START} | ||
| + | DHCP_END: ${DHCP_END} | ||
| + | DHCP_ROUTER: | ||
| + | DHCP_LEASETIME: | ||
| + | WEBTHEME: default-dark | ||
| + | PIHOLE_DOMAIN: | ||
| + | volumes: | ||
| + | - ' | ||
| + | - ' | ||
| + | cap_add: | ||
| + | - NET_ADMIN | ||
| + | restart: unless-stopped | ||
| + | networks: | ||
| + | lan: {} | ||
| + | backend: | ||
| + | ipv4_address: | ||
| + | labels: | ||
| + | - " | ||
| + | - " | ||
| + | - " | ||
| + | - " | ||
| + | depends_on: | ||
| + | - dhcphelper | ||
| + | |||
| + | dhcphelper: | ||
| + | image: noamokman/ | ||
| + | container_name: | ||
| + | restart: unless-stopped | ||
| + | network_mode: | ||
| + | command: -s ${BACKEND_IPV4_ADDRESS} | ||
| + | cap_add: | ||
| + | - NET_ADMIN | ||
| + | |||
| + | networks: | ||
| + | backend: | ||
| + | ipam: | ||
| + | config: | ||
| + | - subnet: ${BACKEND_SUBNET} | ||
| + | lan: | ||
| + | external: true | ||
| + | </ | ||
| + | |||
| + | <code bash [enable_line_numbers=" | ||
| + | PIHOLE_DOMAIN= | ||
| + | WEBPASSWORD= | ||
| + | # Actual server IP. Matches DHCP conf file IP | ||
| + | SERVERIP= | ||
| + | # Same as port traefik config | ||
| + | VIRTUAL_HOST= | ||
| + | DHCP_ACTIVE= | ||
| + | DHCP_START= | ||
| + | DHCP_END= | ||
| + | DHCP_ROUTER= | ||
| + | DHCP_LEASETIME= | ||
| + | BACKEND_IPV4_ADDRESS= | ||
| + | BACKEND_SUBNET= | ||
| + | </ | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | ==== dnscrypt-proxy ==== | ||
| + | Vorher die Versionsnummer von https:// | ||
| + | |||
| + | cd /opt/ && \ | ||
| + | wget https:// | ||
| + | tar xvzf dnscrypt-proxy-linux_x86_64-2.1.5.tar.gz | ||
| + | cd linux-x86_64/ | ||
| + | cp ~springm/ | ||
| + | sudo ./ | ||
| + | sudo ./ | ||
| + | |||
| + | |||
| + | ===== Backup ===== | ||
| + | Das Backup passiert mit Restic: https:// | ||
| + | Das binary liegt in ''/ | ||
| + | Backups erfolgen in das Verzeichnis ''/ | ||
| + | Das restic-Passwort für das Restic-Repository wird in ''/ | ||
| + | |||
| + | ==== Eigenes Backup ==== | ||
| + | <code bash / | ||
| + | #!/bin/bash | ||
| + | export RESTIC_REPOSITORY=/ | ||
| + | export RESTIC_PASSWORD_FILE=/ | ||
| + | export RESTIC_EXCLUDE_FILE=/ | ||
| + | export HOME=/root | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | Zu starten via cron, ebenso '' | ||
| + | ==== Restic-Server ==== | ||
| + | |||
| + | |||
| + | Der restic-Server läuft in einem docker-Container unter der URL '' | ||
| + | |||
| + | ==== Restic-Info ==== | ||
| + | Läuft in einem Docker-Containern. Liest die JSON-Datei aus ''/ | ||
| + | ''/ | ||
| + | |||
| + | Die Informationen stehen unter der URL http:// | ||
| + | |||
| + | === Erzeugen der / | ||
| + | |||
| + | Ein inotify-Eintrag auf das snapshots-Verzeichnis im Restic-Repository triggert das Schreiben einer JSON-Zustandsdatei mit dem Befehl | ||
| + | |||
| + | restic snapshots -c --json > / | ||
| + | | ||
| + | Dieser Befehl ist zusammen mit dem Restic-Passwort und dem Repository in ''/ | ||
| + | |||
| + | <code bash / | ||
| + | #!/bin/bash | ||
| + | / | ||
| + | export RESTIC_REPOSITORY=/ | ||
| + | export RESTIC_PASSWORD_FILE=/ | ||
| + | export HOME=/root | ||
| + | #/ | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | Die Automatisierung erfolgt über einen systemd-Service (vgl. https:// | ||
| + | |||
| + | <file bash / | ||
| + | [Unit] | ||
| + | Description=" | ||
| + | |||
| + | [Path] | ||
| + | PathModified=/ | ||
| + | Unit=restic-snapshots-mon.service | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | </ | ||
| + | |||
| + | <file bash / | ||
| + | [Unit] | ||
| + | Description=" | ||
| + | |||
| + | [Service] | ||
| + | ExecStart=/ | ||
| + | </ | ||
| + | |||
| + | <file bash / | ||
| + | #!/bin/bash | ||
| + | / | ||
| + | export RESTIC_REPOSITORY=/ | ||
| + | export RESTIC_PASSWORD_FILE=/ | ||
| + | export HOME=/root | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | Analysieren mit '' | ||
| + | Starten mit '' | ||
| + | Beim Systemstart hochfahren mit '' | ||
| + | Status überprüfen mit '' | ||
| + | Log-Einträge ansehen mit '' | ||
| + | |||
| + | Erzeugen der ''/ | ||
| + | @reboot | ||
| + | ==== Backuptree für Kontrolle und Restore ==== | ||
| + | Backups werden readonly im Verzeichnis ''/ | ||
| + | Der restic-mount-Prozess wird täglich zu einer festgesetzten Zeit gekillt und neu gestartet, damit die neuesten Änderungen sichtbar werden. | ||
| + | / | ||
| + | |||
| + | <code bash / | ||
| + | #!/bin/bash | ||
| + | #chmod 755 / | ||
| + | / | ||
| + | sleep 3 | ||
| + | / | ||
| + | -p / | ||
| + | mount \ | ||
| + | --allow-other \ | ||
| + | --no-default-permissions \ | ||
| + | --no-lock \ | ||
| + | / | ||
| + | |||
| + | </ | ||
| + | |||
| + | Links: | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | |||