Skip to content

Templates

Griffen Fargo edited this page Aug 17, 2026 · 4 revisions

Templates

Doorman includes pre-built rule templates for common security patterns. Templates save time by providing battle-tested configurations you can add with a single command.

Using Templates

# Interactive: prompts you to select from the available templates
npx @gfargo/doorman template

# Add a specific template directly
npx @gfargo/doorman template <template-name>

Templates are added to your existing configuration file. You can customize the rules after adding them.

Available Templates

bad-bots — Block Malicious Bots

Blocks common malicious bot user agents that are known to scrape, spam, or attack websites.

npx @gfargo/doorman template bad-bots

Blocks user agents matching patterns like:

  • Common scraping bots
  • Known spam bots
  • Vulnerability scanners
  • SEO spam crawlers

ai-bots — Block AI Crawlers

Blocks AI training crawlers and scrapers that may use your content without permission.

npx @gfargo/doorman template ai-bots

Blocks crawlers from:

  • GPTBot (OpenAI)
  • CCBot (Common Crawl)
  • Google-Extended
  • Anthropic crawlers
  • Other AI training bots

wordpress — WordPress Protection

Blocks requests targeting WordPress-specific paths. Useful for non-WordPress sites that receive WordPress-targeted attacks.

npx @gfargo/doorman template wordpress

Blocks paths like:

  • /wp-admin/
  • /wp-login.php
  • /wp-content/
  • /xmlrpc.php
  • Other common WordPress attack vectors

block-ofac-sanctioned-countries — OFAC Compliance

Blocks traffic from OFAC-sanctioned countries for regulatory compliance.

npx @gfargo/doorman template block-ofac-sanctioned-countries

Blocks traffic from countries under US Treasury OFAC sanctions.

Customizing Templates

After adding a template, you can customize the generated rules in your .doorman.json:

  1. Modify conditions — Adjust matching criteria
  2. Change actions — Switch from deny to challenge or log
  3. Add exceptions — Create additional condition groups
  4. Disable rules — Set "active": false to temporarily disable

Creating Custom Templates

Templates are defined in the templates directory of the source code. Each template exports a set of rules following the standard rule format.

Related Pages

Clone this wiki locally