From e0d63f55e6ea84b193353b1f2a42f5ec510f7970 Mon Sep 17 00:00:00 2001 From: gentpan Date: Tue, 15 Sep 2026 04:46:04 +0500 Subject: [PATCH] =?UTF-8?q?GeoLite2=20=E8=84=9A=E6=9C=AC=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E6=8A=8A=20/etc/openstats=20=E6=94=B9=E6=88=90=20700?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 同步服务以 openstats-sync 用户运行,要能进入这个目录才读得到 Apple 登录的 .p8 私钥; geoip 的 install.sh / configure.sh 用 install -d -m 700 会把已有目录的权限收紧成只有 root 能进, Apple 登录随之失效。改为 mkdir -p,只保证目录存在。服务器上已手动改回 750。 --- server/geoip/configure.sh | 2 +- server/geoip/install.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/geoip/configure.sh b/server/geoip/configure.sh index b30efcc..c96c2f4 100755 --- a/server/geoip/configure.sh +++ b/server/geoip/configure.sh @@ -15,6 +15,6 @@ case "$ACCOUNT$LICENSE" in *[!A-Za-z0-9_]*) echo "账号或 Key 含有意外字 # 通过标准输入写入,命令行参数里不出现 Key printf 'MAXMIND_ACCOUNT_ID=%s\nMAXMIND_LICENSE_KEY=%s\n' "$ACCOUNT" "$LICENSE" \ - | "${SSH[@]}" 'sudo install -d -m 700 /etc/openstats && sudo tee /etc/openstats/maxmind.env >/dev/null && sudo chmod 600 /etc/openstats/maxmind.env && echo "已写入 /etc/openstats/maxmind.env"' + | "${SSH[@]}" 'sudo mkdir -p /etc/openstats && sudo tee /etc/openstats/maxmind.env >/dev/null && sudo chmod 600 /etc/openstats/maxmind.env && echo "已写入 /etc/openstats/maxmind.env"' echo "开始第一次同步(三个库约 80 MB,需要一两分钟)…" "${SSH[@]}" 'sudo systemctl start openstats-geoip.service && cat /var/www/getopenstats.com/geoip/manifest.json && echo' diff --git a/server/geoip/install.sh b/server/geoip/install.sh index f2a70d8..a5ba32d 100755 --- a/server/geoip/install.sh +++ b/server/geoip/install.sh @@ -12,7 +12,8 @@ scp -i "$KEY" -o BatchMode=yes openstats-geoip-update.sh openstats-geoip.service sudo install -m 755 /tmp/openstats-geoip-update.sh /usr/local/bin/openstats-geoip-update sudo install -m 644 /tmp/openstats-geoip.service /tmp/openstats-geoip.timer /etc/systemd/system/ sudo install -d -m 755 /var/www/getopenstats.com/geoip - sudo install -d -m 700 /etc/openstats + # 目录与同步服务共用(root:openstats-sync 750),这里只保证存在,不改权限,否则同步服务读不到 Apple 私钥 + sudo mkdir -p /etc/openstats sudo systemctl daemon-reload sudo systemctl enable --now openstats-geoip.timer rm -f /tmp/openstats-geoip-update.sh /tmp/openstats-geoip.service /tmp/openstats-geoip.timer