Account and site security for FlatBB in one plugin: two-factor sign-in, sign-in alerts, IP bans, a scanner report and
a security check-up.

What members get

Settings → Security (one tab in the normal settings page):

  • Turn on two-factor authentication: scan a QR code (or type the key) into Google Authenticator, Aegis, 1Password,
    Bitwarden or any other TOTP app, confirm one six-digit code, and the plugin shows eight one-time recovery codes.
    The codes are stored only as password hashes and each one works once.
  • After the password, the sign-in asks for the six-digit code (or a recovery code) on /guard/2fa. A code is accepted
    for ±30 seconds of clock drift and never twice.
  • Generate a new set of recovery codes, or turn two-factor off — both ask for the current password and a current code.
  • Sign-in alerts: an email after each sign-in with the time, IP address and browser. It can be switched off per
    account; the site-wide switch lives in the plugin settings.

What admins get

Admin → Plugins → Security:

  • Security check-up: HTTPS, clean URLs, staff accounts without two-factor, sender address, registration policy,
    active bans and the last 24 hours of misses.
  • Blocked networks: block a single address or a CIDR range (IPv4 or IPv6) with a note and an optional expiry.
    Bans are enforced in app.boot, before any handler runs. Staff are never blocked, so a wrong range cannot close
    the panel; loopback and /0 ranges are rejected.
  • Missed addresses (scanner report): every 404 with the address, the path, the browser and a hit count, plus a
    one-click Block button that prefills the CIDR range. Clearing the report is one click.

The scanner report keeps at most 5,000 rows (least visited are pruned) and drops rows older than the retention time.

Plugin settings (Admin → Plugins)

SettingDefaultMeaning
Enable TabRe GuardonMaster switch for all features.
Offer two-factor authenticationonShow the Security tab and ask for codes at sign-in. Existing two-factor users keep their codes when this is off.
Email a notice after each sign-inonSite-wide switch for sign-in alerts (members can also switch their own off).
Remind staff to turn on two-factoronBanner on admin pages for staff without two-factor.
Enforce IP bansonBlock banned ranges.
Record missed addressesonFill the scanner report.
Keep the scanner report for (days)60Cleanup runs daily through the cleanup cron job.

Good to know

  • The second step uses the core contract: account.login_challenge returns the URL and the plugin finishes with
    login_pending_user() + login_user(). The pending sign-in expires after five minutes.
  • Sign-in alerts are sent with mail_send(), so a mail plugin (SMTP) takes over automatically.
  • When the site runs behind a proxy, set trusted proxies in the site settings so client_ip() sees the visitor's
    address; bans and the report use the same address.
  • Two-factor secrets and recovery hashes live in plugin_tabre_guard_user. Removing the plugin deletes the tables,
    which also removes everyone's two-factor setup.
  • The QR code is drawn locally by qrcode-generator 1.4.4 (MIT,
    copyright Kazuhiko Arase), vendored in assets/vendor/. No request leaves the site while setting up.

Requirements

  • FlatBB 0.2.4 or newer. Works with SQLite and MySQL 5.7.