DA to manage domain IPS file for exim outbound IP/interfaces

Version 1.47


BETA DA will manage this files: /etc/virtual/domainips /etc/virtual/helo_data for any domain created with an IP that is not the server IP. helo_data will only get owned IPs. Requires directadmin.conf setting: add_domain_to_domainips=1 internal default is: add_domain_to_domainips=0 This is for exim to use, to pick which IP to use when sending email, instead of sending from the server IP. This can help isolate spamming domains from valid domains, so if an IP is blocked, domains that send from a different IP won't be blocked. It relies on the "a" or "mx" values being set in the SPF record, so the IP added should be what they resolve to. In the even that adding to the file fails, it will end up sending from the server IP, so the server IP should always be in the SPF/TXT record. If you have multiple owned IPs assigned to a domain, the first value added will have priority, when in question. If it's not what you want, delete then re-add the IP you want to have less priority from the User Level -> Domain's additional IP page. ----------- If you need to disable the feature, then set add_domain_to_domainips=0 option, and delete the files: /etc/virtual/domainips /etc/virtual/helo_data ----------- exim.conf 4.3.1 adds these lines to the remote_smtp section: 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}} and this one, just after #EDIT#1 (after #primary_hostname) smtp_active_hostname = ${if exists{/etc/virtual/helo_data}{${lookup{$interface_address}iplsearch{/etc/virtual/helo_data}{$value}{$primary_hostname}}}{$primary_hostname}} NOTE: current exim.conf 4.4.x already have these sections, so no need to edit your exim.conf. ----------- For a LAN setup, DA assumes you've set the directadmin.conf option: lan_ip= to the main LAN ip for the system that connects outbound,on the licensed/server IP. For LAN ips that are not the lan_ip value, it gets more complicated. DA takes the owned IP assigned to domain (External value), and assumes you've setup a linked LAN IP to this external IP. It will go through the list of Linked IPs (probably going to be just the 1 value) and make an outbound call to: myip.directadmin.com while binding to the given linked-IP LAN ip value. Basically, DA will force the local outbound connection to use that linked LAN IP.. The myip site will tell DA what the external value is for this IP... and if it matches the owned external IP assigned to the domain, then the given Linked LAN IP will be the value DA sets in the domainips file. A little overkill, but should be handy for LAN setups that use mutiple IPs who want sending IP segregation. ------------- task.queue Add all domains and pointers to the domainips file: echo "action=rewrite&value=domainips" >> /usr/local/directadmin/data/task.queue same as above, but will start from an empty domainips file, handy if everything is out of sync, start over: echo "action=rewrite&value=domainips&empty=yes" >> /usr/local/directadmin/data/task.queue Adds just this domain (and it's pointers), but it will remove the previous values from the domainips first (unlike the mass rewrite) This is better because it will remove server IP values, if they don't belong.. or fix any out-of-sync IPs. echo "action=rewrite&value=domainips&domain=domain.com" >> /usr/local/directadmin/data/task.queue Similarly, for helo_data: All: echo "action=rewrite&value=helo_data" >> /usr/local/directadmin/data/task.queue Just for one IP: echo "action=rewrite&value=helo_data&ip=" >> /usr/local/directadmin/data/task.queue

Interested to try DirectAdmin? Get a 30-day Free Trial!