repository

BlowfishCMS

A small content management system for OpenBSD

version 0.45.6 · ISC · 2026-12-03 · releases

221 lines · 9.2 KB · view the source · download this file

Security

This page covers what BlowfishCMS does to protect your site, and what you should do on the server before launch.

What's built in

Separation

  • Separate accounts. Each service runs as its own unprivileged account and can only touch what it needs (see OPERATIONS.md). The public pages can't write anything. Only the contact service can read the Postmark token, and only the Store's service can read the Stripe keys and the orders. Admin users' password hashes and email addresses are readable only by the admin service (its own folder, mode 0600); the other services see just names, roles and sessions. Visitor numbers (Analytics) are readable only by the comments service, which counts them and shows them to owners; no address, cookie or browser string is kept. A visitor's place (city, region, country) is looked up on the server in a city database the server fetches monthly from DB-IP; only the place is stored, and no address leaves the server.
  • Secrets never come back out. Tokens and keys are checked with the service they belong to before they're saved. They're stored readable only by their own account (mode 0400), and never shown again in the admin.

Signing in

  • The admin has its own login page. Each admin user has their own name and password, stored as a bcrypt hash. Owners can change the site's settings, users, updates and backups; editors only the content. Every service checks the role on each request, so a removed user or a demoted owner loses access at once.
  • Lockout: five failed sign-ins from one address within 15 minutes lock that address for 15 minutes. Thirty failures from anywhere within an hour lock all sign-ins for 15 minutes; doas blowfishctl unlock lifts it early.
  • Two-step sign-in (optional, per user): after the password, a six-digit code from an authenticator app (TOTP, RFC 6238) or a single-use recovery code. A code can't be used twice, wrong codes count towards the lockout, and the step between password and code expires after five minutes. The keys live in the admin service's own folder (mode 0600), not in the catalogue or in backups; recovery codes are stored hashed. The QR code is drawn on the server, so the key never goes to another site. Owners can require it of owners or of everyone (Users); until someone it applies to has set it up, every admin screen, in every service, sends them to set it up.
  • Sessions last 12 hours, in a signed cookie that only works for /admin/ (Secure, HttpOnly, SameSite=Strict). sign out ends yours. A new password, removal or sign out everywhere ends all of that user's sessions in every browser.
  • The session key is readable only by the services with admin screens (group _bfstaff), never by the public pages.

