Make encrypted storage requirement host configurable

This commit is contained in:
howard committed 2026-11-01 11:50:58 +13:00
1 parent 657ac97ee7
commit 06aa75095c
3 files changed
+14 -9

No files matched your search

+2
View File
@@ -18,6 +18,8 @@ ZSTD_EXTRA_OPTS="-T0 -12"
TAR_EXCLUDES="" TAR_EXCLUDES=""
# Final backup-run reports retained locally for this many days. # Final backup-run reports retained locally for this many days.
BACKUP_HISTORY_DAYS=30 BACKUP_HISTORY_DAYS=30
# Set to 1 when BACKUP_ROOT must reside on encrypted storage (e.g. Beaver).
BACKUP_REQUIRE_ENCRYPTED_STORAGE=0
# Optional retained MQTT status and command listener settings. # Optional retained MQTT status and command listener settings.
MQTT_REPORT_ENABLED=0 MQTT_REPORT_ENABLED=0
+1
View File
@@ -83,6 +83,7 @@ Copy `.env.example` to `.env`; `.env` is ignored by Git. Important values:
| `TAR_EXCLUDES` | Space-separated archive paths to omit, relative to `SOURCE_BASE_DIR` | | `TAR_EXCLUDES` | Space-separated archive paths to omit, relative to `SOURCE_BASE_DIR` |
| `BACKUP_HISTORY_FILE` | JSON Lines run-history file (default is shared with backup-status MCP) | | `BACKUP_HISTORY_FILE` | JSON Lines run-history file (default is shared with backup-status MCP) |
| `BACKUP_HISTORY_DAYS` | Days of completed run history to retain, default `30` | | `BACKUP_HISTORY_DAYS` | Days of completed run history to retain, default `30` |
| `BACKUP_REQUIRE_ENCRYPTED_STORAGE` | Refuse to run unless `/dockerbackups` is on `/srv/storage`; default `0` |
| `KEEP_COUNT` | Local archives retained per Compose project | | `KEEP_COUNT` | Local archives retained per Compose project |
| `PULL_IMAGES` | Pull images before restarting (`1` or `0`) | | `PULL_IMAGES` | Pull images before restarting (`1` or `0`) |
+11 -9
View File
@@ -25,6 +25,7 @@ ZSTD_EXTRA_OPTS="-T0 -12"
TAR_EXCLUDES="" TAR_EXCLUDES=""
BACKUP_HISTORY_FILE="/dockervolumes/openclaw/backup-status-mcp/history/backup-runs.jsonl" BACKUP_HISTORY_FILE="/dockervolumes/openclaw/backup-status-mcp/history/backup-runs.jsonl"
BACKUP_HISTORY_DAYS=30 BACKUP_HISTORY_DAYS=30
BACKUP_REQUIRE_ENCRYPTED_STORAGE=0
# Optional MQTT reporting and command-listener defaults. # Optional MQTT reporting and command-listener defaults.
MQTT_REPORT_ENABLED=0 MQTT_REPORT_ENABLED=0
MQTT_HOST="" MQTT_HOST=""
@@ -71,8 +72,16 @@ return 0
} }
die() { log ERROR "$1"; exit "${2:-1}"; } die() { log ERROR "$1"; exit "${2:-1}"; }
# Never let local backups silently fall back to the unencrypted root filesystem. is_true() {
if [[ "$BACKUP_ROOT" == "/dockerbackups" ]]; then case "${1,,}" in
1|true|yes|on|enabled) return 0 ;;
*) return 1 ;;
esac
}
# Never let local backups silently fall back to the unencrypted root filesystem
# on hosts that opt in (for example, Beaver's encrypted backup drive).
if is_true "${BACKUP_REQUIRE_ENCRYPTED_STORAGE:-0}" && [[ "$BACKUP_ROOT" == "/dockerbackups" ]]; then
if ! mountpoint -q /srv/storage || ! mountpoint -q "$BACKUP_ROOT"; then if ! mountpoint -q /srv/storage || ! mountpoint -q "$BACKUP_ROOT"; then
die "Backup root is not mounted on encrypted storage; refusing to run." die "Backup root is not mounted on encrypted storage; refusing to run."
fi fi
@@ -83,13 +92,6 @@ if [[ "$BACKUP_ROOT" == "/dockerbackups" ]]; then
fi fi
fi fi
is_true() {
case "${1,,}" in
1|true|yes|on|enabled) return 0 ;;
*) return 1 ;;
esac
}
require_command() { require_command() {
command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1" 3 command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1" 3
} }