vpnbot-xray-patches/scripts/install_promoter.sh
loop-uh 2182380422
All checks were successful
Follow official Xray dev releases / candidate (push) Successful in 39s
Test and build VPnBot Xray patches / test-and-build (push) Successful in 2m43s
Наблюдатель выпусков Xray: состояние читает группа vpnbot — служба наблюдаемости VPnBot уходит от root
Служба наблюдаемости VPnBot (карточка «Обновления Xray» на status.zapret.moe)
читает /var/lib/vpnbot-xray-release-alert/state.json. С 04.11.2026 службы
VPnBot по одной уходят от root на учётную запись vpnbot, а файл лежал
root:root 0600 в каталоге 0700, и карточка не могла его прочитать.

- Юнит наблюдателя: Group=vpnbot, UMask=0027.
- scripts/release_alert_monitor.py: состояние 0640 (STATE_FILE_MODE), каталог
  0750 (STATE_DIR_MODE); проверка файла разрешает группе только чтение и
  только для состояния (group_reads); env-файлы с токеном и lock остаются
  только у владельца.
- scripts/install_promoter.sh: каталог root:vpnbot 0750, существующий
  state.json — группа vpnbot, 0640.
- План оповещений: раздел «Безопасность» называет новые режимы.

Тест: после сверки каталог 0750, состояние 0640, lock 0600; состояние с
записью для группы отвергается.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:59:11 -05:00

57 lines
2.4 KiB
Shell
Executable file

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
readonly SCRIPT_DIR
REPOSITORY_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd -P)"
readonly REPOSITORY_ROOT
if [[ "$(id -u)" -ne 0 ]]; then
printf 'install-promoter: run as root\n' >&2
exit 1
fi
install -d -m 0755 /usr/local/libexec/vpnbot-xray-release-promoter
install -m 0755 \
"${REPOSITORY_ROOT}/scripts/release_pipeline.py" \
"${REPOSITORY_ROOT}/scripts/canary_active_revoke.py" \
"${REPOSITORY_ROOT}/scripts/check_no_mptcp_listener.py" \
"${REPOSITORY_ROOT}/scripts/pilot_and_promote.py" \
"${REPOSITORY_ROOT}/scripts/release_alert_monitor.py" \
/usr/local/libexec/vpnbot-xray-release-promoter/
install -m 0644 \
"${REPOSITORY_ROOT}/systemd/vpnbot-xray-release-promoter.service" \
"${REPOSITORY_ROOT}/systemd/vpnbot-xray-release-promoter.timer" \
"${REPOSITORY_ROOT}/systemd/vpnbot-xray-release-alert.service" \
"${REPOSITORY_ROOT}/systemd/vpnbot-xray-release-alert.timer" \
/etc/systemd/system/
install -d -m 0700 /var/lib/vpnbot-xray-release-promoter
# The VPnBot observability service reads state.json as group vpnbot.
install -d -m 0750 -o root -g vpnbot /var/lib/vpnbot-xray-release-alert
if [[ -f /var/lib/vpnbot-xray-release-alert/state.json ]]; then
chgrp vpnbot /var/lib/vpnbot-xray-release-alert/state.json
chmod 0640 /var/lib/vpnbot-xray-release-alert/state.json
fi
systemctl daemon-reload
if [[ -f /etc/vpnbot-xray-release-promoter.env ]]; then
chmod 0600 /etc/vpnbot-xray-release-promoter.env
systemctl enable --now vpnbot-xray-release-promoter.timer
printf 'Installed and enabled vpnbot-xray-release-promoter.timer\n'
else
printf '%s\n' \
'Installed promoter files, but the timer was not enabled.' \
'Create /etc/vpnbot-xray-release-promoter.env from the example, then run:' \
'systemctl enable --now vpnbot-xray-release-promoter.timer'
fi
if [[ -f /etc/vpnbot-xray-release-alert.env ]]; then
chmod 0600 /etc/vpnbot-xray-release-alert.env
systemctl enable --now vpnbot-xray-release-alert.timer
printf 'Installed and enabled vpnbot-xray-release-alert.timer\n'
else
printf '%s\n' \
'Installed release alert files, but the timer was not enabled.' \
'Create /etc/vpnbot-xray-release-alert.env from the example, then run:' \
'systemctl enable --now vpnbot-xray-release-alert.timer'
fi