"Richard" == Richard Roderick <[EMAIL PROTECTED]> writes:

    Richard> In answer to the original question: It's not easy. I just
    Richard> finished developing the tools to deal with all of it.


I handled this conversion in < 1 hour for over 30 domains. 300 or 3000
domains would have taken no longer since I built myself tools. I found
it pretty damn trivial. Perl is your friend. But you could do this
with sed, awk and grep.

What I did:

Grep out all the domains on the LHS from the sendmail virtualuser
table and put them in /var/qmail/control/virtualdomains all with the
same RHS like so:

domain-a.com:alias-virtualdomains
domain-b.com:alias-virtualdomains
domain-c.com:alias-virtualdomains
...

awk makes that pretty simple:

awk '/^#/{next};/^ *$/{next};{split($1,a,/@/);print a[2]":alias-virtualdomains"}' \
< /etc/mail/virtusertable >> /var/qmail/control/virtualdomains

Install fastforward (see http://www.qmail.org).

Setup ~alias/.qmail-virtualdomains-default:

echo "|/var/qmail/bin/fastforward -d /var/qmail/etc/virtualaliases.cdb" >
~alias/.qmail-virtualdomains-default

Build /var/qmail/etc/virtualaliases.cdb. I'd use a perl script for
that depending upon complexity. I'd send you the one I used if I could
still find it...  virtualaliases is similar to sendmail's
virtusertable, but more flexible.

For example, virtualaliases allows multiple addresses on the RHS. With
sendmail, you can only use a single address on the RHS which you then
need to expand in the aliases file to multiple addresses.

If you only have a single address on the RHS in virtusertable, the
conversion is simple, just add a ':' after every address in the LHS
and add a ';' after every address on the RHS. You can do that with
awk:

awk '/^#/{next};/^ *$/{next};{print $1":\t"$2";"}' \
< virtusertable >> /var/qmail/etc/virtualaliases

Clean up virtualaliases as needed, you'll want to fully qualify
addresses on the RHS. If any of the RHS addresses actually appear in
your /etc/aliases, then you'll want to expand those out. If you have a
bunch, I suggest you write a script to iterate through all the LHS
addresses and call sendmail -bv to expand out the RHS.

Don't forget to turn the virtualaliases file into a cdb:

setforward virtualaliases.cdb virtualaliases.tmp < virtualaliases

Good luck. You'll be happier with qmail in the long run. Trust
me. I've administered both for quite some time.

Also, people on this list are more receptive if you lose the attitude.

j.
--
Jay Soffian <[EMAIL PROTECTED]>                            UNIX Systems Engineer
404.572.1941                                             Cox Interactive Media

Reply via email to