Visitors' browsers

  • A strict content security policy: default-src 'self', with no inline scripts or styles and no third-party scripts. Pages can't be framed by other sites, and forms can only post back to this site. Video may also play from blob: addresses, which only the site's own scripts can make (Live's player feeds its stream to the browser that way).
  • HTTPS everywhere, with HSTS, nosniff and a strict referrer policy.
  • Browser features switched off: camera, microphone, location, payment and USB access. The site's windows are kept apart from other sites' windows (Cross-Origin-Opener-Policy). Certificates renew automatically.

Forms

  • Every admin form carries a signed CSRF token. Requests from other sites are refused.
  • The contact form and comments are protected:
    • a hidden trap field for spam bots;
    • per-visitor and site-wide rate limits;
    • reserved names, so nobody can comment as you.

What you upload

  • Pictures are decoded and re-encoded, which strips camera metadata such as location.
  • Music and videos are checked by their content, not their name.
  • Files to download are never shown as pages. The Files library takes any kind of file, so httpd sends them only as downloads, with a policy that stops anything in them running, and under a cleaned name in a folder of their own. Only signed-in owners and editors can upload them.
  • Markdown is cleaned: raw HTML is escaped, and only plain links and pictures from your own media are allowed.

Payments and add-ons

  • Live streams need the stream key, sent in a header (never in an address, so it isn't in httpd's logs); only its sha256 is kept, and it's shown once, when it's made. The pieces are checked by name and kind before they're saved, and served as files, never run.
  • No card data on your server. Store buyers pay on Stripe's own page. Stripe's webhook messages are checked against their signature and refused if older than five minutes.
  • Updates are tested before they switch over, and roll back on failure. Add-ons and themes are archives an owner uploads (or that the server fetches over HTTPS from the one address it's given); each add-on lists every outside host it connects to, and only owners can install one. Updates to add-ons are never installed without an owner pressing the button.

Before you launch: server checklist

1. Keep OpenBSD patched

doas syspatch
doas pkg_add -u

Run these at least monthly. You can also have root's crontab check daily with ~ 4 * * * syspatch. When syspatch reports a kernel patch, reboot to apply it.

2. Lock down SSH

First make sure your own account can use doas (install allows the wheel group: usermod -G wheel you as root if you aren't in it), and that you can log in with an SSH key. Then edit /etc/ssh/sshd_config:

PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no

Then:

doas sshd -t && doas rcctl reload sshd

Keep your current session open and test a new login before you log out.

3. Turn on a firewall

/etc/pf.conf: allow only SSH and the web, and block addresses that hammer the server:

set skip on lo
block return
pass out

table <abusers> persist
block quick from <abusers>

pass in on egress proto tcp to port { 80 443 } \
    keep state (max-src-conn 200, max-src-conn-rate 100/10, overload <abusers> flush global)
pass in on egress proto tcp to port 22 \
    keep state (max-src-conn-rate 5/60, overload <abusers> flush global)
pass in on egress inet proto icmp icmp-type { echoreq unreach }
pass in on egress inet6 proto icmp6
doas pfctl -nf /etc/pf.conf && doas pfctl -f /etc/pf.conf

Let addresses out of the block list after a day, with root's crontab: 0 * * * * pfctl -t abusers -T expire 86400.

Port 80 must stay open: Let's Encrypt uses it to renew the certificate.

4. Use a strong admin password and two-step sign-in

The login page locks out repeated guesses, but a long passphrase (20 characters or more, not used anywhere else) is still the best protection, for every admin user. Owners should also turn on two-step sign-in (Your account), since an owner can install updates; under Settings → Sign-in you can require it of owners or of everyone. Give editors the editor role: they can't change settings, users or the code. From the server:

doas blowfishctl password          # the install's admin account
doas blowfishctl password NAME     # any user; a new NAME becomes an owner

If you lock yourself out, wait 15 minutes or run doas blowfishctl unlock. If you've lost the phone with your authenticator app and your recovery codes, doas blowfishctl mfa-off NAME turns two-step sign-in off for that user.

5. Keep backups off the server

doas blowfishctl backup

Copy the archives to another machine regularly; see OPERATIONS.md, or download them from the admin's System screen. Treat --with-secrets archives like passwords.

The System screen can install updates, which run as root, so an owner's sign-in is as powerful as root on the server. Give owner accounts long, unique passwords and two-step sign-in, make other people editors, and install only releases from a source you trust. update to X on the System screen fetches releases only from where updates come from (Updates from, an HTTPS address an owner sets, kept by root in /etc/blowfishcms-updates-from) and refuses one that doesn't match the sha256 published with it; the admin can only ask for the newest version the server itself found there. The sha256 comes from the same site, so it guards against a broken download, not against that site: set it only to a site you control or trust, as you would an upload. doas touch /etc/blowfishcms-no-system turns the screen off if you'd rather update only from the command line.

6. Check mail authentication

On the Mail screen, the Return-Path check should be green. In Postmark, DKIM should show as verified. A DMARC record (_dmarc.your-domain, v=DMARC1; p=none;) lets you see who sends mail as your domain; tighten it to p=quarantine once Postmark is the only sender.

7. Watch the logs now and then

doas blowfishctl status
grep blowfish /var/log/daemon | tail -50
tail /var/www/logs/error.log

Reporting a problem

If you find a security issue in BlowfishCMS, please report it privately to the maintainer rather than in a public issue.