Direct Admin

Directadmin uses include files in exim.conf to easily extend the config to enable a smart host.

 

Step 1:

First create /etc/exim.authenticators.post.conf

change the section in hide client_send to your username and password

auth_login:
    driver = plaintext
    public_name = LOGIN
    hide client_send = : YOURUSERNAME : YOURPASSWORD

 

 

Your mailbaby username will not contain a @domain.com, but be a single username.

 

Step 2:

Edit /etc/exim.transports.pre.conf

auth_relay:
    driver = smtp
    port = 25
    hosts_require_auth = $host_address
    hosts_require_tls = $host_address
    headers_add = "${if def:authenticated_id{X-AuthUser: ${authenticated_id}}}"
    interface = <; ${if exists{/etc/virtual/domainips}{${lookup{$sender_address_domain}lsearch*{/etc/virtual/domainips}}}}
    helo_data = ${if exists{/etc/virtual/helo_data}{${lookup{$sending_ip_address}iplsearch{/etc/virtual/helo_data}{$value}{$primary_hostname}}}{$primary_hostname}}
    hosts_try_chunking =
    hosts_try_fastopen =
.include_if_exists /etc/exim.dkim.conf

auth_relay_forward:
    driver = smtp
    port = 25
    hosts_require_auth = $host_address
    hosts_require_tls = $host_address
    headers_add = "${if def:authenticated_id{X-AuthUser: ${authenticated_id}}}"
    interface = <; ${if exists{/etc/virtual/domainips}{${lookup{$sender_address_domain}lsearch*{/etc/virtual/domainips}}}}
    helo_data = ${if exists{/etc/virtual/helo_data}{${lookup{$sending_ip_address}iplsearch{/etc/virtual/helo_data}{$value}{$primary_hostname}}}{$primary_hostname}}
    hosts_try_chunking =
    hosts_try_fastopen =
    max_rcpt = 1
    return_path = ${srs_encode {SRS_SECRET} {$return_path} {$original_domain}}
.include_if_exists /etc/exim.dkim.conf

 

Step 3:

Create /etc/exim.routers.pre.conf

smart_route_forward:
    driver = manualroute
    domains = ! +local_domains
    ignore_target_hosts = 127.0.0.0/8
    condition = ${if !eq{$original_domain}{$domain}}
    condition = ${if !eq{$original_domain}{}}
    condition = "${perl{check_limits}}"
    
    transport = auth_relay_forward

    route_list = * relay.mailbaby.net
    no_more

smart_route:
    driver = manualroute
    domains = ! +local_domains
    ignore_target_hosts = 127.0.0.0/8
    condition = "${perl{check_limits}}"

    transport = auth_relay

    route_list = * relay.mailbaby.net
    no_more

 

 

Step 4:

Restart exim based on your operating system

centos7/8/ubuntu would use

systemctl restart exim.service

 

Step 5: Set default SPF

/usr/local/directadmin/directadmin set extra_spf_value ” include:relay.mailbaby.net”

systemctl restart directadmin.service

Further Reading: Please read https://help.directadmin.com/item.php?id=616 for setting spf records.

Other
Mail.baby recommends directadmin use rspamd. To further block inbound and outbound spam fuzzy storage as well as rbl examples using data from mail.baby is available for use at https://github.com/mailbaby/rspamd-rules

2 Replies to “Direct Admin”

  1. Roberto

    Reply

    Hi,

    This part its wrong:
    /usr/local/directadmin/directadmin set extra_spf_value ” relay.mailbaby.net”

    must be:
    /usr/local/directadmin/directadmin set extra_spf_value ” include:relay.mailbaby.net”

    Regards

Leave a Reply

Your email address will not be published. Required fields are marked *