cPanel/WHM IP-based Authentication (selected domains)

This method allows you to filter selected domains via our Outgoing filter, while using IP authentication. Any domains not configured will continue to use the standard cPanel router and transport for outbound mail.

  1. Log in to SpamExperts, ensure the IP address is added as an authenticating method by following the Add an Outgoing User > Authenticating IP or Range instructions
    1. When adding the Authenticating IP, ensure the correct limits are set matching your traffic volumes
  2. SSH to the cPanel/WHM node
  3. Create a text file /etc/spamexperts_domains
  4. Add the domain(s) that you wish to filter outbound mail for in this new file, one domain per line
  5. Save the file
  6. Open WHM and navigate to the Exim Configuration Editor
  7. Select Advanced Editor
  8. Add the following to the POSTMAILCOUNT section:
  9. smarthost_dkim:
      driver = manualroute
      domains = !+local_domains
      condition = ${if match_domain{$sender_address_domain}{lsearch;/etc/spamexperts_domains}}
      require_files = "+/var/cpanel/domain_keys/private/${lookup{$sender_address_domain}dsearch{/var/cpanel/domain_keys/private/}}"
      # Exclude null sender messages from relaying via the smarthost
      condition = ${if or {{!eq{$sender_address}{}} {!eq{$sender_host_address}{}}}}
      transport = remote_smtp_smart_dkim
      route_list = $domain SMARTHOST::587
     
    smarthost_regular:
      driver = manualroute
      domains = !+local_domains
      condition = ${if match_domain{$sender_address_domain}{lsearch;/etc/spamexperts_domains}}
      # Exclude null sender messages from relaying via the smarthost
      condition = ${if or {{!eq{$sender_address}{}} {!eq{$sender_host_address}{}}}}
      transport = remote_smtp_smart_regular
      route_list = $domain SMARTHOST::587 

    Replace SMARTHOST with the your SMTP hostname

  10. Add the following to the TRANSPORTSTART section
  11. remote_smtp_smart_dkim:
      driver = smtp
      hosts_require_tls = *
      interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
      helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
      dkim_domain = $sender_address_domain
      dkim_selector = default
      dkim_private_key = "/var/cpanel/domain_keys/private/${lookup{$dkim_domain}dsearch{/var/cpanel/domain_keys/private/}}"
      dkim_canon = relaxed
      headers_add = "${perl{check_mail_permissions_headers}}"
     
    remote_smtp_smart_regular:
      driver = smtp
      hosts_require_tls = *
      interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
      helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
      headers_add = "${perl{check_mail_permissions_headers}}" 
  12. Save and restart
  13. All traffic from the cPanel/WHM server will be routed to the SpamExperts filtering nodes.

Disclaimer: This documentation may contain references to third party software or websites. N-able has no control over third party software or content and is not responsible for the availability, security, or operation, of any third-party software. If you decide to utilize a release involving third-party software, you do so entirely at your own risk and subject to the applicable third party’s terms and conditions of the use of such software. No information obtained by you from N-able or this documentation shall create any warranty for such software.