caddy: access logs, security headers; dns: CAA records
- (logging) snippet: JSON access log at /data/logs/access.log, rotated, tokens/OIDC codes and API key headers masked - (security_headers)/(no_framing): nosniff, Referrer-Policy and X-Frame-Options only where the app sets none; drop Server/X-Powered-By - (static_site): adds a CSP (base-uri, object-src, frame-ancestors, form-action) and Permissions-Policy to the four static sites - CAA records: Let's Encrypt + ZeroSSL on both domains, Amazon on thesatelliteoflove.com for links. (CloudFront/ACM), no wildcards Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0afdd670ff
commit
30bc0a46b4
2 files changed
+133
-23
No files matched your search
@@ -62,6 +62,26 @@
|
|||||||
- name: "repair"
|
- name: "repair"
|
||||||
ip: "{{ network.netcup_ip }}"
|
ip: "{{ network.netcup_ip }}"
|
||||||
|
|
||||||
|
# CAA: only these CAs may issue certificates for each domain (and its
|
||||||
|
# subdomains). Let's Encrypt is what Caddy uses; sectigo.com is ZeroSSL,
|
||||||
|
# Caddy's automatic fallback CA. Amazon covers links.thesatelliteoflove.com
|
||||||
|
# (CloudFront with an ACM certificate). No CA may issue wildcards.
|
||||||
|
caa_records:
|
||||||
|
- zone: thesatelliteoflove.com
|
||||||
|
records:
|
||||||
|
- '0 issue "letsencrypt.org"'
|
||||||
|
- '0 issue "sectigo.com"'
|
||||||
|
- '0 issue "amazon.com"'
|
||||||
|
- '0 issue "amazontrust.com"'
|
||||||
|
- '0 issue "awstrust.com"'
|
||||||
|
- '0 issue "amazonaws.com"'
|
||||||
|
- '0 issuewild ";"'
|
||||||
|
- zone: nerder.land
|
||||||
|
records:
|
||||||
|
- '0 issue "letsencrypt.org"'
|
||||||
|
- '0 issue "sectigo.com"'
|
||||||
|
- '0 issuewild ";"'
|
||||||
|
|
||||||
# DNS records to remove for decommissioned services
|
# DNS records to remove for decommissioned services
|
||||||
removed_records:
|
removed_records:
|
||||||
- name: thesatelliteoflove.com
|
- name: thesatelliteoflove.com
|
||||||
@@ -117,3 +137,14 @@
|
|||||||
loop: "{{ query('subelements', domains, 'dns_records') }}"
|
loop: "{{ query('subelements', domains, 'dns_records') }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: item
|
loop_var: item
|
||||||
|
|
||||||
|
- name: Set CAA records restricting which CAs may issue certificates
|
||||||
|
amazon.aws.route53:
|
||||||
|
state: present
|
||||||
|
zone: "{{ item.zone }}"
|
||||||
|
record: "{{ item.zone }}"
|
||||||
|
type: CAA
|
||||||
|
ttl: 3600
|
||||||
|
value: "{{ item.records }}"
|
||||||
|
overwrite: true
|
||||||
|
loop: "{{ caa_records }}"
|
||||||
@@ -8,55 +8,126 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{ subdomains.pocketid }} {
|
# JSON access log shared by every site, in the caddy_data volume
|
||||||
|
# (/data/logs). Read by humans and, later, CrowdSec. Caddy already redacts
|
||||||
|
# Cookie/Authorization headers; the filter also masks ?token= (Gotify clients
|
||||||
|
# put their app token in the query string).
|
||||||
|
(logging) {
|
||||||
|
log {
|
||||||
|
output file /data/logs/access.log {
|
||||||
|
roll_size 50MiB
|
||||||
|
roll_keep 10
|
||||||
|
roll_keep_for 720h
|
||||||
|
}
|
||||||
|
format filter {
|
||||||
|
request>uri query {
|
||||||
|
replace token REDACTED
|
||||||
|
replace access_token REDACTED
|
||||||
|
replace code REDACTED
|
||||||
|
}
|
||||||
|
request>headers>X-Gotify-Key replace REDACTED
|
||||||
|
request>headers>X-Api-Key replace REDACTED
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Headers for proxied apps. "?" only sets a header the app didn't send, so
|
||||||
|
# apps with their own (stricter) values keep them. Server/X-Powered-By are
|
||||||
|
# dropped so responses don't advertise software versions.
|
||||||
|
(security_headers) {
|
||||||
|
header {
|
||||||
|
?X-Content-Type-Options nosniff
|
||||||
|
?Referrer-Policy strict-origin-when-cross-origin
|
||||||
|
-Server
|
||||||
|
-X-Powered-By
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Refuse to be framed by other sites (clickjacking). Not for apps that are
|
||||||
|
# meant to be embedded elsewhere (HeyForm forms).
|
||||||
|
(no_framing) {
|
||||||
|
header ?X-Frame-Options SAMEORIGIN
|
||||||
|
}
|
||||||
|
|
||||||
|
# Static sites: everything above plus a CSP. No default-src so existing
|
||||||
|
# scripts, styles and images keep working; it blocks plugins, <base>
|
||||||
|
# hijacking, framing and forms posting off-site.
|
||||||
|
(static_site) {
|
||||||
|
import logging
|
||||||
import hsts
|
import hsts
|
||||||
|
import security_headers
|
||||||
|
header {
|
||||||
|
Content-Security-Policy "base-uri 'self'; object-src 'none'; frame-ancestors 'self'; form-action 'self'"
|
||||||
|
X-Frame-Options SAMEORIGIN
|
||||||
|
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Every proxied site: log, HSTS and the shared headers.
|
||||||
|
(site) {
|
||||||
|
import logging
|
||||||
|
import hsts
|
||||||
|
import security_headers
|
||||||
|
}
|
||||||
|
|
||||||
|
{{ subdomains.pocketid }} {
|
||||||
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy pocket-id:1411
|
reverse_proxy pocket-id:1411
|
||||||
}
|
}
|
||||||
|
|
||||||
paper.thesatelliteoflove.com {
|
paper.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy paperlessngx-webserver-1:8000
|
reverse_proxy paperlessngx-webserver-1:8000
|
||||||
}
|
}
|
||||||
|
|
||||||
cal.thesatelliteoflove.com {
|
cal.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
redir /.well-known/caldav /dav.php 302
|
redir /.well-known/caldav /dav.php 302
|
||||||
redir /.well-known/carddav /dav.php 302
|
redir /.well-known/carddav /dav.php 302
|
||||||
reverse_proxy baikal-baikal-1:80
|
reverse_proxy baikal-baikal-1:80
|
||||||
}
|
}
|
||||||
|
|
||||||
{{ subdomains.books }} {
|
{{ subdomains.books }} {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy kavita:5000
|
reverse_proxy kavita:5000
|
||||||
}
|
}
|
||||||
|
|
||||||
audio.thesatelliteoflove.com {
|
audio.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy audiobookshelf-audiobookshelf-1:80
|
reverse_proxy audiobookshelf-audiobookshelf-1:80
|
||||||
}
|
}
|
||||||
|
|
||||||
loclog.thesatelliteoflove.com {
|
loclog.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy dawarich_app:3000
|
reverse_proxy dawarich_app:3000
|
||||||
}
|
}
|
||||||
|
|
||||||
watcher.thesatelliteoflove.com {
|
watcher.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy changedetection:5000
|
reverse_proxy changedetection:5000
|
||||||
}
|
}
|
||||||
|
|
||||||
snippets.thesatelliteoflove.com {
|
snippets.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy bytestash:5000
|
reverse_proxy bytestash:5000
|
||||||
}
|
}
|
||||||
|
|
||||||
git.thesatelliteoflove.com {
|
git.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy gitea:3000
|
reverse_proxy gitea:3000
|
||||||
}
|
}
|
||||||
|
|
||||||
thesatelliteoflove.com {
|
thesatelliteoflove.com {
|
||||||
import hsts
|
import static_site
|
||||||
# WebFinger for phil@ serves two readers: the fediverse (GoToSocial's account
|
# WebFinger for phil@ serves two readers: the fediverse (GoToSocial's account
|
||||||
# domain is this apex) and Tailscale, which finds the tailnet's login
|
# domain is this apex) and Tailscale, which finds the tailnet's login
|
||||||
# provider through the OpenID issuer link.
|
# provider through the OpenID issuer link.
|
||||||
@@ -76,33 +147,38 @@ thesatelliteoflove.com {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bookmarks.thesatelliteoflove.com {
|
bookmarks.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy hoarder-web-1:3000
|
reverse_proxy hoarder-web-1:3000
|
||||||
}
|
}
|
||||||
|
|
||||||
social.thesatelliteoflove.com {
|
social.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy gotosocial:8080
|
reverse_proxy gotosocial:8080
|
||||||
}
|
}
|
||||||
|
|
||||||
models.thesatelliteoflove.com {
|
models.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy manyfold-app-1:3214
|
reverse_proxy manyfold-app-1:3214
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gotify.thesatelliteoflove.com {
|
gotify.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy gotify:80
|
reverse_proxy gotify:80
|
||||||
}
|
}
|
||||||
|
|
||||||
gotify-assistant.thesatelliteoflove.com {
|
gotify-assistant.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy igotify-assistant:8080
|
reverse_proxy igotify-assistant:8080
|
||||||
}
|
}
|
||||||
|
|
||||||
pdg.thesatelliteoflove.com {
|
pdg.thesatelliteoflove.com {
|
||||||
import hsts
|
import static_site
|
||||||
root * /srv/pdg
|
root * /srv/pdg
|
||||||
# "{path}/" keeps the /dir -> /dir/ redirect; "{path}/index.html" is
|
# "{path}/" keeps the /dir -> /dir/ redirect; "{path}/index.html" is
|
||||||
# needed for "/" itself, which "{path}/" never matches in Caddy 2.11.
|
# needed for "/" itself, which "{path}/" never matches in Caddy 2.11.
|
||||||
@@ -117,7 +193,8 @@ pdg.thesatelliteoflove.com {
|
|||||||
}
|
}
|
||||||
|
|
||||||
starpunk.thesatelliteoflove.com {
|
starpunk.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
# MCP endpoint and its OAuth protected resource metadata (StarPunk v2.15.0)
|
# MCP endpoint and its OAuth protected resource metadata (StarPunk v2.15.0)
|
||||||
@mcp path /mcp /mcp/* /.well-known/oauth-protected-resource /.well-known/oauth-protected-resource/*
|
@mcp path /mcp /mcp/* /.well-known/oauth-protected-resource /.well-known/oauth-protected-resource/*
|
||||||
handle @mcp {
|
handle @mcp {
|
||||||
@@ -129,34 +206,36 @@ starpunk.thesatelliteoflove.com {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repair.nerder.land {
|
repair.nerder.land {
|
||||||
import hsts
|
import static_site
|
||||||
root * /srv/repair
|
root * /srv/repair
|
||||||
file_server
|
file_server
|
||||||
}
|
}
|
||||||
|
|
||||||
nerder.land {
|
nerder.land {
|
||||||
import hsts
|
import static_site
|
||||||
root * /srv/nerderland
|
root * /srv/nerderland
|
||||||
file_server
|
file_server
|
||||||
}
|
}
|
||||||
|
|
||||||
forms.nerder.land {
|
forms.nerder.land {
|
||||||
import hsts
|
import site
|
||||||
reverse_proxy heyform-heyform-1:9157
|
reverse_proxy heyform-heyform-1:9157
|
||||||
}
|
}
|
||||||
|
|
||||||
listmonk.nerder.land {
|
listmonk.nerder.land {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy listmonk:9000
|
reverse_proxy listmonk:9000
|
||||||
}
|
}
|
||||||
|
|
||||||
repaircafe.nerder.land {
|
repaircafe.nerder.land {
|
||||||
import hsts
|
import site
|
||||||
redir /volunteer-signup https://listmonk.nerder.land/subscription/form 301
|
redir /volunteer-signup https://listmonk.nerder.land/subscription/form 301
|
||||||
}
|
}
|
||||||
|
|
||||||
gokapi.thesatelliteoflove.com {
|
gokapi.thesatelliteoflove.com {
|
||||||
import hsts
|
import site
|
||||||
|
import no_framing
|
||||||
reverse_proxy gokapi:53842
|
reverse_proxy gokapi:53842
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user