Where did you find that line? What version of exim.conf, what line #? Or did you add it yourself? The variable doesn't appear to be in my copy of exim.conf.PHP:local_interfaces = 127.0.0.1 : a.a.a.a : b.b.b.b : c.c.c.c : d.d.d.d
# CONFIGURATION STARTS HERE
###START ADDED###
disable_ipv6
local_interfaces = 127.0.0.1 : 216.82.195.25 : 216.82.195.60 : 216.82.195.63 : 216.82.195.64 : 216.82.195.68 : 216.82.195.69 : 216.82.195.77 : 216.82.195.79 : 216.82.195.80 : 216.82.195.81 : 216.82.195.82 : 216.82.195.83 : 216.82.195.84 : 216.82.195.85
smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/virtual/smtp_active_hostnames}{$value}}
smtp_banner = "$smtp_active_hostname ESMTP $tod_full"
###END ADDED###
Thanks, just found it in the documentation. Says it's a string list, so it probably can't be read from anexternal file.
Test it and see .
Jeff
#!/bin/bash#
# by Alex S Grebenschikov ([email protected])
# 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;
Of course for HELO data and hostnames we could select the primary domain from the account (selected in directadmin as the default one).
And yes, using the primary domain would allow the admin or user to use the tools which already exist to select which would be best for them.
And what about shared IPs? For some reasons there might be several shared IPs with more than one domain of more than one user there (resellers for example). What name should we choose for HELO and HOSTNAME? And how to choose?
#!/bin/bash
#
# by Alex S Grebenschikov ([email protected])
# 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;