How to make Exim to send messages with IP assigned to other users is described here. And here in the article you can find some bash scripts for generating files with IP data automatically. Or you can use them with cron.
#!/bin/bash# # by Alex S Grebenschikov (support@poralix.com) # v.0.1.2 2014-03-08 # get_ip() { ip=`grep "^ip=" /usr/local/directadmin/data/users/$owner/domains/$domain.conf | cut -d\= -f2` } if [ -f "/etc/virtual/domainips" ]; then mv /etc/virtual/domainips /etc/virtual/domainips.bak`date +%Y%m%d` fi; touch /etc/virtual/domainips; servername=`grep ^servername= /usr/local/directadmin/conf/directadmin.conf | cut -d\= -f2` for domain in `cat /etc/virtual/domains | grep -v ^$servername$ | sort | uniq`; do ip=''; owner=`grep ^$domain: /etc/virtual/domainowners | cut -d\ -f2` if [ -f "/usr/local/directadmin/data/users/$owner/domains/$domain.conf" ]; then # REGULAR DOMAIN get_ip; echo "[D] Found domain $domain owned by $owner. IP=$ip"; [ -z "$ip" ] || echo "$domain:$ip" >> /etc/virtual/domainips; else # POINTER pointer=$domain; if [ -d "/etc/virtual/$domain" ]; then domain=`ls -ld /etc/virtual/$domain | awk '{print $11}'` fi; get_ip; echo "[P] Found domain pointer $pointer to $domain owned by $owner. IP=$ip"; [ -z "$ip" ] || echo "$pointer:$ip" >> /etc/virtual/domainips; fi; done; chmod 440 /etc/virtual/domainips; chown mail:mail /etc/virtual/domainips; exit;
The file /etc/virtual/helo_data is a link to /etc/virtual/smtp_active_hostnames
#!/bin/bash # # by Alex S Grebenschikov (support@poralix.com) # v.0.1 2014-03-22 # Only IPv4 supported # save_to_file="/etc/virtual/smtp_active_hostnames"; servername=`grep ^servername= /usr/local/directadmin/conf/directadmin.conf | cut -d\= -f2`; if [ -f "${save_to_file}" ]; then echo "Creating a backup copy of the file ${save_to_file}"; mv ${save_to_file} ${save_to_file}.bak`date +%Y%m%d`; fi; touch ${save_to_file}; for IP in `cat /usr/local/directadmin/data/admin/ip.list | grep -v ^127.0.0.1$ | grep "\." | sort`; do { status=''; owner=''; hostname=''; echo -n "[IP] Found ${IP}"; if [ -f "/usr/local/directadmin/data/admin/ips/${IP}" ]; then { status=`grep ^status= /usr/local/directadmin/data/admin/ips/${IP} | cut -d\= -f2`; [ "${status}" != "owned" ] || owner=`grep ^value= /usr/local/directadmin/data/admin/ips/${IP} | cut -d\= -f2`; echo -n " with status=${status} ${owner}"; hostname=${servername}; if [ "${status}" == "owned" ]; then { homedir=`grep "^${owner}:" /etc/passwd | cut -d\: -f6`; if [ -d "${homedir}/public_html" ]; then { hostname="mail.`ls -dl ${homedir}/public_html | awk '{print $11}' | cut -d\/ -f3`"; } fi; } fi; echo " hostname set to ${hostname}"; echo "${IP}: ${hostname}" >> ${save_to_file}; } fi; } done; exit 0;
Posted here on Directadmin forums