[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sendmail virtual hosting




On Wed, 21 Jul 1999, A. M. Varon wrote:

> Hi,
> 
> Anybody has experience with sendmail virtual hosting on a
> Debian slink/potato? Any tips/tricks to share?

I use slink with sendmail on one of my machines doing this.

First of all, put all virtualhosts in the /etc/mail/sendmail.cw file, one
host in one line. This is needed for sendmail to accept mail for the host.
You need to restart sendmail for this to take effect, but you will need to
restart it later anyway, so don't restart it for now.

You need to reconfigure sendmail to use genericstable and virtual user
table features.

You can do it the following way, if you have not already done it:

These two lines should be in /etc/mail/sendmail.mc:


FEATURE(`virtusertable', `hash /etc/mail/virtualusertable')dnl
FEATURE(`genericstable', `hash /etc/mail/genericstable')dnl   
GENERICS_DOMAIN_FILE(`/etc/mail/sendmail.cG')dnl

(I think the last line is there by default.)

After this you need to run sendmailconfig. It recreates sendmail.cf. For
me it also puts in an error, for which I need to edit the generated
sendmail.cf manually, to comment out a line for which it generates an
error upon restarting sendmail. But it may be due to the fact that my
machine had exim as well, and I installed sendmail upon it, instead of
removing exim before.

Anyway, after running sendmailconfig, if you restart sendmail, it will
probably give an error message complaining about not being able to find
/etc/mail/virtualusertable.db and /etc/mail/genericstable.db.

Ignore this for a moment, or don't restart.

Create a script containing:

makemap hash /etc/mail/virtualusertable < /etc/mail/virtualusertable
makemap hash /etc/mail/genericstable < /etc/mail/genericstable

This will be used to rebuild the binary databases from the text source of
them. These databases can be used to provide mapping for addresses to
users/forward addresses. 
The databases are the .db files sendmail complains about not being able to
find.

The format of these files are:

virtualusertable:

<email><TAB><user/forward_address>

genericstable:

<username><TAB><email_address_to_appear_in_headers>


Both files should contain lines only of the given structure. <TAB> is a
TAB character (\t)

The virtualusertable contains the email address to look for in the first
column. If an email is arriving for this address, then it takes the action
defined in the second column. The action can be a username for the message
to be delivered to. It can be an email address for the message to be
forwared to. It can be an alias name as well. And probably it can be a
program delivery line, or mailbox file in procmail syntax as well,
although I am not sure about this. 


The genericstable contains usernames in the first column. The second
column contains the email address to which the address is rewritten to.
Sendmail rewrites all addresses according to this, if the domain of the
original address is in /etc/mail/sendmail.cG and the user is in the
genericstable file.

So, create these files (/etc/mail/virtualusertable and
/etc/mail/genericstable) (or at least touch them). 

After it, run the script creating the binary databases.

Now, you can restart sendmail, and it should be working.

After altering the two tables you need to rerun the script creating the
binary databases, but you don't need to restart sendmail. 

However if you add to /etc/mail/sendmail.cw or /etc/mail/sendmail.cG then
you do need to restart sendmail, I think.

For using hashtables, I think you need libgdbmg1 package to be installed.
Probably it is installed anyway.

Good luck,

Robert Varga


Reply to: