Hi,
On Mon, Mar 19, 2012 at 01:20:30AM -0700, Shawn Wallbridge wrote:
> I am setting up a new mail server using OpenBSD 5.0. Initially this
> was the smtpd.conf I went with, based on the guide on calomel.org
> (https://calomel.org/opensmtpd.html) and this post on daemon forums
> (http://www.daemonforums.org/showthread.php?t=6228).
>
Please forget that calomel website... I beg you...
It is inaccurate from the very first paragraph, there is nothing in the
OpenSMTPD page that you cannot find in the man pages !
> # cat /etc/mail/smtpd.conf
> <snip>
> map "virtual" { source db "/etc/mail/virtual.db" }
> <snip>
> accept from all for domain "domain1.com" alias "virtual" deliver to maildir
> accept from all for domain "domain1.org" alias "virtual" deliver to maildir
> accept from all for domain "domain1.net" alias "virtual" deliver to maildir
> <snip>
>
That is three primary domains using a map called "virtual" to resolve
aliases, definitely not what you want.
> # cat /etc/mail/virtual
>
> # Tried both with and with out : separators
> [email protected] user1
> [email protected] user2
> [email protected] user3
> [email protected] user4
>
Your virtual map is incorrect also, keep on reading.
> When I telnet in to send mail to the virtual domains (the primary
> domain works fine), I get a rejection...
>
> Mar 19 02:27:35 mail smtpd[31255]: 344f0d39: from=<[email protected]>,
> relay=xxx.xxx.xxx.xxx.socal.res.rr.com [xxx.xxx.xxx.xxx],
> stat=LocalError (530 5.0.0 Recipient rejected: [email protected])
>
Yup, both conf and map are incorrect, so it just won't work.
> So I did some more research.
>
> On this page
> (http://www.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/smtpd/makemap.8
> ), for Revision 1.10, it states that...
>
> - they no longer need an explicit rule in smtpd.conf for EACH domain
>
> instead we introduce the: accept for virtual map "mapname" [...] syntax
> which refers to a map that can be manipulated at runtime.
>
> Which matches the man page for smtpd.conf. So, I have tried this in my
> smtpd.conf file...
>
> <snip>
> # tried with type db and using makemap, switched to plain as a test
> map "virtual" { source plain "/etc/mail/virtual" }
> <snip>
> accept from all for virtual "virtual" deliver to maildir
> <snip>
>
Now the smtpd.conf is correct (and matches the man page) ;-)
> Same problem, mail is rejected.
>
The map is still wrong.
> I have tried a bunch of different things, with no luck. I am guessing
> I am missing something very basic. I wish their was more documentation
> out there, but I think I have read every page out there. I can't wait
> for the book.
>
Ahem...
So since reading smtpd.conf(5) helped you fix smtpd.conf, let's give a try
at fixing the virtual map with makemap(8).
Jump to the section called "VIRTUAL DOMAINS":
VIRTUAL DOMAINS
Virtual domains are kept in maps. To add support for a virtual domain,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
add a domain key ``example.com whatever'' to the virtual map.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To create single virtual address, add ``[email protected] user'' to the
virtual map. To handle all mail destined to any user at example.com, add
``@example.com user'' to the virtual map.
In addition to adding an entry to the virtual map, one must add a filter
rule that accepts mail for virtual domains, for example:
map "vdomains" { source db "/etc/mail/vdomains.db" }
accept for virtual "vdomains" deliver to mbox
The second sentence explains what you have to do to enable a virtual domain,
and which is precisely what's lacking from your map.
The second paragraph also documents what you found in smtpd.conf(5) regarding
the format of the rule for a virtual domain. It was documented in two places.
> Anyone out there have virtual domains working that would be willing to
> share their config? Or help point me in the right direction?
>
Done !
Gilles
PS: please forget that calomel site.
--
Gilles Chehade
https://www.poolp.org | http://pool.ps @poolpOrg