1) Make a backup of the current /etc/virtual directory.
cd /etc
cp -Rp virtual virtual.backup
2) Ensure it exists:
mkdir -p /etc/virtual
chmod 755 /etc/virtual
chown mail:mail /etc/virtual
3) Create the following script
#!/bin/sh
echo -n '' > /etc/virtual/domains
echo -n '' > /etc/virtual/domainowners
mkdir -p /etc/virtual/`hostname`
chown mail:mail /etc/virtual/`hostname`
chmod 711 /etc/virtual/`hostname`
echo `hostname` >> /etc/virtual/domains
for u in `ls /usr/local/directadmin/data/users`; do
{
for d in `cat /usr/local/directadmin/data/users/$u/domains.list`; do
{
echo "$d: $u" >> /etc/virtual/domainowners
echo "$d" >> /etc/virtual/domains
DMN=/etc/virtual/$d
mkdir -p $DMN
chmod 711 $DMN
chown mail:mail $DMN
touch $DMN/aliases
if [ ! -s $DMN/aliases ]; then
echo "$u: $u" > $DMN/aliases
fi
touch $DMN/autoresponder.conf
touch $DMN/filter
touch $DMN/filter.conf
touch $DMN/passwd
touch $DMN/quota
touch $DMN/vacation.conf
chown mail:mail $DMN/*
mkdir -p $DMN/majordomo
chmod 751 $DMN/majordomo
chown majordomo:daemon $DMN/majordomo
mkdir -p $DMN/reply
chmod 700 $DMN/reply
chown mail:mail $DMN/reply
for p in `cat /usr/local/directadmin/data/users/$u/domains/$d.pointers 2>/dev/null`; do
{
echo "$p: $u" >> /etc/virtual/domainowners
echo "$p" >> /etc/virtual/domains
ln -s $d /etc/virtual/$p
};
done;
}
done;
}
done;
chown mail:mail /etc/virtual/domains
chown mail:mail /etc/virtual/domainowners
chmod 644 /etc/virtual/domainowners
chmod 644 /etc/virtual/domainsSave this code to a script somewhere on your system, eg /root/fix.sh. Chmod the script to 755, then run it:
chmod 755 /root/fix.sh
/root/fix.sh
4) Create other related email files, and update your exim.conf:
wget -O /etc/exim.conf
http://files.directadmin.com/services/exim.confwget -O /etc/exim.pl
http://files.directadmin.com/services/exim.plchmod 755 /etc/exim.pl
cd /etc/virtual
touch blacklist_domains whitelist_from use_rbl_domains bad_sender_hosts blacklist_senders whitelist_domains whitelist_hosts whitelist_senders
if [ ! -e limit ]; then echo 0 > limit; fi
mkdir -p usage
chown mail:mail limit blacklist_domains whitelist_from use_rbl_domains bad_sender_hosts blacklist_senders whitelist_domains whitelist_hosts whitelist_senders limit usage
If you are running dovecot (which you most likely are), you will need to re-patch your exim.conf:
patch -p0 < /usr/local/directadmin/customapache/exim.conf.dovecot.patch
patch -p0 < /usr/local/directadmin/custombuild/exim.conf.dovecot.patch
Note that you only need to run the patch appropriate to the build system you have. If you have custombuild, run the 2nd one. If you don't know what you have, then run them both, as it won't hurt anything if you patch twice.
Then restart exim: /etc/init.d/exim restart
5) rebuild majordomo:
cd /usr/local/directadmin/scripts
./majordomo.sh