Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jan 1997 19:10:02 +0200 (IST)
From:      Nadav Eiron <nadav@barcode.co.il>
To:        WebPro HTML Services <ratdog@baic.com>
Cc:        questions@freebsd.org
Subject:   Re: virtual hosts/email w/FreeBSD/Sendmail
Message-ID:  <Pine.BSF.3.91.970122190739.18212B-100000@gatekeeper.barcode.co.il>
In-Reply-To: <32E54B0E.310@baic.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Tue, 21 Jan 1997, WebPro HTML Services wrote:

> FreeBSD 2.1.5
> sendmail 8.7.5
> 
> I am trying to  configure sendmail to allow email for virtual hosts to
> be directed to local users. (user@virtual.host -> user@real.host)
> 
> There are many different resources out there for linux, and hardly two
> that say the same thing.  I know i must be close, but not quite close
> enough.  I know that there must be someone out there who has this setup
> and i'm interested in finding out what i'm missing in my attempt.
> 
> Any help is appreciated.
> 
> Thanks in advance.
> 
This are the instructions I once got on this list:
>From shovey@buffnet.netWed Jan 22 19:07:27 1997
Date: Fri, 25 Oct 1996 16:47:43 -0400 (EDT)
From: Steve <shovey@buffnet.net>
To: freebsd-questions@FreeBSD.ORG
Subject: virtual domains for email.

I keep seeing this question posted - below is a post I saved that explains
how to do virtual email domains

---------- Forwarded message ----------
Date: Thu, 15 Aug 1996 22:39:30 -0400 (EDT)
From: Mark Mathis <mark@earth.mat.net>
To: "Jun, Gyu-Chang" <geoid@ktnet.co.kr>
Cc: questions@freebsd.org
Subject: Re: Virtual mail hosting?

On Fri, 16 Aug 1996, Jun, Gyu-Chang wrote:
> 
>   Now, here is the question. Is it possible to set up virtual mail host?
>   I think if I set Cw record in sendmail.cf, aaa@www.aaa.com and
>   bbb@www.bbb.com can be handled. My point is that ONE FBSD box can accept
>   mail for webmaster@www.aaa.com and webmaster@www.bbb.com simutaneously..
> 

What you will need to do is first modify sendmail.cf to deal with two 
databases in the /etc directory that will handle the aliasing.

add these two lines to sendmail.cf

Kvirtualhosts btree /etc/virtualhosts.db
Kvirtualmasqs btree /etc/virtualmasqs.db

add this rule set for the return mail masq

S40
     
R$* < @ $* > $*         $@ $1 < @ $2 > $3       already fully qualified
#bc instead of automatically using $M, lookup masquerade in virtualmasqs
R$*                     $: $(virtualmasqs $1 $: $1 @ $M $)
#bcR$*                  $: $1 @ $M              add local qualification
R$* @                   $: $1 @ $j              if $M not defined

add this rule set for the virtual hosts

S98 

################################
# sendmail for virtual domains #
################################

R$+ < @ $+  . >         $: $1 < @ $2 > .
R$+ < @ $+ > $*         $: $(virtualhosts $1@$2 $: $1 < @ $2 > $3 $)
R$+ < @ $+ > $*         $: $(virtualhosts $2 $: $1 < @ $2 > $3 $)
R$+ < @ $* > .          $: $1 < @ $2 . >



for inbound mail:

create /etc/virtualhosts with your favorite text editor, there can be 
as many lines as you want for each virtual host.

virtdomain.com			john@mydomain.com   (all mail goes to john)
sam@virtdomain.com		sam@mydomain.com
webmaster@virtdomain.com	bob@other.domain.com (forward mail to 
							third system)

create the database virtualhosts.db from virtualhosts with the makemap 
command (makemap comes with sendmail)

makemap btree virtualhosts.db <virtualhosts

for outbound mail (they need an account on your system)
create /etc/virtualmasqs (if you use PINE do this in setup)

frank	frank@virtdomain.com
gloria	gloria@virtdomain.com
fred	fred@virtdomain.com

create the database virtualmasqs.db from virtualmasqs with the makemap 
command

makemap btree virtualmasqs.db <virtualmasqs


****************************************
EACH TIME YOU ADD ANOTHER VIRTUAL DOMAIN
****************************************
(this is from part of the instructions I give sysop's on our system)

5. Add Cw line in /etc/sendmail.cf

	Cw new.domain.com

6. Add alias to /etc/virtualhosts

	webmaster@new.domain.com	account@real.domain

	run command:

	makemap btree virtualhosts.db < virtualhosts

7. if they have an account on our machine and want mail to look like it 
is coming from their domain.

	add alias to /etc/virtualmasqs

	username	anyname@new.domain.com

	run command:

	makemap btree virtualmasqs.db < virtualmasqs

8. restart sendmail

	get the pid with

	ps -aux | grep sendmail

	run command:

	kill -HUP sendmail.pid





******************************************************************************
  /\	Mark Mathis	Micro Access Technologies  "Behind every successful
 /\/\	Mark@Mat.Net	PO Box 92224               cat is an obedient owner"
/\/\/\	202/529-5001	Washington, DC  20090
******************************************************************************

End forwarded message
------------------------

One other piece of info:
I don't remember what were the symptoms, but in order for me to get it to 
work I also had to modify ruleset 61 (which is not mentioned in the above 
message). My 61 ruleset now looks like this:
S61     

R$* < @ $* > $*         $@ $1 < @ $2 > $3               already qualified 
R$=E                    $@ $1 < @ $j>                   show exposed names
R$+                     $: $(virtualmasqs $1 $: $1 @ $M $)
#R$+                    $: $1 < @ $M >                  user w/o host 
R$+ <@>                 $: $1 < @ $j >                  in case $M undefined

Good luck,
Nadav



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.970122190739.18212B-100000>