How can I disable Amavis bad header tests?

Overview

The Bad Header Destiny feature in Warden controls how the mail server processes and delivers emails containing malformed, non-compliant, or structurally invalid headers. Administrators can manage this behavior through global policy settings, per-policy bank configurations, or direct Amavis configuration modifications.

Default Configuration and Server-Wide Policy

  • The default setting under Warden > Settings > Content Filter > Content Filter Settings > Bad header destiny is set to reject.
  • The server-wide policy option under Warden > Settings > Content Filter > Policy Settings > Receive bad header emails determines delivery behavior:
    • Yes (Default): Allows emails with invalid headers to pass through to the recipient's mailbox. Amavis retains a quarantined copy for administrative review and automatically purges it after 30 days.
    • No: Blocks delivery of emails containing bad headers, preventing them from reaching the user's mailbox.

Bad Header Destiny

Server Wide Bad Header Filter Policy Settings

Disable All Bad Header Tests (Global)

To completely bypass header validation across the entire server, modify the Amavis configuration file and restart the service.

  1. Edit the appropriate configuration file based on your operating system:
  • AlmaLinux/CloudLinux/RHEL: /etc/amavisd/warden.conf
  • Debian/Ubuntu: /etc/amavis/conf.d/99-warden
Locate the @bypass_header_checks_maps directive and update it as follows:

Original configuration:

@bypass_header_checks_maps = (\%bypass_header_checks, \@bypass_header_checks_acl, \$bypass_header_checks_re);

Updated configuration:

@bypass_header_checks_maps = [1];
  1. Restart the Amavis service to apply changes:
// AlmaLinux/CloudLinux/RHEL
systemctl restart amavisd

// Debian/Ubuntu
systemctl restart amavis

Disable Bad Header Tests for a Specific Policy Bank

To disable header validation exclusively for outgoing email within a specific policy bank:

  1. Navigate to Warden > Settings > Policy Banks.
  2. Select the target policy bank.
  3. Set Disable bad header filter to Yes.
  4. Save the configuration changes.

Policy Banks

Disable Specific Bad Header Tests

You can selectively disable individual header validation rules by modifying the $allowed_header_tests variable. Setting a test value to 0 disables that specific check.

Available header tests:

  • other: Catchall for unclassified checks (typically unused)
  • mime: Invalid MIME headers or malformed MIME structure
  • 8bit: Unencoded 8-bit characters in headers
  • control: Invalid control characters (CR or NUL)
  • empty: Folded header fields containing only whitespace
  • long: Header lines exceeding the RFC 2822 limit of 998 characters
  • syntax: Header field syntax errors or missing required fields
  • multiple: Duplicate or repeated header fields

To disable specific tests, edit the same configuration files listed above and append the desired rules to the $allowed_header_tests block. For example, to disable duplicate headers and missing required fields:

$allowed_header_tests{'multiple'} = 0;
$allowed_header_tests{'missing'} = 0;

Restart the Amavis service after modifying the configuration:

// AlmaLinux/CloudLinux/RHEL
systemctl restart amavisd

// Debian/Ubuntu
systemctl restart amavis

Troubleshooting and Verification

  • Configuration not applying: Verify that the Amavis service has fully restarted. Check for syntax errors in the configuration files by running a config validation test.
  • Emails still being rejected after disabling tests: Ensure no conflicting rules exist in other policy banks, global content filter settings, or external spam filtering layers.
  • bad header, amavis
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

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...