How can I add a custom SpamAssasin rule in Warden?

Overview

This article provides step-by-step instructions for creating and verifying custom spam filtering rules within the Warden platform. Custom rules can be configured via the web interface or the command line interface (CLI). Rule names must not exceed 22 characters, and scoring values support both positive and negative integers to influence message classification.

Adding a Custom Rule via Web Interface

  1. Navigate to Warden > Rules > Custom Rules and click the Add button.
  2. (Optional) Select a prebuilt configuration from the Template dropdown menu. For additional documentation on rule syntax, refer to the official rules guide.
  3. In the Name field, enter a unique identifier for the rule (maximum 22 characters).
  4. In the Score field, assign a positive or negative value to determine how the rule impacts message classification.
  5. Click Update to save and apply the configuration.

Rules

Adding a Custom Rule via Command Line Interface

Administrators can also manage custom rules using the Warden CLI. To view available parameters and usage syntax, execute:

warden --task=antispam:rules:customrules

To add a new rule, use the following command structure:

warden --task=antispam:rules:customrules --oper=rule_add --name=TEST --description='some description' --type=header --value='Subject =~ viagra' --score=100

Verifying Custom Rules

Custom rules can be validated using either the Message Log or the Spam Report tool. Follow the appropriate method below to confirm rule execution.

Method 1: Message Log

  1. Navigate to Logs > Message Log.
  2. Locate a processed message and click the plus icon (+) to expand its details.
  3. Review the Tests: section for a breakdown of matched rules. Any active custom rules will appear in this list.

Note: Amavis must be configured to verbose mode under Settings > Content Filter Settings > Filter Settings to display detailed rule matches in the log.

Tests

Method 2: Spam Report Tool

  1. Navigate to Tools > Spam Report.
  2. Paste the full raw source of an email message into the input field.
  3. Submit the request to generate a report. Matched custom rules will be listed in the results.

Spam Report

Troubleshooting & Common Issues

  • Rule not appearing in logs: Verify that Amavis verbose mode is enabled under Settings > Content Filter Settings > Filter Settings. Without verbose logging, detailed test breakdowns will not display.
  • Name field rejection or truncation: Ensure the rule name does not exceed 22 characters and contains only alphanumeric characters or standard underscores/hyphens.
  • CLI syntax errors: Run warden --task=antispam:rules:customrules without additional flags to review valid parameter options before executing rule creation commands.
  • Score not applying as expected: Confirm that the assigned score aligns with your global spam threshold settings. Positive scores increase spam likelihood, while negative scores decrease it.
  • rules, custom
  • 0 Użytkownicy uznali to za przydatne
Czy ta odpowiedź była pomocna?

Powiązane artykuły

How can I install or upgrade the extension?

We provide free installation and configuration for all our paid licenses. Open a support ticket...

How can I add stronger Postfix restrictions so that the bulk of spam is rejected at the SMTPD level before it gets processed by Amavis?

Overview Warden enables administrators to enforce stricter Postfix SMTPD restrictions. These...

How can I change the interface language of the extension?

Overview This article provides instructions on how to change the interface language within the...

How can I configure greylisting with Warden Anti-spam and Virus protection?

Overview Greylisting is an email filtering mechanism designed to mitigate spam by temporarily...