Compare commits

..
Author SHA1 Message Date
MickLesk 5b7de9c71d Obsidian LiveSync: refuse anonymous requests to CouchDB
require_valid_user was set only under [chttpd_auth], which CouchDB 3 does
not enforce, so the server root and Fauxton answered without credentials.
It now sits under [chttpd] as in upstream's init script, with
chttpd enable_cors; updates add both to existing installs.
2026-12-06 10:49:59 +01:00
8 changed files with 76 additions and 86 deletions

No files matched your search

+2 -22
View File
@@ -76,9 +76,7 @@ EOF
sleep 1
chown -R hermes:hermes /home/hermes || msg_warn "Could not take ownership of everything under /home/hermes"
fi
if [[ -f /home/hermes/.config/systemd/user/hermes-dashboard.service && ! -f /home/hermes/.hermes/backend_migration.json ]]; then
$STD runuser -l hermes -c 'systemctl --user daemon-reload && systemctl --user enable hermes-dashboard'
fi
$STD runuser -l hermes -c 'systemctl --user daemon-reload && systemctl --user enable hermes-dashboard'
NODE_VERSION="22" setup_nodejs
@@ -90,26 +88,8 @@ EOF
msg_ok "Updated Hermes Agent"
msg_info "Starting Services"
$STD runuser -l hermes -c '
systemctl --user daemon-reload
if systemctl --user is-enabled -q hermes-dashboard 2>/dev/null; then systemctl --user start hermes-dashboard; fi
if systemctl --user is-enabled -q hermes-gateway 2>/dev/null; then systemctl --user restart hermes-gateway; fi
'
$STD runuser -l hermes -c 'systemctl --user start hermes-dashboard'
msg_ok "Started Services"
# hermes dashboard is deprecated; upstream moves it onto the gateway's Webapp on the same address.
if [[ -f /home/hermes/.config/systemd/user/hermes-dashboard.service && ! -f /home/hermes/.hermes/backend_migration.json ]]; then
msg_info "Moving the Dashboard to the Gateway's Webapp"
for _ in {1..30}; do
curl -so /dev/null http://127.0.0.1:9119/ && break
sleep 1
done
if $STD runuser -l hermes -c 'set -a; source /etc/default/hermes; set +a; hermes gateway migrate --backends --apply --yes'; then
msg_ok "Moved the Dashboard to the Gateway's Webapp"
else
msg_warn "Could not move the Dashboard to the Gateway's Webapp, it keeps running"
fi
fi
msg_ok "Updated successfully!"
exit
}
+3 -3
View File
@@ -459,14 +459,14 @@ function fetch_prebuilt_libs() {
local oci_dir
oci_dir="$(mktemp -d)"
PREBUILT_BUNDLE="$(mktemp -d)"
if ! $STD skopeo copy --retry-times 3 --override-os linux --override-arch "$(arch_resolve amd64 arm64)" "docker://${image}" "oci:${oci_dir}:img"; then
if ! $STD skopeo copy --override-os linux --override-arch "$(arch_resolve amd64 arm64)" "docker://${image}" "oci:${oci_dir}:img"; then
rm -rf "$oci_dir" "$PREBUILT_BUNDLE"
msg_error "Could not download Immich's base image (${image}). Immich was not updated."
exit 115
fi
if ! $STD umoci unpack --rootless --image "${oci_dir}:img" "$PREBUILT_BUNDLE"; then
if ! $STD umoci unpack --image "${oci_dir}:img" "$PREBUILT_BUNDLE"; then
rm -rf "$oci_dir" "$PREBUILT_BUNDLE"
msg_error "Could not unpack Immich's base image. Immich was not updated."
msg_error "Could not unpack Immich's base image. Immich needs Proxmox VE 9.1 or newer; it was not updated."
exit 105
fi
rm -rf "$oci_dir"
+15 -25
View File
@@ -32,47 +32,37 @@ function update_script() {
fi
RELEASE=$(get_latest_gl_tag "g33kphr33k/musicgrabber" "v*")
if [[ "$RELEASE" == "$(cat ~/.musicgrabber 2>/dev/null)" ]] && systemctl is-active -q musicgrabber; then
if [[ "$RELEASE" == "$(cat ~/.musicgrabber 2>/dev/null)" ]]; then
msg_ok "No update required. ${APP} is already at ${RELEASE}"
exit
fi
DOCKERFILE="$(curl -fsSL "https://gitlab.com/g33kphr33k/musicgrabber/-/raw/${RELEASE}/Dockerfile")"
PYTHON_VERSION="$(grep -oP '^FROM python:\K[0-9]+\.[0-9]+' <<<"$DOCKERFILE" | tail -n1 || true)"
mapfile -t PIP_DEPS < <(awk '{ if (sub(/\\$/, "")) printf "%s ", $0; else print }' <<<"$DOCKERFILE" | sed 's/&&/\n/g' | sed -n -E 's/^(RUN)?[[:space:]]*pip install //p' | tr -d "\"'" | tr -s ' ' '\n' | grep -E '^[A-Za-z0-9][A-Za-z0-9._-]*(\[[A-Za-z0-9,_-]+\])?([~=!<>]=?[^[:space:]]+)?$')
if [[ -z "$PYTHON_VERSION" || ${#PIP_DEPS[@]} -eq 0 ]]; then
msg_error "MusicGrabber ${RELEASE} does not name its Python version and packages in the Dockerfile. Nothing was changed."
exit 250
fi
msg_info "Stopping MusicGrabber"
systemctl stop musicgrabber
msg_ok "Stopped MusicGrabber"
setup_uv
fetch_and_deploy_gh_release "yt-dlp" "yt-dlp/yt-dlp" "singlefile" "latest" "/usr/local/bin" "yt-dlp_$(arch_resolve "linux" "linux_aarch64")"
fetch_and_deploy_gh_release "deno" "denoland/deno" "prebuild" "latest" "/usr/local/bin" "deno-$(arch_resolve "x86_64" "aarch64")-unknown-linux-gnu.zip"
CLEAN_INSTALL=1 fetch_and_deploy_gl_tag "musicgrabber" "g33kphr33k/musicgrabber" "$RELEASE"
CLEAN_INSTALL=1 CLEAN_INSTALL_KEEP=".venv" fetch_and_deploy_gl_tag "musicgrabber" "g33kphr33k/musicgrabber" "$RELEASE"
msg_info "Updating MusicGrabber"
cd /opt/musicgrabber
$STD uv venv --clear --python "$PYTHON_VERSION" .venv
$STD uv pip install --python .venv/bin/python "${PIP_DEPS[@]}"
$STD uv pip install --python .venv/bin/python \
"fastapi~=0.162.0" \
"uvicorn[standard]~=0.54.0" \
"httpx~=0.28.1" \
"pydantic~=2.14.1" \
"mutagen~=1.48.1" \
"playwright~=1.64.1" \
"apprise>=1.13.1,<2" \
"bcrypt~=4.3.0" \
"pycryptodome~=4.2.0" \
"certifi>=2026.10.18" \
"seleniumbase>=4.54,<5"
PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright $STD .venv/bin/playwright install chromium
if [[ "$(arch_resolve)" == "amd64" ]]; then
$STD .venv/bin/sbase get uc_driver stable
else
install -m 755 /usr/bin/chromedriver ".venv/lib/python${PYTHON_VERSION}/site-packages/seleniumbase/drivers/uc_driver"
fi
$STD .venv/bin/python -c "from pathlib import Path; import seleniumbase; from seleniumbase.undetected.patcher import Patcher; driver = Path(seleniumbase.__file__).parent / 'drivers' / 'uc_driver'; Patcher(executable_path=str(driver)).auto(); driver.chmod(0o755)"
msg_ok "Updated MusicGrabber"
FLAC_VERIFIER_VERSION="$(grep -m1 -oP 'flac-verifier/releases/download/v\K[0-9.]+' /opt/musicgrabber/Dockerfile || true)"
if [[ -n "$FLAC_VERIFIER_VERSION" ]]; then
CLEAN_INSTALL=1 fetch_and_deploy_from_url "https://github.com/FraysKosher/flac-verifier/releases/download/v${FLAC_VERIFIER_VERSION}/flac-verifier-cli-${FLAC_VERIFIER_VERSION}-$(arch_resolve "x86_64" "aarch64")-unknown-linux-musl.tar.gz" "/opt/flac-verifier"
else
msg_warn "MusicGrabber names no FLAC Verifier release, the lossless check stays unavailable"
fi
CLEAN_INSTALL=1 fetch_and_deploy_from_url "https://codeload.github.com/FraysKosher/flac-verifier/tar.gz/$(grep -oP 'FraysKosher/flac-verifier/tar.gz/\K[0-9a-f]+' /opt/musicgrabber/Dockerfile)" "/opt/flac-verifier/engine"
msg_info "Starting MusicGrabber"
systemctl start musicgrabber
+5
View File
@@ -45,6 +45,11 @@ function update_script() {
systemctl stop couchdb
restore_backup
# Only [chttpd] require_valid_user makes CouchDB 3 refuse anonymous requests
if ! sed -n '/^\[chttpd\]/,/^\[/p' /opt/couchdb/etc/local.d/obsidian-livesync.ini | grep -q '^require_valid_user'; then
sed -i '/^\[chttpd\]/a require_valid_user = true\nenable_cors = true' /opt/couchdb/etc/local.d/obsidian-livesync.ini
fi
msg_info "Starting CouchDB"
systemctl start couchdb
msg_ok "Started CouchDB"
+25 -12
View File
@@ -63,23 +63,36 @@ chown hermes:hermes /home/hermes/.hermes/.env
chmod 600 /home/hermes/.hermes/.env
msg_ok "Configured API Server"
msg_info "Setting up Gateway and Webapp"
$STD runuser -l hermes -c '
set -a; source /etc/default/hermes; set +a
hermes webapp --build-only
hermes config set webapp.enabled true
hermes config set webapp.host 127.0.0.1
hermes config set webapp.port 9119
hermes gateway install
systemctl --user enable --now hermes-gateway
'
msg_ok "Set up Gateway and Webapp"
msg_info "Creating Dashboard Service"
mkdir -p /home/hermes/.config/systemd/user
cat <<EOF >/home/hermes/.config/systemd/user/hermes-dashboard.service
[Unit]
Description=Hermes Agent Web Dashboard
After=network-online.target
[Service]
Type=simple
UMask=0077
WorkingDirectory=%h
EnvironmentFile=/etc/default/hermes
ExecStart=%h/.local/bin/hermes dashboard --host 127.0.0.1 --port 9119 --no-open
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target
EOF
chown -R hermes:hermes /home/hermes/.config
$STD runuser -l hermes -c 'systemctl --user daemon-reload && systemctl --user enable --now hermes-dashboard'
msg_ok "Created Dashboard Service"
msg_info "Creating Setup Helper"
cat <<'SETUP' >/usr/bin/hermes-setup
#!/usr/bin/env bash
su - hermes -c 'set -a; source /etc/default/hermes; set +a; hermes setup'
su - hermes -c 'systemctl --user enable -q hermes-gateway && systemctl --user restart hermes-gateway'
if [[ -f /home/hermes/.config/systemd/user/hermes-gateway.service ]]; then
su - hermes -c 'systemctl --user enable --now hermes-gateway'
fi
echo "Hermes setup complete."
SETUP
chmod +x /usr/bin/hermes-setup
+4 -6
View File
@@ -204,7 +204,7 @@ export LD_RUN_PATH=/usr/local/lib
# Immich ships the custom photo-processing libraries (libjxl, jpegli, libheif,
# libraw, ImageMagick, libvips) prebuilt in its own OCI base image. Pull the one
# the release's Dockerfile pins (skopeo + umoci, no container runtime) and use its
# /usr/local. There is no compile fallback.
# /usr/local. There is no compile fallback: this needs Proxmox VE 9.1 or newer.
msg_info "Deploying prebuilt image-processing libraries"
BASE_REF="$(curl -fsSL "https://raw.githubusercontent.com/immich-app/immich/${RELEASE}/server/Dockerfile" | awk '/^FROM ghcr.io\/immich-app\/base-server-dev/ {print $2; exit}')" || true
if [[ -z "$BASE_REF" ]]; then
@@ -220,16 +220,14 @@ if ! $STD apt install -y --no-install-recommends skopeo umoci; then
fi
OCI_DIR="$(mktemp -d)"
OCI_BUNDLE="$(mktemp -d)"
if ! $STD skopeo copy --retry-times 3 --override-os linux --override-arch "$(arch_resolve amd64 arm64)" "docker://${BASE_IMAGE}" "oci:${OCI_DIR}:img"; then
if ! $STD skopeo copy --override-os linux --override-arch "$(arch_resolve amd64 arm64)" "docker://${BASE_IMAGE}" "oci:${OCI_DIR}:img"; then
rm -rf "$OCI_DIR" "$OCI_BUNDLE"
msg_error "Could not download Immich's base image (${BASE_IMAGE})."
exit 115
fi
# --rootless skips restoring the image's owners: a container whose idmap leaves out
# one of them (uid 1000 for bind mounts) fails lchown with "invalid argument".
if ! $STD umoci unpack --rootless --image "${OCI_DIR}:img" "$OCI_BUNDLE"; then
if ! $STD umoci unpack --image "${OCI_DIR}:img" "$OCI_BUNDLE"; then
rm -rf "$OCI_DIR" "$OCI_BUNDLE"
msg_error "Could not unpack Immich's base image."
msg_error "Could not unpack Immich's base image. Immich needs Proxmox VE 9.1 or newer."
exit 105
fi
# The libraries, headers and ImageMagick data, without the node runtime, global
+20 -18
View File
@@ -21,23 +21,26 @@ $STD apt install -y \
msg_ok "Installed Dependencies"
setup_ffmpeg
PYTHON_VERSION="3.12" setup_uv
fetch_and_deploy_gh_release "yt-dlp" "yt-dlp/yt-dlp" "singlefile" "latest" "/usr/local/bin" "yt-dlp_$(arch_resolve "linux" "linux_aarch64")"
fetch_and_deploy_gh_release "deno" "denoland/deno" "prebuild" "latest" "/usr/local/bin" "deno-$(arch_resolve "x86_64" "aarch64")-unknown-linux-gnu.zip"
fetch_and_deploy_gl_tag "musicgrabber" "g33kphr33k/musicgrabber" "v*"
DOCKERFILE="$(</opt/musicgrabber/Dockerfile)"
PYTHON_VERSION="$(grep -oP '^FROM python:\K[0-9]+\.[0-9]+' <<<"$DOCKERFILE" | tail -n1 || true)"
mapfile -t PIP_DEPS < <(awk '{ if (sub(/\\$/, "")) printf "%s ", $0; else print }' <<<"$DOCKERFILE" | sed 's/&&/\n/g' | sed -n -E 's/^(RUN)?[[:space:]]*pip install //p' | tr -d "\"'" | tr -s ' ' '\n' | grep -E '^[A-Za-z0-9][A-Za-z0-9._-]*(\[[A-Za-z0-9,_-]+\])?([~=!<>]=?[^[:space:]]+)?$')
if [[ -z "$PYTHON_VERSION" || ${#PIP_DEPS[@]} -eq 0 ]]; then
msg_error "MusicGrabber's Dockerfile does not name its Python version and packages"
exit 250
fi
setup_uv
msg_info "Setting up MusicGrabber"
cd /opt/musicgrabber
$STD uv venv --python "$PYTHON_VERSION" .venv
$STD uv pip install --python .venv/bin/python "${PIP_DEPS[@]}"
$STD uv venv --python 3.12 .venv
$STD uv pip install --python .venv/bin/python \
"fastapi~=0.162.0" \
"uvicorn[standard]~=0.54.0" \
"httpx~=0.28.1" \
"pydantic~=2.14.1" \
"mutagen~=1.48.1" \
"playwright~=1.64.1" \
"apprise>=1.13.1,<2" \
"bcrypt~=4.3.0" \
"pycryptodome~=4.2.0" \
"certifi>=2026.10.18" \
"seleniumbase>=4.54,<5"
PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright $STD .venv/bin/playwright install --with-deps chromium
msg_ok "Set up MusicGrabber"
@@ -53,17 +56,16 @@ if [[ "$(arch_resolve)" == "amd64" ]]; then
$STD .venv/bin/sbase get uc_driver stable
else
$STD apt install -y chromium chromium-driver
install -m 755 /usr/bin/chromedriver ".venv/lib/python${PYTHON_VERSION}/site-packages/seleniumbase/drivers/uc_driver"
install -m 755 /usr/bin/chromedriver .venv/lib/python3.12/site-packages/seleniumbase/drivers/uc_driver
fi
$STD .venv/bin/python -c "from pathlib import Path; import seleniumbase; from seleniumbase.undetected.patcher import Patcher; driver = Path(seleniumbase.__file__).parent / 'drivers' / 'uc_driver'; Patcher(executable_path=str(driver)).auto(); driver.chmod(0o755)"
msg_ok "Installed Browser for SeleniumBase"
FLAC_VERIFIER_VERSION="$(grep -m1 -oP 'flac-verifier/releases/download/v\K[0-9.]+' /opt/musicgrabber/Dockerfile || true)"
if [[ -n "$FLAC_VERIFIER_VERSION" ]]; then
fetch_and_deploy_from_url "https://github.com/FraysKosher/flac-verifier/releases/download/v${FLAC_VERIFIER_VERSION}/flac-verifier-cli-${FLAC_VERIFIER_VERSION}-$(arch_resolve "x86_64" "aarch64")-unknown-linux-musl.tar.gz" "/opt/flac-verifier"
else
msg_warn "MusicGrabber names no FLAC Verifier release, the lossless check stays unavailable"
fi
msg_info "Setting up FLAC Verifier"
$STD uv venv --python 3.12 /opt/flac-verifier
$STD uv pip install --python /opt/flac-verifier/bin/python "numpy==2.2.6" "scipy==1.15.3" "soundfile==0.13.1" "mutagen==1.47.0"
msg_ok "Set up FLAC Verifier"
fetch_and_deploy_from_url "https://codeload.github.com/FraysKosher/flac-verifier/tar.gz/$(grep -oP 'FraysKosher/flac-verifier/tar.gz/\K[0-9a-f]+' /opt/musicgrabber/Dockerfile)" "/opt/flac-verifier/engine"
msg_info "Configuring MusicGrabber"
mkdir -p /opt/musicgrabber_data/music
+2
View File
@@ -60,6 +60,8 @@ admin = ${COUCHDB_PASSWORD}
bind_address = 0.0.0.0
port = 5984
max_http_request_size = 4294967296
require_valid_user = true
enable_cors = true
[chttpd_auth]
require_valid_user = true