How can I disable Amavis bad header tests?

By default mail with bad headers is quarantined for review but are still delivered to the users mailbox. If you would like to change this to discard mail with bad headers you can change the setting under Warden -> Settings -> Filter Settings -> Final bad header destiny from pass to discard.

To disable all bad header tests:

To disable all bad header tests on Centos/RHEL/CloudLinux/AlmaLinux edit the file /etc/amavisd/warden.conf or on Debian/Ubuntu edit the file /etc/amavis/conf.d/99-warden and search for the @bypass_header_checks_maps option.

Change from:

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

Change to:

@bypass_header_checks_maps = [1];

After making these changes restart Amavis:

// Centos/RHEL/CloudLinux/AlmaLinux
systemctl restart amavisd

// Debian/Ubuntu
systemctl restart amavis

To disable all bad header tests for a specific policy bank:

If we want to keep bad header tests enabled for incoming email but disable them for our own users. Edit the file /etc/amavisd/warden.conf or on Debian/Ubuntu edit the file /etc/amavis/conf.d/99-warden and add the bypass_header_checks_maps => [1] line to the SUBMISSION and SENDMAIL policy banks:

## POLICY BANKS
# submission, SMTPS services
$policy_bank{'SUBMISSION'} = {
  originating => 1,
  warnbadhsender => 0,
  terminate_dsn_on_notify_success => 0,
  bypass_header_checks_maps => [1],
};

# sendmail, pickup services
$interface_policy{'10027'} = 'SENDMAIL';
$policy_bank{'SENDMAIL'} = {
  originating => 1,
  warnbadhsender => 0,
  terminate_dsn_on_notify_success => 0,
  bypass_header_checks_maps => [1],
};

After making these changes restart Amavis:

// Centos/RHEL/CloudLinux/AlmaLinux
systemctl restart amavisd

// Debian/Ubuntu
systemctl restart amavis

To disable specific bad header tests:

There is an $allowed_header_tests option by which you can define what should be looked up during the bad-header checks, and the list is as follows:

other     catchall for everything else - normally not used
mime      Bad MIME (sub)headers or bad MIME structure
8bit      Invalid non-encoded 8-bit characters in header
control   Invalid control characters in header (CR or NUL)
empty     Folded header field made up entirely of whitespace
long      Header line longer than RFC 2822 limit of 998 characters
syntax    Header field syntax error missing Missing required header field
multiple  Duplicate or multiple occurrence of a header field

To disable certain tests on Centos/RHEL/CloudLinux/AlmaLinux edit the file /etc/amavisd/warden.conf or on Debian/Ubuntu edit the file /etc/amavis/conf.d/99-warden and search for the $allowed_header_tests option. Setting a test to 0 will disable that test:

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

After making these changes restart Amavis:

// Centos/RHEL/CloudLinux/AlmaLinux
systemctl restart amavisd

// Debian/Ubuntu
systemctl restart amavis

 

  • bad header, amavis
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How can I view what SpamAssassin rules were matched by a message?

Go to Warden -> Settings -> Filter Settings and change the Log template option from short...

How do I fix the error: Mysql Server has gone away?

When looking at the mail log of the server you see this log entry from Amavis: Aug 3 01:00:20...

What changes does Warden make to the postfix configuration files to enable Amavis?

Important Warden will configure postfix differently depending if you selected to install the...

How hard is it to uninstall if I do not require Warden Anti-spam and Virus Protection any more?

Uninstalling Warden is as easy as going to Extensions -> My Extensions -> Warden Anti-spam...

How can I fix the error: host 127.0.0.1[127.0.0.1] said: 552 5.3.4 Declared message size (1208029 B) exceeds size limit for recipient?

You can set the message size limit for Amavis under Settings -> Policy Settings -> Misc...