smtpd, virtual users/domains and maildir creation
Hi, I am playing with OpenSMTPD and am configuring a virtual domains and users configuration. In smtpd.conf.local, I have set: map vdomains { source db /etc/mail/vdomains.db } accept for virtual vdomains deliver to maildir /home/vmail/%d/%a/ In /etc/mail/vdomains, I have set: tumfatig.net: true carnat.net: true pt...@tumfatig.net vmail j...@carnat.net vmail So far, the mails are accepted but I face an error when the first mail is received ; when the full home directory does not exist yet: Jun 15 15:12:36 openbsd smtpd[6293]: dcd4684048255931: to=j...@carnat.net, \ delay=0, stat=Error (cannot mkdir maildir: No such file or directory) When this error occurs, /home/vmail already exists and is own by vmail:vmail. Now, if I run: # mkdir /home/vmail/carnat.net # chown vmail:vmail /home/vmail/carnat.net And send the same mail (to j...@carnat.net), it is received correctly and the remaining vmail/new directory tree is created. Is there some parameters to set so that smtpd creates the whole directory tree itself or is this an expected behaviour ? TIA, Jo
Re: smtpd, virtual users/domains and maildir creation
On Fri, Jun 15, 2012 at 03:28:42PM +0200, Joel Carnat wrote: Hi, Hi, I am playing with OpenSMTPD and am configuring a virtual domains and users configuration. In smtpd.conf.local, I have set: map vdomains { source db /etc/mail/vdomains.db } accept for virtual vdomains deliver to maildir /home/vmail/%d/%a/ reads ok, except that you should remove '{' and '}', they were required but I made them optional to ease transition as I will remove them next release. In /etc/mail/vdomains, I have set: tumfatig.net: true carnat.net: true pt...@tumfatig.net vmail j...@carnat.net vmail reads ok So far, the mails are accepted but I face an error when the first mail is received ; when the full home directory does not exist yet: Jun 15 15:12:36 openbsd smtpd[6293]: dcd4684048255931: to=j...@carnat.net, \ delay=0, stat=Error (cannot mkdir maildir: No such file or directory) When this error occurs, /home/vmail already exists and is own by vmail:vmail. Now, if I run: # mkdir /home/vmail/carnat.net # chown vmail:vmail /home/vmail/carnat.net And send the same mail (to j...@carnat.net), it is received correctly and the remaining vmail/new directory tree is created. Is there some parameters to set so that smtpd creates the whole directory tree itself or is this an expected behaviour ? OpenSMTPD only creates the Maildir itself so you need to make sure you create a directory for each of the domains you plan to handle if you are using the domain as part of the path. Should we have an option to let it create all directories in the path ? I dunno, it's pretty easy to pre-create them and let the code be as strict as it is right now :-) Gilles -- Gilles Chehade https://www.poolp.org | http://pool.ps @poolpOrg
Re: smtpd, virtual users/domains and maildir creation
Le 15 juin 2012 à 17:03, Gilles Chehade a écrit : On Fri, Jun 15, 2012 at 03:28:42PM +0200, Joel Carnat wrote: Hi, Hi, I am playing with OpenSMTPD and am configuring a virtual domains and users configuration. In smtpd.conf.local, I have set: map vdomains { source db /etc/mail/vdomains.db } accept for virtual vdomains deliver to maildir /home/vmail/%d/%a/ reads ok, except that you should remove '{' and '}', they were required but I made them optional to ease transition as I will remove them next release. ok, I'll correct my config, thanks. In /etc/mail/vdomains, I have set: tumfatig.net: true carnat.net: true pt...@tumfatig.net vmail j...@carnat.net vmail reads ok So far, the mails are accepted but I face an error when the first mail is received ; when the full home directory does not exist yet: Jun 15 15:12:36 openbsd smtpd[6293]: dcd4684048255931: to=j...@carnat.net, \ delay=0, stat=Error (cannot mkdir maildir: No such file or directory) When this error occurs, /home/vmail already exists and is own by vmail:vmail. Now, if I run: # mkdir /home/vmail/carnat.net # chown vmail:vmail /home/vmail/carnat.net And send the same mail (to j...@carnat.net), it is received correctly and the remaining vmail/new directory tree is created. Is there some parameters to set so that smtpd creates the whole directory tree itself or is this an expected behaviour ? OpenSMTPD only creates the Maildir itself so you need to make sure you create a directory for each of the domains you plan to handle if you are using the domain as part of the path. Should we have an option to let it create all directories in the path ? I dunno, it's pretty easy to pre-create them and let the code be as strict as it is right now :-) right ; like know what you are doing :) I was just surprised as my actual Postfix / Dovecot configuration did the mkdir -p themselves. I'll just keep the create the directories step in my notes ;-) While I'm there, I ended filling my /etc/mail/vdomains with such directives: carnat.net accept j...@carnat.net vmail r...@carnat.net j...@carnat.net ab...@carnat.netr...@carnat.net hostmas...@carnat.net r...@carnat.net postmas...@carnat.net r...@carnat.net webmas...@carnat.netr...@carnat.net This does works and allows virtual aliases to be defined. And all my test mails went to my user account. I'm not just sure if this is the right way to do it as I didn't find such mapping described in the docs. But I found using one map aliases (...) per virtual domain not very practical. What's the proper way to host virtual aliases for virtual domains ? TIA, Jo
Re: smtpd, virtual users/domains and maildir creation
On Fri, Jun 15, 2012 at 05:20:28PM +0200, Joel Carnat wrote: [...] OpenSMTPD only creates the Maildir itself so you need to make sure you create a directory for each of the domains you plan to handle if you are using the domain as part of the path. Should we have an option to let it create all directories in the path ? I dunno, it's pretty easy to pre-create them and let the code be as strict as it is right now :-) right ; like know what you are doing :) I was just surprised as my actual Postfix / Dovecot configuration did the mkdir -p themselves. I'll just keep the create the directories step in my notes ;-) While I'm there, I ended filling my /etc/mail/vdomains with such directives: carnat.net accept j...@carnat.net vmail r...@carnat.net j...@carnat.net ab...@carnat.netr...@carnat.net hostmas...@carnat.net r...@carnat.net postmas...@carnat.net r...@carnat.net webmas...@carnat.netr...@carnat.net This does works and allows virtual aliases to be defined. And all my test mails went to my user account. I'm not just sure if this is the right way to do it as I didn't find such mapping described in the docs. But I found using one map aliases (...) per virtual domain not very practical. What's the proper way to host virtual aliases for virtual domains ? The proper way is the one you're using ;-) Also, one thing you could do is create a fallback address: @carnat.net r...@carnat.net if you want to also catch every user of the @carnat.net domain that does not have its own key: carnat.net whatever # enable vdomain @carnat.net r...@carnat.net# any user w/out key j...@carnat.net vmail r...@carnat.net j...@carnat.net Gilles -- Gilles Chehade https://www.poolp.org | http://pool.ps @poolpOrg
Re: smtpd, virtual users/domains and maildir creation
Le 15 juin 2012 à 17:37, Gilles Chehade a écrit : snip What's the proper way to host virtual aliases for virtual domains ? The proper way is the one you're using ;-) Also, one thing you could do is create a fallback address: @carnat.net r...@carnat.net if you want to also catch every user of the @carnat.net domain that does not have its own key: carnat.net whatever # enable vdomain @carnat.netr...@carnat.net# any user w/out key j...@carnat.netvmail r...@carnat.netj...@carnat.net great! thanks a lot. Jo