diff --git a/README.md b/README.md index 371b191..79d4192 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ The blocklists are downloaded, normalized and merged. Domains already present in By default the tool also turns existing `allow_with_approval` email-domain records into hard deny records. Use `--no-force-deny` if that is not wanted. +After updating the domain blocks, pending registrations are checked against Mastodon's `EmailDomainBlock` matcher. Pending accounts whose email address matches a hard-blocked domain are removed using Mastodon's `DeleteAccountService`. Use `--no-cleanup-pending` to disable this behavior. + MX records are never blocked automatically. `--mx-mode report` can be used for occasional DNS analysis, but the result is informational only. Shared mail infrastructure is common and blocking an MX hostname can affect unrelated, legitimate domains. ## Sources @@ -128,6 +130,33 @@ mail.example.net The allowlist only prevents the tool from adding those domains. It does not delete a block that already exists in Mastodon. +## Pending registrations + +Pending registrations are checked after the email-domain block list has been updated. + +The check uses Mastodon's own `EmailDomainBlock.block?` matcher. If a pending account uses an email address matched by a hard deny record, the account is removed through Mastodon's `DeleteAccountService`. + +Only pending registrations are processed. Existing approved accounts are not removed by this cleanup. + +The cleanup is enabled by default. Disable it with: + +```sh +--no-cleanup-pending +``` + +A dry run reports matching pending registrations without deleting them: + +```sh +/opt/mastodon-email-blocker/venv/bin/python \ + /opt/mastodon-email-blocker/mastodon-email-blocker.py \ + --backend native \ + --mastodon-dir /path/to/mastodon/live \ + --mx-mode off \ + --dry-run +``` + +The run report includes the number of pending registrations checked, matched and deleted, together with any cleanup errors. + ## MX report DNS/MX analysis is intentionally disabled for scheduled runs because resolving a large domain set is slow and MX providers are often shared. @@ -185,6 +214,8 @@ journalctl -u mastodon-email-blocker.service -n 100 --no-pager A run can be interrupted with `Ctrl+C`. Completed batches stay in Mastodon. On the next run the existing records are read again, so already-added domains are skipped and only the remaining ones are submitted. +Pending registrations already removed by a completed cleanup do not require any additional state. The next run checks the current pending registrations again. + ## Files written - `/var/lib/mastodon-email-blocker/last-report.json` — last run report