Date: Fri, 17 Jul 1998 02:26:37 -0400 From: Geovanny Fajardo <fajardo@gate.net> To: freebsd-questions@FreeBSD.ORG Subject: Sendmail Virtual Host Rule Sets Message-ID: <35AEEE9C.D4FCA4A7@gate.net>
next in thread | raw e-mail | index | archive | help
I found this message in the archives and it was very useful to me, but I still had some problems getting sendmail to work so I modified this message with the information I used to get sendmail working for me. I'm using FreeBSD 2.2.6-RELEASE. Remember that sendmail.cf has a very sensitive sintax so do not forget to use tabs for places where you see more than one space between characters. 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. 1) Add these two lines to sendmail.cf Kvirtualhosts btree /etc/virtualhosts.db Kvirtualmasqs btree /etc/virtualmasqs.db 2) Add this rule sets for the return mail masq S40 R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified R$* $: $(virtualmasqs $1 $: $1 @ $M $) R$* @ $: $1 @ $j if $M not defined S61 R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified R$=E $@ $1 < @ $j> R$+ $: $(virtualmasqs $1 $: $1 @ $M $) R$* @ $: $1 @ $j if $M not defined 3) 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 . > 5) For inbound mail: a) 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) b) Create the database virtualhosts.db from virtualhosts with the makemap command (makemap comes with sendmail) makemap btree virtualhosts.db < virtualhosts 6) For outbound mail (they need an account on your system) a) Create /etc/virtualmasqs frank frank@virtdomain.com gloria gloria@virtdomain.com fred fred@virtdomain.com b) 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) 1. Add Cw line in /etc/sendmail.cf Cw new.domain.com 2. Add alias to /etc/virtualhosts webmaster@new.domain.com account@real.domain run command: makemap btree virtualhosts.db < virtualhosts 3. 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 4. Restart sendmail get the pid with ps -aux | grep sendmail run command: kill -HUP sendmail.pid NOTE If you only changed the virtual hosts and virtualmasqs databases you do not need to restart sendmail!!! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35AEEE9C.D4FCA4A7>