sirius-press/docker/nginx/default.conf

85 lines
2.9 KiB
Text
Raw Normal View History

feat(sirius-press): a WordPress where the account is a key, not a mailbox WordPress makes two assumptions this project cannot accept: that identity comes from an email address, and that a site lives at one server. Both are things somebody else can take away — a mailbox is rented from a provider who can close it or be compelled to open it, and a server is one seizure from being gone. Sirius Press replaces the first and hedges the second. Signing in means signing a challenge with the key that controls a CashAddress. The address is recovered from the signature, so nothing is typed but the signature itself, and the result is an ordinary WordPress session cookie — roles, capabilities, nonces and the REST API never learn the login was different. Three ways to produce one: a wallet the browser already exposes, a phrase used once in the page and wiped, or a signature pasted in from any BIP-137 wallet, which needs no JavaScript and lets the key stay on a machine that never touches the web. There is no password reset, and the recovery page says so plainly rather than offering a form that cannot work. A reset mechanism is by construction a way to take an account from its owner, and it is always easier to attack than the cryptography it bypasses. Publishing a post also exports it as static HTML to the name's storage on Sia, signed by the key that owns the name, so the site keeps answering when the server does not. Email as a feature is untouched. wp_mail() still works, SMTP still sends, and contact forms still deliver to addresses real people typed. Only mail to the site's own unroutable placeholder addresses is diverted to an in-app inbox. The objection was to email as identity, not to email. Core is pinned and patched rather than vendored. WordPress 7.1.1 is 149 MB and 5,008 files; the fork's entire core diff is 75 lines in wp-admin/install.php. Carrying the former to express the latter would bury the patch where nobody reviews it and make every clone of the monorepo pay for it. Upstream releases still merge through tools/update-wordpress.sh, which reapplies the series and says exactly which hunk needs a human. The cryptography is implemented twice — PHP on the server, JavaScript in the page — because the server must verify and the browser must sign. Both are pinned against libauth, the library the Sirius portal wallet and the BNS gateway already use, so a disagreement of one byte fails the test suite rather than presenting as a rejected login at three in the morning. 132 checks, no framework, about a second.
2026-09-21 01:39:38 +02:00
# nginx in front of Sirius Press.
#
# Static files are served here; only PHP is proxied. That matters more than
# usual for this fork: the wallet library and the login script are plain files,
# and routing them through PHP-FPM would put a process on the critical path of
# every sign-in for no reason.
#
# TLS is not configured here. Most people putting this on a VPS already have a
# reverse proxy, Caddy, or a Cloudflare tunnel in front; baking half a
# certificate story into this file would fight all three. docs/install.md
# covers the two common arrangements.
server {
listen 80 default_server;
server_name _;
root /var/www/html;
index index.php;
client_max_body_size 64m;
# WordPress hands its own version out in a header; there is no reason to
# advertise nginx's too.
server_tokens off;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# --- things that should never be reachable -------------------------------
# wp-config.php holds the database password and SIRIUS_PRESS_KEY, which is
# what the stored publishing phrase is encrypted under. A misconfiguration
# that serves it as text hands over the site's wallet.
location = /wp-config.php { deny all; }
location ~* /wp-config.*\.php$ { deny all; }
location ~ /\.(?!well-known) { deny all; }
location = /xmlrpc.php { deny all; }
location ~* /(?:uploads|files)/.*\.php$ { deny all; }
location ~* ^/wp-content/.*\.(?:sql|log|bak|swp)$ { deny all; }
# --- routing -------------------------------------------------------------
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS $http_x_forwarded_proto if_not_empty;
# Signature verification on a BCMath host takes a few hundred
# milliseconds, and a full static export batch takes longer. The
# default 60s would turn a slow first login into a 504.
fastcgi_read_timeout 300;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
# --- caching -------------------------------------------------------------
location ~* \.(?:css|js|mjs|woff2?|ttf|otf|eot|svg|png|jpe?g|gif|webp|avif|ico)$ {
expires 30d;
access_log off;
add_header Cache-Control "public, max-age=2592000";
try_files $uri =404;
}
# The login screen must never be cached anywhere: the challenge it carries
# is single-use, and a cached copy would hand every visitor a nonce that
# has already been spent.
location = /wp-login.php {
add_header Cache-Control "no-store, no-cache, must-revalidate" always;
include fastcgi_params;
fastcgi_pass app:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS $http_x_forwarded_proto if_not_empty;
fastcgi_read_timeout 300;
}
}