As a proof of concept, I have a setup doing that which I think you are
trying to do:

-------------------
table vdomains     file:/etc/mail/table_vmail_domains
table vaddr     file:/etc/mail/table_vmail_addresses
table vmailstub { '@' = vmail }
listen on em0
action "deliver_vmail" maildir
"/home/vmail/domains/%{rcpt.domain:lowercase}/%{rcpt.user:lowercase|strip}"
virtual <vmailstub>
match from any for domain <vdomains> rcpt-to <vaddr> action "deliver_vmail"
-------------------

I'm using 6.6.0.  For clarity I've included only the pertinent conf
lines.  This config is successfully delivering the mail to the
pure-virtual users in the desired directory heirarchy
(/home/vmail/domains/example.com/user).  The only places these
pure-virtual users exist is in the "vaddr" table and the directory
heirarchy (they are also in an "auth" table for relaying, but I removed
that for clarity).

It took me a lot of trial and error to come up with the "virtual
<vmailstub>" at the end of the action.  It seems like "user virtual"
should go there, but for unclear reasons that yields "** 550 Invalid
recipient"; when I replace "user virtual" with "virtual <vmailstub>"
(which always returns "vmail") the mail is accepted (for users in the
vaddr table) and delivered as desired.  Not an elegant solution, but it
works.

I've not installed/integrated dovecot yet.  I'm curious about
suggestions for the best way to integrated dovecot and/or manage users
in such a system.


-Andy


On 11/23/2019 7:08 AM, Implausibility wrote:
> Hi again.
>
> My mail server has been running fine since last weekend, and I'm trying to 
> expand its functionality by including the ability to send and receive mail 
> for my list of domains, and for eMail addresses which forward to locally 
> defined users -- but I can't seem to get it working, and I think the issue is 
> my (mis-)understanding of how the match parameter works...
>
> In order to get virtual users working, I've added three lines to the config:
>
>> table vusers file:/etc/mail/vusers
>> action "vusers" maildir junk virtual <vusers>
>> match from any for domain <domains> rcpt-to virtual <vusers> action "vusers"
> I was able to get mail delivered for local users to my virtual domains 
> previously without issue.  But I can't get virtual addresses working...
>
> I've tried a half a dozen varieties of the match command, and I keep getting 
> 'syntax error', and it doesn't give me any hint as to what exactly the 
> problem is.  I want to accept eMail from any destination, to the domains 
> defined in the domains table, that are sending to recipients listed in the 
> vusers table, to deliver them to the maildir for access via Dovecot IMAP.
>
> Any help in getting this working would be appreciated.
>
> Here's my config:
>
>> #       $OpenBSD: smtpd.conf,v 1.11 2018/06/04 21:10:58 jmc Exp $
>>
>> # This is the smtpd server system-wide configuration file.
>> # See smtpd.conf(5) for more information.
>>
>> table aliases file:/etc/mail/aliases
>> table domains db:/etc/mail/domains.db
>> table vusers file:/etc/mail/vusers
>>
>> # To accept external mail, replace with: listen on all
>> #
>> # listen on all
>>
>> action "local_mail" maildir junk alias <aliases>
>> action "vusers" maildir junk virtual <vusers>
>> action "outbound" relay helo mail.example.com
>>
>> match from any for domain <domains> action "local_mail"
>> match for local action "local_mail"
>> match for any action "outbound"
>>
>> pki mail.hottub.ca cert "/etc/ssl/mail.example.fullchain.pem"
>> pki mail.hottub.ca key "/etc/ssl/private/mail.example.key"
>>
>> filter check_dyndns phase connect match rdns regex { '.*\.dyn\..*', 
>> '.*\.dsl\..*' } \
>>     disconnect "550 you look like a spammer"
>>
>> filter check_rdns phase connect match !rdns \
>>     disconnect "550 you look like a spammer"
>>
>> filter check_fcrdns phase connect match !fcrdns \
>>     disconnect "550 you look like a spammer"
>>
>> filter senderscore \
>>     proc-exec "filter-senderscore -blockBelow 10 -junkBelow 70 -slowFactor 
>> 5000"
>>
>> filter rspamd proc-exec "filter-rspamd"
>>
>> listen on all tls pki mail.example.ca \
>>     filter { check_dyndns, check_rdns, check_fcrdns, senderscore, rspamd }
>>
>> listen on all port submission tls-require pki mail.hottub.ca auth filter 
>> rspamd
>>
>> match from any for domain "mail.example.ca" action "local_mail"
>> match from any for domain <domains> rcpt-to virtual <vusers> action "vusers"
>> match for local action "local_mail"
>>
>> match from any auth for any action "outbound"
>> match for any action "outbound"
>>
>
>

Reply via email to