Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| computer:ubuntu:restic-backup-docker-hermes [2024/02/27 18:22] – [Service-Unitfile anlegen] spring | computer:ubuntu:restic-backup-docker-hermes [2024/12/15 09:13] (current) – [Restic Backup im Netzwerk] spring | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Restic Backup im Netzwerk ====== | ====== Restic Backup im Netzwerk ====== | ||
| - | Übersicht über alle Backups: '' | + | Übersicht über alle Backups: '' |
| + | |||
| + | Idee aus perplexity: | ||
| + | |||
| + | To protect access to Traefik services from the internet using basic authentication while leaving intranet access unprotected, | ||
| + | Configuration Steps | ||
| + | |||
| + | Create a BasicAuth middleware for external access: | ||
| + | |||
| + | text | ||
| + | < | ||
| + | http: | ||
| + | middlewares: | ||
| + | basic-auth: | ||
| + | basicAuth: | ||
| + | users: | ||
| + | - " | ||
| + | </ | ||
| + | Create an IPWhiteList middleware for internal access: | ||
| + | |||
| + | text | ||
| + | < | ||
| + | http: | ||
| + | middlewares: | ||
| + | internal-whitelist: | ||
| + | ipWhiteList: | ||
| + | sourceRange: | ||
| + | - " | ||
| + | - " | ||
| + | - " | ||
| + | </ | ||
| + | Set up a middleware chain combining both: | ||
| + | |||
| + | text | ||
| + | < | ||
| + | http: | ||
| + | middlewares: | ||
| + | secure-chain: | ||
| + | chain: | ||
| + | middlewares: | ||
| + | - internal-whitelist | ||
| + | - basic-auth | ||
| + | </ | ||
| + | Apply the middleware chain to your router: | ||
| + | |||
| + | text | ||
| + | < | ||
| + | http: | ||
| + | routers: | ||
| + | my-service: | ||
| + | rule: " | ||
| + | service: " | ||
| + | middlewares: | ||
| + | - secure-chain | ||
| + | </ | ||
| + | This configuration will allow unrestricted access from the specified internal IP ranges while requiring basic authentication for external access2 | ||
| + | 4 | ||
| + | . | ||
| + | Additional Considerations | ||
| + | |||
| + | Ensure you replace the example BasicAuth credentials with your own securely hashed passwords1 | ||
| + | 5 | ||
| + | . | ||
| + | Adjust the IP ranges in the IPWhiteList middleware to match your internal network configuration4 | ||
| + | . | ||
| + | For enhanced security, consider using more robust authentication methods like Authelia or Authentik for external access6 | ||
| + | . | ||
| + | |||
| + | By implementing this setup, you can effectively protect your Traefik services from unauthorized external access while maintaining convenient internal access within your network. | ||
| + | can the name " | ||
| + | Sources | ||
| + | Answer | ||
| + | The name " | ||
| + | 2 | ||
| + | . You can choose any name you prefer for your middleware, as long as it follows Traefik' | ||
| + | 6 | ||
| + | . When defining a middleware, you typically use a structure like: | ||
| + | < | ||
| + | text | ||
| + | http: | ||
| + | middlewares: | ||
| + | your-chosen-name: | ||
| + | basicAuth: | ||
| + | # configuration details | ||
| + | </ | ||
| + | Just remember to reference the middleware using the name you've chosen when applying it to your routers or services2 | ||
| + | 5 | ||
| + | |||
| + | The general format for defining a router in Traefik labels is: | ||
| + | |||
| + | text | ||
| + | - " | ||
| + | |||
| + | Where < | ||
| + | |||
| ===== Restic Server auf hermes ===== | ===== Restic Server auf hermes ===== | ||
| Line 10: | Line 105: | ||
| ( von https:// | ( von https:// | ||
| Systemd erlaubt das Starten von Services auch einmal/Tag. | Systemd erlaubt das Starten von Services auch einmal/Tag. | ||
| + | |||
| + | Achtung: Auf Ubuntu prüfen ob restic in /usr/bin oder / | ||
| ==== Service-Unitfile anlegen ==== | ==== Service-Unitfile anlegen ==== | ||
| - | sudo systemctl edit --force --full restic.service | + | < |
| <file bash> | <file bash> | ||
| # from https:// | # from https:// | ||
| [Unit] | [Unit] | ||
| Description=Restic backup service | Description=Restic backup service | ||
| + | After=network-online.target | ||
| + | Wants=network-online.service | ||
| + | StartLimitIntervalSec=6000 | ||
| + | StartLimitBurst=30 | ||
| [Service] | [Service] | ||
| Line 21: | Line 122: | ||
| ExecStart=/ | ExecStart=/ | ||
| EnvironmentFile=/ | EnvironmentFile=/ | ||
| + | Restart=on-failure | ||
| + | RestartSec=60 | ||
| [Install] | [Install] | ||
| - | WantedBy=multi-user.target | + | WantedBy=default.target |
| - | WantedBy=network-online.target | + | |
| </ | </ | ||
| Line 39: | Line 141: | ||
| ==== Service starten/ | ==== Service starten/ | ||
| * Änderungen mitteilen mit '' | * Änderungen mitteilen mit '' | ||
| - | * Starten mit '' | + | * Starten mit '' |
| - | * Als Dienst einrichten mit '' | + | * Als Dienst einrichten mit '' |
| - | * Dienst prüfen mit '' | + | * Dienst prüfen mit '' |
| + | |||
| + | ==== Timer anlegen ==== | ||
| + | < | ||
| + | <file bash> | ||
| + | Description=Backup with restic daily | ||
| + | |||
| + | [Timer] | ||
| + | OnCalendar=daily | ||
| + | OnActiveSec=30 | ||
| + | Persistent=true | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=timers.target | ||
| + | </ | ||
| + | * Enablen mit < | ||
| + | * Status prüfen mit < | ||
| ===== Restic Backups von kudell und denkbrett - DEPRECATED - ===== | ===== Restic Backups von kudell und denkbrett - DEPRECATED - ===== | ||
| Line 282: | Line 400: | ||
| - " | - " | ||
| - " | - " | ||
| - | - " | + | - " |
| - " | - " | ||
| - " | - " | ||
| Line 295: | Line 413: | ||
| Test auf dem netcup-Server | Test auf dem netcup-Server | ||
| - | export RESTIC_REPOSITORY=" | + | export RESTIC_REPOSITORY=" |
| restic -v snapshots | restic -v snapshots | ||
| restic -v --exclude-file=/ | restic -v --exclude-file=/ | ||