Harden backup and restore operations
This commit is contained in:
+24
-9
@@ -4,30 +4,45 @@ DAEMON=/usr/local/sbin/urbmd
|
||||
PIDFILE=/run/urbm/urbm.pid
|
||||
LOGFILE=/var/log/urbm.log
|
||||
|
||||
is_daemon_pid() {
|
||||
PID=${1:-}
|
||||
[ -n "$PID" ] && [ "$(readlink -f "/proc/$PID/exe" 2>/dev/null)" = "$DAEMON" ]
|
||||
}
|
||||
|
||||
start() {
|
||||
mkdir -p /run/urbm /var/lib/urbm /boot/config/plugins/urbm
|
||||
chmod 0750 /run/urbm /var/lib/urbm
|
||||
chmod 0700 /boot/config/plugins/urbm
|
||||
if [ -s "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then
|
||||
if [ -s "$PIDFILE" ] && is_daemon_pid "$(cat "$PIDFILE")"; then
|
||||
return 0
|
||||
fi
|
||||
rm -f "$PIDFILE" /run/urbm/urbm.sock
|
||||
nohup "$DAEMON" >>"$LOGFILE" 2>&1 &
|
||||
echo $! >"$PIDFILE"
|
||||
for _ in $(seq 1 50); do
|
||||
[ -S /run/urbm/urbm.sock ] && return 0
|
||||
is_daemon_pid "$(cat "$PIDFILE" 2>/dev/null)" || break
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
echo "urbmd failed to create its API socket" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
stop() {
|
||||
STOPPED=0
|
||||
if [ -s "$PIDFILE" ]; then
|
||||
PID=$(cat "$PIDFILE")
|
||||
kill "$PID" 2>/dev/null || true
|
||||
for _ in $(seq 1 30); do
|
||||
kill -0 "$PID" 2>/dev/null || break
|
||||
sleep 1
|
||||
done
|
||||
kill -9 "$PID" 2>/dev/null || true
|
||||
if is_daemon_pid "$PID"; then
|
||||
kill "$PID" 2>/dev/null || true
|
||||
for _ in $(seq 1 30); do
|
||||
is_daemon_pid "$PID" || break
|
||||
sleep 1
|
||||
done
|
||||
is_daemon_pid "$PID" && kill -9 "$PID" 2>/dev/null || true
|
||||
STOPPED=1
|
||||
fi
|
||||
rm -f "$PIDFILE"
|
||||
STOPPED=1
|
||||
fi
|
||||
if [ "$STOPPED" -eq 0 ]; then
|
||||
PIDS=$(pidof urbmd 2>/dev/null || true)
|
||||
@@ -50,7 +65,7 @@ case "${1:-}" in
|
||||
stop) stop ;;
|
||||
restart) stop; start ;;
|
||||
status)
|
||||
if [ -s "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then echo "urbmd is running"; else echo "urbmd is stopped"; exit 1; fi
|
||||
if [ -s "$PIDFILE" ] && is_daemon_pid "$(cat "$PIDFILE")"; then echo "urbmd is running"; else echo "urbmd is stopped"; exit 1; fi
|
||||
;;
|
||||
*) echo "Usage: $0 {start|stop|restart|status}"; exit 2 ;;
|
||||
esac
|
||||
|
||||
+7
-1
@@ -2,13 +2,19 @@
|
||||
<!DOCTYPE PLUGIN [
|
||||
<!ENTITY name "urbm">
|
||||
<!ENTITY author "Michael Roll">
|
||||
<!ENTITY version "2026.07.10.r007">
|
||||
<!ENTITY version "2026.07.13.r001">
|
||||
<!ENTITY pluginURL "https://git.casaderoll.de/michael/URBM/raw/branch/main/dist/urbm.plg">
|
||||
<!ENTITY packageURL "https://git.casaderoll.de/michael/URBM/raw/branch/main/dist/urbm-&version;-x86_64-1.txz">
|
||||
<!ENTITY packageSHA256 "REPLACE_DURING_RELEASE">
|
||||
]>
|
||||
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="7.0.0" support="https://git.casaderoll.de/michael/URBM/issues" icon="urbm.png">
|
||||
<CHANGES>
|
||||
### 2026.07.13.r001
|
||||
- Harden restore task validation and make confirmed in-place restores target original paths safely.
|
||||
- Serialize repository and managed-mount access, block unsafe force-unlock operations, and wait for task cleanup during daemon shutdown.
|
||||
- Bound snapshot browser memory, stream Restic diffs, continuously drain command output, and reject symlink-overlapping Rsync paths.
|
||||
- Activate persistent run logs and align package, WebGUI, and manifest versions during builds.
|
||||
|
||||
### 2026.07.10.r007
|
||||
- Serve snapshot browser folders as compact cached tree pages instead of sending the complete Restic file list to the browser.
|
||||
- Prevent large snapshots with hundreds of thousands of entries from failing with generic 500 responses during snapshot browsing.
|
||||
|
||||
Reference in New Issue
Block a user