Let Rspamd ignore relayhost in SPF check

Discussion in 'Tips/Tricks/Mods' started by remkoh, Nov 29, 2022.

  1. remkoh

    remkoh Active Member

    When your ISPConfig mailserver sits behind a relayhost you'll get SPF failures as the relayhost is of course not part of the senders SPF records in their DNS.

    Rspamd can be configured to ignore given hostnames and check SPF against the host before the relayhost.

    Create file /etc/rspamd/local.d/external_relay.conf
    Code:
    # enable the module
    enabled = true;
    
    # rules are defined inside rules {} block
    rules {
      # this is the name of the symbol we will register
      EXTERNAL_RELAY_AUTHENTICATED {
        # a recognised strategy MUST be defined
        strategy = "hostname_map";
        # there may be additional non/optional settings available particular to the strategy
        hostname_map = "/etc/rspamd/external_relay_hostname.map";
      }
    }
    
    and create file /etc/rspamd/external_relay_hostname.map with a list of hostnames to ignore:
    Code:
    relayhostA.domain.tld
    relayhostB.domain.tld
    
    Restart the Rspamd service and you're done.

    More information can be found here:
    https://rspamd.com/doc/modules/external_relay.html
     

Share This Page