Phase 9 of PLAN.md. - noteguard-free.example.toml: everyone writes; blacklist, content and ratelimit use the Azzamo sources; premium exempt from rate limit and IP bans. - noteguard-premium.example.toml: whitelist gate on the premium source (fails closed when no list or cache), blacklists, 60/min runaway guard with no exemption and no bans. - DEPLOY.md: build, host prep (env, cache dir), smoke test, install, rollout order, rollback, operational notes. - README: Sources section (keys, loading model, accepted bodies) and an Azzamo deployments section. - Tests load both examples and the repo noteguard.toml with sources declared but not fetched, and check the gate fails closed. API URLs are placeholders (CHANGEME) until the endpoints are confirmed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
94 lines
3.3 KiB
TOML
94 lines
3.3 KiB
TOML
# Azzamo FREE relay (nostr.azzamo.net)
|
|
#
|
|
# Everyone can write. Notes are rate limited per IP, premium members are
|
|
# exempt from the rate limit and from IP bans, and everyone is checked
|
|
# against the Azzamo pubkey and word blacklists.
|
|
#
|
|
# Build: cargo build --release --features remote,cloudflare
|
|
# Run: NOTEGUARD_CONFIG=/etc/noteguard/free.toml (see DEPLOY.md)
|
|
#
|
|
# The source URLs below are placeholders until the Azzamo API endpoints and
|
|
# response shapes are confirmed. Accepted shapes are documented in the README
|
|
# (section "Sources").
|
|
|
|
pipeline = ["protected_events", "kinds", "blacklist", "content", "ratelimit"]
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Remote lists. Each is fetched at startup, then every reload_secs in the
|
|
# background; a failed fetch keeps the last good copy, and cache_path lets a
|
|
# restart during an API outage come back with the last good list.
|
|
# The token is read from the AZZAMO_API_TOKEN environment variable.
|
|
# ---------------------------------------------------------------------------
|
|
[sources.premium]
|
|
url = "https://api.azzamo.net/CHANGEME/premium"
|
|
format = "pubkeys"
|
|
token_env = "AZZAMO_API_TOKEN"
|
|
reload_secs = 300
|
|
timeout_secs = 10
|
|
cache_path = "/var/lib/noteguard/premium.json"
|
|
|
|
[sources.blacklist_pubkeys]
|
|
url = "https://api.azzamo.net/CHANGEME/blacklist/pubkeys"
|
|
format = "pubkeys"
|
|
token_env = "AZZAMO_API_TOKEN"
|
|
reload_secs = 300
|
|
timeout_secs = 10
|
|
cache_path = "/var/lib/noteguard/blacklist_pubkeys.json"
|
|
|
|
[sources.blacklist_words]
|
|
url = "https://api.azzamo.net/CHANGEME/blacklist/words"
|
|
format = "words"
|
|
token_env = "AZZAMO_API_TOKEN"
|
|
reload_secs = 300
|
|
timeout_secs = 10
|
|
cache_path = "/var/lib/noteguard/blacklist_words.json"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Filters, in pipeline order.
|
|
# ---------------------------------------------------------------------------
|
|
[filters.protected_events]
|
|
# message = "blocked: event marked as protected"
|
|
|
|
[filters.kinds]
|
|
kinds = [30065, 1064, 34550, 4550]
|
|
# message = "blocked: note kind is not allowed here"
|
|
|
|
[filters.kinds.messages]
|
|
30065 = "blocked: files on nostr is dumb"
|
|
1064 = "blocked: files on nostr is dumb"
|
|
34550 = "blocked: please use a dedicated relay for moderated communities"
|
|
4550 = "blocked: please use a dedicated relay for moderated communities"
|
|
|
|
# Blacklisted pubkeys (static + Azzamo list) and IPs get a visible reject.
|
|
[filters.blacklist]
|
|
pubkeys_source = "blacklist_pubkeys"
|
|
# pubkeys = []
|
|
# ips = []
|
|
# cidrs = []
|
|
# message = "blocked: pubkey/ip is blacklisted"
|
|
|
|
# Blocked words (static + Azzamo list) are silently dropped. Repeat offenders
|
|
# are IP-banned; premium members skip the ban but are still word-checked.
|
|
[filters.content]
|
|
filters = ["Damus Airdrop"]
|
|
words_source = "blacklist_words"
|
|
exempt_source = "premium"
|
|
ban_after = 5
|
|
ban_duration_secs = 3600
|
|
|
|
# Per-IP rate limit. Premium members are exempt.
|
|
[filters.ratelimit]
|
|
posts_per_minute = 8
|
|
whitelist = ["127.0.0.1"]
|
|
exempt_source = "premium"
|
|
message = "rate-limited: you note too much"
|
|
ban_after = 10
|
|
ban_duration_secs = 3600
|
|
ban_message = "banned: too many rate-limit violations, try again later"
|
|
|
|
# Optional: push IP bans to a Cloudflare WAF list (needs the cloudflare
|
|
# feature and CLOUDFLARE_API_TOKEN). See the README.
|
|
# [cloudflare]
|
|
# account_id = "<cloudflare account id>"
|
|
# list_id = "<ip list id>"
|