ops: JSON access log for every Caddy site (feeds threatcrushd) (#181)

The homepage-symlink breach left no record of which files were fetched,
because no site logged requests. Every site now imports one shared,
rolled JSON log at /var/log/caddy/access.log, which threatcrushd's
log-watcher tails for scanners, brute force and path probing.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-11-30 01:21:55 -08:00 • committed by GitHub
parent 537d96d5a8
commit 9a7b2d0df6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -847,6 +847,7 @@ if [ "$FORGEJO" = "1" ]; then
GIT_SITE=" GIT_SITE="
${GIT_DOMAIN} { ${GIT_DOMAIN} {
encode zstd gzip encode zstd gzip
import accesslog
reverse_proxy http://${FORGEJO_HTTP_ADDR} reverse_proxy http://${FORGEJO_HTTP_ADDR}
} }
" "
@ -865,6 +866,7 @@ news.${DOMAIN} {
on_demand on_demand
} }
encode zstd gzip encode zstd gzip
import accesslog
header Content-Type \"text/plain; charset=utf-8\" header Content-Type \"text/plain; charset=utf-8\"
respond \"AgentBBS Usenet (members-only). Point a newsreader at news.${DOMAIN}:563 over NNTPS and AUTHINFO USER <your-bbs-name> (any password). Or from the BBS: ssh -t news@${DOMAIN}\" respond \"AgentBBS Usenet (members-only). Point a newsreader at news.${DOMAIN}:563 over NNTPS and AUTHINFO USER <your-bbs-name> (any password). Or from the BBS: ssh -t news@${DOMAIN}\"
} }
@ -880,6 +882,7 @@ if [ "$IRC" = "1" ]; then
IRC_SITE=" IRC_SITE="
${IRC_DOMAIN} { ${IRC_DOMAIN} {
encode zstd gzip encode zstd gzip
import accesslog
handle /irc { handle /irc {
reverse_proxy 127.0.0.1:8097 reverse_proxy 127.0.0.1:8097
} }
@ -900,6 +903,7 @@ if [ "$MAIL_STACK" = "1" ]; then
MAIL_SITE=" MAIL_SITE="
${MAIL_DOMAIN} { ${MAIL_DOMAIN} {
encode zstd gzip encode zstd gzip
import accesslog
reverse_proxy 127.0.0.1:8080 reverse_proxy 127.0.0.1:8080
} }
" "
@ -912,6 +916,7 @@ fi
FILES_SITE=" FILES_SITE="
${FILES_DOMAIN} { ${FILES_DOMAIN} {
encode zstd gzip encode zstd gzip
import accesslog
# A pure file server (NOT a website host — member homepages live on the BBS # A pure file server (NOT a website host — member homepages live on the BBS
# at https://${DOMAIN}/~<name>). The agentbbs file-manager on loopback serves: # at https://${DOMAIN}/~<name>). The agentbbs file-manager on loopback serves:
@ -939,6 +944,7 @@ if [ "$CHAT" = "1" ]; then
CHAT_SITE=" CHAT_SITE="
${CHAT_DOMAIN} { ${CHAT_DOMAIN} {
encode zstd gzip encode zstd gzip
import accesslog
reverse_proxy ${CHAT_ADDR} reverse_proxy ${CHAT_ADDR}
} }
" "
@ -956,8 +962,24 @@ cat > /etc/caddy/Caddyfile <<CADDY
} }
} }
# One JSON access log for every site (sites sharing a file share one writer).
# threatcrushd's log-watcher tails it for scanners, brute force and path
# probing. Without it a leak cannot be traced: the 2026-11 homepage-symlink
# breach left no record of which files were fetched. Rolled so it can't fill /.
(accesslog) {
log {
output file /var/log/caddy/access.log {
roll_size 50MiB
roll_keep 10
roll_keep_for 720h
}
format json
}
}
${DOMAIN} { ${DOMAIN} {
encode zstd gzip encode zstd gzip
import accesslog
# join@ email confirmation links (agentbbs loopback /verify endpoint) # join@ email confirmation links (agentbbs loopback /verify endpoint)
handle /verify { handle /verify {
@ -1007,6 +1029,7 @@ ${GIT_SITE}${NEWS_SITE}${IRC_SITE}${MAIL_SITE}${FILES_SITE}${CHAT_SITE}
# can't trigger certificate issuance. # can't trigger certificate issuance.
*.${DOMAIN} { *.${DOMAIN} {
encode zstd gzip encode zstd gzip
import accesslog
tls { tls {
on_demand on_demand
} }
@ -1022,6 +1045,7 @@ ${GIT_SITE}${NEWS_SITE}${IRC_SITE}${MAIL_SITE}${FILES_SITE}${CHAT_SITE}
# {host} resolves to the right tree; unmapped hosts 404 (and never got a cert). # {host} resolves to the right tree; unmapped hosts 404 (and never got a cert).
https:// { https:// {
encode zstd gzip encode zstd gzip
import accesslog
tls { tls {
on_demand on_demand
} }