ubuntu:navidrome
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| ubuntu:navidrome [2026/04/23 10:21] – [Config erstellen oder übernehmen] Sebastian Hetzel | ubuntu:navidrome [2026/04/30 20:56] (aktuell) – [Anwendung installieren] Sebastian Hetzel | ||
|---|---|---|---|
| Zeile 52: | Zeile 52: | ||
| </ | </ | ||
| + | ==== Logrotate ==== | ||
| + | |||
| + | <file bash / | ||
| + | / | ||
| + | { | ||
| + | rotate 14 | ||
| + | daily | ||
| + | missingok | ||
| + | notifempty | ||
| + | delaycompress | ||
| + | compress | ||
| + | create 640 navidrome navidrome | ||
| + | postrotate | ||
| + | if service navidrome status > /dev/null 2>& | ||
| + | touch / | ||
| + | chown navidrome: | ||
| + | service navidrome restart > /dev/null 2>& | ||
| + | fi; | ||
| + | endscript | ||
| + | sharedscripts | ||
| + | } | ||
| + | </ | ||
| ==== Daten wiederherstellen (bei Migration) ==== | ==== Daten wiederherstellen (bei Migration) ==== | ||
| Zeile 79: | Zeile 101: | ||
| mkdir -p / | mkdir -p / | ||
| mkdir -p / | mkdir -p / | ||
| + | mkdir -p / | ||
| + | chown -R navidrome: | ||
| + | chown -R navidrome: | ||
| + | </ | ||
| + | |||
| + | ==== Spezialfall music library ==== | ||
| + | |||
| + | Um die Bibliothek automatisiert auf dem Laufenden halten zu können, lege ich einen weiteren Service-User an und vergebe entsprechende Berechtigungen: | ||
| + | * navidrome --> lesen | ||
| + | * audioadmin --> lesen+schreiben | ||
| + | |||
| + | === Gruppen erstellen und berechtigen === | ||
| + | |||
| + | <code bash> | ||
| + | adduser audioadmin | ||
| + | groupadd losslessaudio | ||
| + | usermod -aG losslessaudio audioadmin | ||
| + | usermod -aG losslessaudio navidrome | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | chown -R audioadmin: | ||
| + | chmod -R 750 / | ||
| + | chmod g+s / | ||
| + | </ | ||
| + | |||
| + | === Default Berechtigungen setzen === | ||
| + | |||
| + | <code bash> | ||
| + | apt install acl | ||
| + | setfacl -d -m u:: | ||
| + | </ | ||
| + | ==== Service-User der Anwendung zuweisen ==== | ||
| + | |||
| + | < | ||
| + | vi / | ||
| + | </ | ||
| + | |||
| + | <file / | ||
| + | [Unit] | ||
| + | Description=Navidrome Music Server and Streamer compatible with Subsonic/ | ||
| + | After=remote-fs.target network.target | ||
| + | AssertPathExists=/ | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | |||
| + | [Service] | ||
| + | User=< | ||
| + | Group=< | ||
| + | Type=simple | ||
| + | ExecStart=/ | ||
| + | WorkingDirectory=/ | ||
| + | TimeoutStopSec=20 | ||
| + | KillMode=process | ||
| + | Restart=on-failure | ||
| + | |||
| + | # See https:// | ||
| + | DevicePolicy=closed | ||
| + | NoNewPrivileges=yes | ||
| + | PrivateTmp=yes | ||
| + | PrivateUsers=yes | ||
| + | ProtectControlGroups=yes | ||
| + | ProtectKernelModules=yes | ||
| + | ProtectKernelTunables=yes | ||
| + | RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 | ||
| + | RestrictNamespaces=yes | ||
| + | RestrictRealtime=yes | ||
| + | SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap | ||
| + | ReadWritePaths=/ | ||
| + | |||
| + | # You can uncomment the following line if you're not using the jukebox This | ||
| + | # will prevent navidrome from accessing any real (physical) devices | ||
| + | # | ||
| + | |||
| + | # You can change the following line to `strict` instead of `full` if you don't | ||
| + | # want navidrome to be able to write anything on your filesystem outside of | ||
| + | # / | ||
| + | ProtectSystem=full | ||
| + | |||
| + | # You can uncomment the following line if you don't have any media in /home/*. | ||
| + | # This will prevent navidrome from ever reading/ | ||
| + | # | ||
| + | |||
| + | # You can customize some Navidrome config options by setting environment variables here. Ex: | ||
| + | # | ||
| + | |||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | systemctl daemon-reload | ||
| + | systemctl start navidrome.service | ||
| + | systemctl status navidrome.service | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | systemctl cat navidrome|grep -i user | ||
| + | User=navidrome | ||
| + | WantedBy=multi-user.target | ||
| </ | </ | ||
| ===== Aktualisierung / Update der Server-Applikation ===== | ===== Aktualisierung / Update der Server-Applikation ===== | ||
| Zeile 142: | Zeile 263: | ||
| ===== Apache2 als Reverse-Proxy ===== | ===== Apache2 als Reverse-Proxy ===== | ||
| + | ==== Installation der Pakete ==== | ||
| - | < | + | < |
| - | < | + | apt update |
| - | <VirtualHost *:443> | + | apt install apache2 libapache2-mod-security2 |
| - | ServerName music.example.com | + | </code> |
| - | DocumentRoot / | + | |
| - | # Logs | + | Module im Apache aktivieren: |
| - | ErrorLog / | + | |
| - | CustomLog / | + | |
| - | # Proxy Settings | + | <code bash> |
| - | | + | a2enmod proxy proxy_http proxy_wstunnel headers rewrite ssl |
| - | | + | </code> |
| - | # WebSocket Support (Rewrites nur für Upgrade) | + | Dual Stack aktivieren --> '' |
| - | RewriteEngine On | + | |
| - | RewriteCond %{HTTP: | + | |
| - | RewriteRule | + | |
| - | # Normaler Proxy für alle anderen Requests | + | <code apache> |
| - | | + | Listen 80 |
| - | | + | Listen [::]:80 |
| + | Listen 443 | ||
| + | Listen [::]:443 | ||
| + | </code> | ||
| - | # Forwarded Headers | + | Apache-Version nicht bekannt geben --> ''/ |
| - | RequestHeader set X-Forwarded-Proto " | + | |
| - | RequestHeader set X-Forwarded-Port " | + | |
| - | RequestHeader set X-Forwarded-For " | + | |
| - | # Connection / Timeout Optimierungen | + | <code apache> |
| - | | + | # ServerTokens |
| - | MaxKeepAliveRequests 100 | + | # This directive configures what you return as the Server HTTP response |
| - | KeepAliveTimeout 5 | + | # Header. The default is ' |
| - | ProxyTimeout 300 | + | # and compiled in modules. |
| - | + | # Set to one of: Full | OS | Minimal | Minor | Major | Prod | |
| - | | + | # where Full conveys the most information, |
| - | # X-XSS-Protection ist veraltet, kann optional drinbleiben oder entfernt werden | + | # |
| - | # Header | + | ServerTokens Prod |
| - | Header always set X-Content-Type-Options " | + | # |
| - | | + | |
| - | + | ||
| - | | + | |
| - | Include / | + | |
| - | | + | |
| - | | + | |
| - | + | ||
| - | </ | + | |
| - | </ | + | |
| </ | </ | ||
| ===== ModSecurity-Konfiguration für Apache2 Reverse Proxy vor Navidrome ===== | ===== ModSecurity-Konfiguration für Apache2 Reverse Proxy vor Navidrome ===== | ||
| Zeile 208: | Zeile 315: | ||
| </ | </ | ||
| + | Einbindung in Apache unter '' | ||
| + | |||
| + | <file apache / | ||
| + | < | ||
| + | # Default Debian dir for modsecurity' | ||
| + | SecDataDir / | ||
| + | |||
| + | # Include all the *.conf files in / | ||
| + | # Keeping your local configuration in that directory | ||
| + | # will allow for an easy upgrade of THIS file and | ||
| + | # make your life easier | ||
| + | IncludeOptional / | ||
| + | # | ||
| + | IncludeOptional / | ||
| + | IncludeOptional / | ||
| + | |||
| + | # Include OWASP ModSecurity CRS rules if installed | ||
| + | # IncludeOptional / | ||
| + | |||
| + | # Defense against CVE-2021-44228 | ||
| + | SecRuleUpdateTargetById 932130 " | ||
| + | SecRuleUpdateTargetById 932130 " | ||
| + | |||
| + | </ | ||
| + | </ | ||
| ==== 2. Hauptkonfiguration ==== | ==== 2. Hauptkonfiguration ==== | ||
| Zeile 406: | Zeile 538: | ||
| <code apache> | <code apache> | ||
| - | < | + | < |
| - | ServerName music.example.com | + | < |
| + | ServerName music.example.de | ||
| + | ServerAlias music.example.net | ||
| + | DocumentRoot / | ||
| - | ProxyPreserveHost On | + | ErrorLog |
| - | ProxyPass | + | |
| - | | + | |
| - | # Sicherheit | + | ProxyPreserveHost On |
| - | | + | |
| - | | + | # |
| - | Header always set X-XSS-Protection | + | |
| - | | + | |
| - | | + | |
| - | CustomLog | + | RewriteCond %{HTTP: |
| + | RewriteRule | ||
| + | |||
| + | # Alles andere Proxy | ||
| + | ProxyPass / http:// | ||
| + | ProxyPassReverse / http:// | ||
| + | |||
| + | RequestHeader set X-Forwarded-Proto " | ||
| + | RequestHeader set X-Forwarded-Port " | ||
| + | RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}s" | ||
| + | Header always set X-XSS-Protection "1; mode=block" | ||
| + | |||
| + | KeepAlive On | ||
| + | MaxKeepAliveRequests 100 | ||
| + | KeepAliveTimeout 5 | ||
| + | ProxyTimeout 300 | ||
| + | |||
| + | Include | ||
| + | Include / | ||
| + | SSLCertificateFile | ||
| + | SSLCertificateKeyFile | ||
| + | Header always set Strict-Transport-Security " | ||
| </ | </ | ||
| + | </ | ||
| </ | </ | ||
| - | |||
| ==== 7. Test & Debug ==== | ==== 7. Test & Debug ==== | ||
ubuntu/navidrome.1776932488.txt.gz · Zuletzt geändert: von Sebastian Hetzel
