summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryyamashita <yyamashita@hetzner.yyamashita.com>2026-10-31 19:36:34 +0900
committeryyamashita <yyamashita@hetzner.yyamashita.com>2026-10-31 19:36:34 +0900
commit1e4a737175beb504b8fcb1271955d31b670a6563 (patch)
tree4985c16eb884c6cfc6962d3590497a6e5f7cee43
parent5029f44f4707051e0da39d5cfdae9f9eded12ef3 (diff)
ntfy: allow anonymous read on status topic (publish still requires token)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rw-r--r--CLAUDE.md4
-rwxr-xr-xntfy/install.sh5
-rw-r--r--ntfy/server.yml2
3 files changed, 7 insertions, 4 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 8d539d2..5f8ff34 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -129,7 +129,7 @@ git push origin master
# ステータスページ(status.yyamashita.com, status/)
# 監視対象は status/targets.txt(push だけで反映、次回チェック時に再読込)。JSON は /api/status
-# ntfy(ntfy.yyamashita.com, 認証必須)のトピック "status" に通知する:
+# ntfy(ntfy.yyamashita.com)のトピック "status" に通知する(購読は誰でも可・送信は status-app のトークンのみ):
# - 連続 2 回失敗で DOWN、復旧で recovered
# - 毎朝 8:00 JST に稼働率サマリー(status/.env に SUMMARY_HOUR=-1 で無効)
vi status/targets.txt && git push origin master
@@ -141,7 +141,7 @@ ssh root@localhost 'bash /app/infra/ntfy/deploy.sh && bash /app/infra/status/dep
# DNS(status / ntfy の CNAME): 下の「DNS 登録」参照
ssh -t root@localhost 'bash /app/infra/ntfy/install.sh' # 管理ユーザー作成(パスワード入力)
# → トークンを発行して status/.env に NTFY_URL / NTFY_TOKEN を書き込み、status-app を再起動
-# スマホ: ntfy アプリでサーバー https://ntfy.yyamashita.com を追加し、トピック status を購読(admin でログイン)
+# スマホ: ntfy アプリでサーバー https://ntfy.yyamashita.com / トピック status を購読(ログイン不要)
# ディープリンク: ntfy://ntfy.yyamashita.com/status(status ページ下部にもリンクあり)
# ntfy テスト送信
diff --git a/ntfy/install.sh b/ntfy/install.sh
index f65f867..548fb5d 100755
--- a/ntfy/install.sh
+++ b/ntfy/install.sh
@@ -17,6 +17,9 @@ else
docker exec -it ntfy ntfy user add --role=admin "$USER_NAME"
fi
+# status ページは公開なので、通知トピックも誰でも購読(読み取り)できるようにする。送信はトークン必須
+docker exec ntfy ntfy access "*" "$TOPIC" read-only
+
if grep -q '^NTFY_TOKEN=' "$STATUS_ENV" 2>/dev/null; then
echo "NTFY_TOKEN already set in $STATUS_ENV"
else
@@ -31,4 +34,4 @@ else
fi
echo ""
-echo "購読: ntfy アプリで サーバー https://ntfy.yyamashita.com / トピック $TOPIC / ユーザー $USER_NAME でログイン"
+echo "購読: ntfy アプリで サーバー https://ntfy.yyamashita.com / トピック $TOPIC(ログイン不要)"
diff --git a/ntfy/server.yml b/ntfy/server.yml
index 29a6a83..8cb7936 100644
--- a/ntfy/server.yml
+++ b/ntfy/server.yml
@@ -7,7 +7,7 @@ cache-file: "/var/cache/ntfy/cache.db"
cache-duration: "72h"
attachment-cache-dir: "/var/cache/ntfy/attachments"
-# 認証必須。ユーザー・トークンは install.sh で作成する
+# 既定は全拒否。ユーザー・トークンと、status トピックの匿名読み取り許可は install.sh で設定する
auth-file: "/var/lib/ntfy/user.db"
auth-default-access: "deny-all"