[Dovecot] Sendmail + Deliver as an LDA
Need help with setup/config.
Current situation: (dovecot version : 1.1.7)
we have system users and virtual users. (with different domains)
Virtual users have procmail as LDA
Now we want "deliver" to become the LDA
I'm confused reading http://wiki.dovecot.org/LDA/Sendmail
sendmail.mc:
divert(-1)
divert(0)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`$Id: sendmail-procmail.mc,v 1.2 2004/12/07 01:59:31 g2boojum Exp $')dnl
OSTYPE(linux)dnl
DOMAIN(generic)dnl
define(PROCMAIL_MAILER_PATH',
/usr/bin/procmail')dnl
define(`confDONT_PROBE_INTERFACES',true)dnl
define(ALIAS_FILE',
/etc/mail/aliases')dnl
dnl FEATURE(smrsh',
/usr/sbin/smrsh')dnl
dnl FEATURE(local_lmtp',
/usr/sbin/mail.local')dnl
FEATURE(`local_procmail')dnl
FEATURE(`redirect')dnl
FEATURE(`access_db')dnl
FEATURE(virtusertable',
hash -o /etc/mail/virtusertable')dnl
dnl FEATURE(`mailertable')dnl
FEATURE(`always_add_domain')dnl
FEATURE(`use_ct_file')dnl
FEATURE(`use_cw_file')dnl
FEATURE(`blacklist_recipients')dnl
dnl FEATURE(`relay_entire_domain')dnl
dnl MAILER(local)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
INPUT_MAIL_FILTER(mimedefang',
S=unix:/var/spool/MIMEDefang/mimedefang.sock, T=S:5m;R:5m')dnl
What setup do we need for both system and virtual users ?
Help would be appreciated !
thx Natan
Reageer op foto’s van je vrienden en bekijk hun reacties op de jouwe. Gegarandeerd hilariteit! http://www.microsoft.com/belux/nl/windows/windowslive/products/photos.aspx
Natan Vermeersch natanver@hotmail.com wrote:
Need help with setup/config.
Current situation: (dovecot version : 1.1.7)
we have system users and virtual users. (with different domains) Virtual users have procmail as LDA
Now we want "deliver" to become the LDA
I'm confused reading http://wiki.dovecot.org/LDA/Sendmail [...]
To use dovecot's deliver as sendmail's local mailer you need the following lines in your sendmail.mc:
FEATURE(local_procmail',
/local/dovecot/libexec/dovecot/deliver',deliver -d $u') MODIFY_MAILER_FLAGS(
LOCAL', `-f')
Change path to dovecot's deliver to fit your installation.
The second line is needed only if your deliver does not support "-f envelope_sender" command line argument or if dovecot and sendmail do not "play well together" with "empty" (<>) envelope sender. I do not think it is required but http://wiki.dovecot.org/LDA/Sendmail mentions it for some (unexplained) reasons.
the above changes should not affect deliveries to virtual users [ unless you use *VERY* unusual sendmail configuration ]
P.S. Do you reject messages to non existing virtual users in reply to "RCPT TO:"?
-- [pl>en: Andrew] Andrzej Adam Filip : anfi@onet.eu Gauls! We have nothing to fear; except perhaps that the sky may fall on our heads tomorrow. But as we all know, tomorrow never comes!! -- Adventures of Asterix
"deliver" is working fine.
/usr/libexec/dovecot/deliver -d test@domain1 < testmail
creates the virtual mailbox. (uid,gid,mail,home through passwd sql)
Currently we have a virtualusertable
(FEATURE(virtusertable',
hash -o /etc/mail/virtusertable')dnl)
virtualusertable looks like:
user1@domain1 user1@hotmail.com
user2@domain1 user2@hotmail.com
@domain1 system-user
For the moment, an email sent to test@domain1 is forwarded to the system-user.
The system-user has a .procmail-config where he places the incomming mail into the correct virtual-mailbox.
Now we have replaced "local_procmail" with "deliver":
FEATURE(local_procmail',
/usr/libexec/dovecot/deliver',`deliver -d $u')
an email sent to test@domain1 is placed in the system-user's real-mailbox.
How to keep the external-forward-functionality of the virtualusertable and to be able to deliver into the virtual-mailbox?
Regards,
Natan
To: dovecot@dovecot.org From: andrzej.filip@gmail.com Date: Wed, 10 Jun 2009 19:19:21 +0200 Subject: Re: [Dovecot] Sendmail + Deliver as an LDA
Natan Vermeersch natanver@hotmail.com wrote:
Need help with setup/config.
Current situation: (dovecot version : 1.1.7)
we have system users and virtual users. (with different domains) Virtual users have procmail as LDA
Now we want "deliver" to become the LDA
I'm confused reading http://wiki.dovecot.org/LDA/Sendmail [...]
To use dovecot's deliver as sendmail's local mailer you need the following lines in your sendmail.mc:
FEATURE(
local_procmail',
/local/dovecot/libexec/dovecot/deliver',deliver -d $u') MODIFY_MAILER_FLAGS(
LOCAL', `-f')
Change path to dovecot's deliver to fit your installation.
The second line is needed only if your deliver does not support "-f envelope_sender" command line argument or if dovecot and sendmail do not "play well together" with "empty" (<>) envelope sender. I do not think it is required but http://wiki.dovecot.org/LDA/Sendmail mentions it for some (unexplained) reasons.
the above changes should not affect deliveries to virtual users [ unless you use *VERY* unusual sendmail configuration ]
P.S. Do you reject messages to non existing virtual users in reply to "RCPT TO:"?
-- [pl>en: Andrew] Andrzej Adam Filip : anfi@onet.eu Gauls! We have nothing to fear; except perhaps that the sky may fall on our heads tomorrow. But as we all know, tomorrow never comes!! -- Adventures of Asterix
Je hele online leven op één stek met Windows Live http://www.microsoft.com/belux/nl/windows/windowslive/default.aspx
"deliver" is working fine.
/usr/libexec/dovecot/deliver -d test@domain1 < testmail
creates the virtual-mailbox. (uid,gid,mail,home through passwd sql)
Currently we have a virtualusertable
(FEATURE(virtusertable',
hash -o /etc/mail/virtusertable')dnl)
virtualusertable looks like:
user1@domain1 user1@hotmail.com user2@domain1 user2@hotmail.com @domain1 system-user
For the moment, an email sent to test@domain1 is forwarded to the system-user. The system-user has a .procmail-config where he places the incomming mail into the correct virtual-mailbox.
Now we have replaced "local_procmail" with "deliver":
FEATURE(local_procmail',
/usr/libexec/dovecot/deliver',`deliver -d $u')
an email sent to test@domain1 is placed in the system-user's real-mailbox.
How to keep the external-forward-functionality of the virtualusertable and to be able to deliver into the virtual-mailbox?
Regards, Natan
To: dovecot@dovecot.org From: andrzej.filip@gmail.com Date: Wed, 10 Jun 2009 19:19:21 +0200 Subject: Re: [Dovecot] Sendmail + Deliver as an LDA
Natan Vermeersch natanver@hotmail.com wrote:
Need help with setup/config.
Current situation: (dovecot version : 1.1.7)
we have system users and virtual users. (with different domains) Virtual users have procmail as LDA
Now we want "deliver" to become the LDA
I'm confused reading http://wiki.dovecot.org/LDA/Sendmail [...]
To use dovecot's deliver as sendmail's local mailer you need the following lines in your sendmail.mc:
FEATURE(
local_procmail',
/local/dovecot/libexec/dovecot/deliver',deliver -d $u') MODIFY_MAILER_FLAGS(
LOCAL', `-f')
Change path to dovecot's deliver to fit your installation.
The second line is needed only if your deliver does not support "-f envelope_sender" command line argument or if dovecot and sendmail do not "play well together" with "empty" (<>) envelope sender. I do not think it is required but http://wiki.dovecot.org/LDA/Sendmail mentions it for some (unexplained) reasons.
the above changes should not affect deliveries to virtual users [ unless you use *VERY* unusual sendmail configuration ]
P.S. Do you reject messages to non existing virtual users in reply to "RCPT TO:"?
-- [pl>en: Andrew] Andrzej Adam Filip : anfi@onet.eu Gauls! We have nothing to fear; except perhaps that the sky may fall on our heads tomorrow. But as we all know, tomorrow never comes!! -- Adventures of Asterix
Je hele online leven op één stek? Ontdek Windows Live!
Reageer op foto’s van je vrienden en bekijk hun reacties op de jouwe. Gegarandeerd hilariteit! http://www.microsoft.com/belux/nl/windows/windowslive/products/photos.aspx
You just need to set system-user in you alias file to execute a program (procmail), this way it overrides the local delivery agent
----- Message from natanver@hotmail.com -----
"deliver" is working fine.
/usr/libexec/dovecot/deliver -d test@domain1 < testmail
creates the virtual-mailbox. (uid,gid,mail,home through passwd sql)
Currently we have a virtualusertable (FEATURE(
virtusertable',
hash -o /etc/mail/virtusertable')dnl)virtualusertable looks like:
user1@domain1 user1@hotmail.com user2@domain1 user2@hotmail.com @domain1 system-user
For the moment, an email sent to test@domain1 is forwarded to the
system-user. The system-user has a .procmail-config where he places the incomming
mail into the correct virtual-mailbox.Now we have replaced "local_procmail" with "deliver": FEATURE(
local_procmail',
/usr/libexec/dovecot/deliver',`deliver -d $u')an email sent to test@domain1 is placed in the system-user's real-mailbox.
How to keep the external-forward-functionality of the
virtualusertable and to be able to deliver into the virtual-mailbox?Regards, Natan
To: dovecot@dovecot.org From: andrzej.filip@gmail.com Date: Wed, 10 Jun 2009 19:19:21 +0200 Subject: Re: [Dovecot] Sendmail + Deliver as an LDA
Natan Vermeersch natanver@hotmail.com wrote:
Need help with setup/config.
Current situation: (dovecot version : 1.1.7)
we have system users and virtual users. (with different domains) Virtual users have procmail as LDA
Now we want "deliver" to become the LDA
I'm confused reading http://wiki.dovecot.org/LDA/Sendmail [...]
To use dovecot's deliver as sendmail's local mailer you need the following lines in your sendmail.mc:
FEATURE(
local_procmail',
/local/dovecot/libexec/dovecot/deliver',deliver -d $u') MODIFY_MAILER_FLAGS(
LOCAL', `-f')
Change path to dovecot's deliver to fit your installation.
The second line is needed only if your deliver does not support "-f envelope_sender" command line argument or if dovecot and sendmail do not "play well together" with "empty" (<>) envelope sender. I do not think it is required but http://wiki.dovecot.org/LDA/Sendmail mentions it for some (unexplained) reasons.
the above changes should not affect deliveries to virtual users [ unless you use *VERY* unusual sendmail configuration ]
P.S. Do you reject messages to non existing virtual users in reply to "RCPT TO:"?
-- [pl>en: Andrew] Andrzej Adam Filip : anfi@onet.eu Gauls! We have nothing to fear; except perhaps that the sky may fall on our heads tomorrow. But as we all know, tomorrow never comes!! -- Adventures of Asterix
Je hele online leven op één stek? Ontdek Windows Live!
Reageer op foto´s van je vrienden en bekijk hun reacties op de jouwe. Gegarandeerd hilariteit! http://www.microsoft.com/belux/nl/windows/windowslive/products/photos.aspx
You just need to set system-user in you alias file to execute a program (procmail), this way it overrides the local delivery agent
----- Message from natanver@hotmail.com -----
"deliver" is working fine.
/usr/libexec/dovecot/deliver -d test@domain1 < testmail
creates the virtual-mailbox. (uid,gid,mail,home through passwd sql)
Currently we have a virtualusertable (FEATURE(
virtusertable',
hash -o /etc/mail/virtusertable')dnl)virtualusertable looks like:
user1@domain1 user1@hotmail.com user2@domain1 user2@hotmail.com @domain1 system-user
For the moment, an email sent to test@domain1 is forwarded to the
system-user. The system-user has a .procmail-config where he places the incomming
mail into the correct virtual-mailbox.Now we have replaced "local_procmail" with "deliver": FEATURE(
local_procmail',
/usr/libexec/dovecot/deliver',`deliver -d $u')an email sent to test@domain1 is placed in the system-user's real-mailbox.
How to keep the external-forward-functionality of the
virtualusertable and to be able to deliver into the virtual-mailbox?Regards, Natan
To: dovecot@dovecot.org From: andrzej.filip@gmail.com Date: Wed, 10 Jun 2009 19:19:21 +0200 Subject: Re: [Dovecot] Sendmail + Deliver as an LDA
Natan Vermeersch natanver@hotmail.com wrote:
Need help with setup/config.
Current situation: (dovecot version : 1.1.7)
we have system users and virtual users. (with different domains) Virtual users have procmail as LDA
Now we want "deliver" to become the LDA
I'm confused reading http://wiki.dovecot.org/LDA/Sendmail [...]
To use dovecot's deliver as sendmail's local mailer you need the following lines in your sendmail.mc:
FEATURE(
local_procmail',
/local/dovecot/libexec/dovecot/deliver',deliver -d $u') MODIFY_MAILER_FLAGS(
LOCAL', `-f')
Change path to dovecot's deliver to fit your installation.
The second line is needed only if your deliver does not support "-f envelope_sender" command line argument or if dovecot and sendmail do not "play well together" with "empty" (<>) envelope sender. I do not think it is required but http://wiki.dovecot.org/LDA/Sendmail mentions it for some (unexplained) reasons.
the above changes should not affect deliveries to virtual users [ unless you use *VERY* unusual sendmail configuration ]
P.S. Do you reject messages to non existing virtual users in reply to "RCPT TO:"?
-- [pl>en: Andrew] Andrzej Adam Filip : anfi@onet.eu Gauls! We have nothing to fear; except perhaps that the sky may fall on our heads tomorrow. But as we all know, tomorrow never comes!! -- Adventures of Asterix
Je hele online leven op één stek? Ontdek Windows Live!
Reageer op foto´s van je vrienden en bekijk hun reacties op de jouwe. Gegarandeerd hilariteit! http://www.microsoft.com/belux/nl/windows/windowslive/products/photos.aspx
Natan Vermeersch natanver@hotmail.com wrote:
"deliver" is working fine.
/usr/libexec/dovecot/deliver -d test@domain1 < testmail
creates the virtual-mailbox. (uid,gid,mail,home through passwd sql)
Currently we have a virtualusertable (FEATURE(
virtusertable',
hash -o /etc/mail/virtusertable')dnl)
SOT: do not use -o flag above. It makes sendmail start "happily" even when virtusertable is inaccessible.
virtualusertable looks like:
user1@domain1 user1@hotmail.com user2@domain1 user2@hotmail.com @domain1 system-user
For the moment, an email sent to test@domain1 is forwarded to the system-user. The system-user has a .procmail-config where he places the incomming mail into the correct virtual-mailbox.
Now we have replaced "local_procmail" with "deliver": FEATURE(
local_procmail',
/usr/libexec/dovecot/deliver',`deliver -d $u')an email sent to test@domain1 is placed in the system-user's real-mailbox.
How to keep the external-forward-functionality of the virtualusertable and to be able to deliver into the virtual-mailbox?
Which of sendmail.cf based solutions below do you prefer? a) "cleaner" but requiring small patch of *.m4 files used to generate sendmail.cf [ would require repeating patching after every sendmail upgrade ] b) "messy" with many related entries in different maps but without patching
P.S. Some question that may help to choose the best recipe:
- How many virtual mailboxes do you support?
- Do you keep dovecot's userdb in plain text file?
-- [pl>en: Andrew] Andrzej Adam Filip : anfi@onet.eu 'Scuse me, while I kiss the sky! -- Robert James Marshall (Jimi) Hendrix
Some question that may help to choose the best recipe:
- How many virtual mailboxes do you support? for the moment only 40
(that's because our users don't like procmail -> too complicated - hence the reason for switching to "deliver")
- Do you keep dovecot's userdb in plain text file?
dovecot is looking-up the system users (plain text)
userdb passwd {}
and a lookup in mysql database
userdb sql {args = /etc/dovecot-sql.conf }
Which of sendmail.cf based solutions below do you prefer?
don't know. For the moment I prefer a "working" solution ;-)
a) "cleaner" but requiring small patch of *.m4 files used to generate sendmail.cf [ would require repeating patching after every sendmail upgrade ] b) "messy" with many related entries in different maps but without patching
Can you describe your prefered ("messy" or "cleaner") way to go ?
thx !
Voeg vrienden toe van LinkedIn & Facebook aan je Windows Live http://profile.live.com/connect
Recipe for delivery to virtual dovecot domains via procmail scripts
- sendmail.mc lines [recompile it to sendmail.cf]
FEATURE(mailertable') FEATURE(
virtusertable')
MAILER(`procmail')
LOCAL_CONFIG
dnl File to keep non local domains processed via virtusertable
F{VirtHost}/etc/mail/virtual-domains
- mailertable lines [recompile it with makemap program]
deliver messages to example.net domain via procmail script
# /etc/procmailrcs/example.net.rc # procmail treats scripts in /etc/procmailrcs in special way # if executed as root changes uid to uid of the script file owner example.net procmail:/etc/procmailrcs/example.net.rc
- access (database/file) lines [recompile it with makemap program]
accept messages addressesed to example.net from anywhere
to:example.net RELAY
- /etc/mail/virtual-domains file
example.net
- Check that example.net *IS NOT* listed on list on local email domains
echo '$=w' | sendmail -bt
If it is then 5a) disable auto-detection of local email domains http://www.sendmail.org/m4/tweaking_config.html#confDONT_PROBE_INTERFACES 5b) add local domains missing after turning off auto-detection manually [as mentioned in http://www.sendmail.org/faq/section4#4.5 ]
As I wrote it is a little bit messy and requires many different entries for single virtual domain but no patching of *.m4 files is required.
P.S. *IF* you add the line below to sendmail.mc define(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_') *THEN* you can list existing dovecot virtual users in virtusertable and reject remaining addresses
user1@example.net %0 user2@example.net %0 @example.net error:nouser User Unknown
-- [pl>en: Andrew] Andrzej Adam Filip : anfi@onet.eu You can't play your friends like marks, kid. -- Henry Gondorf, "The Sting"
Is there also a recipe for delivery to virtual dovecot domains via "deliver" ?
what I would like to achieve:
user1@example.net -> forwarded to user1@hotmail.com
user2@example.net -> delivered to local mailbox (a virtual dovecot mailbox)
for the first one you need FEATURE(`virtusertable')
for the second one you need FEATURE(`mailertable')
To: dovecot@dovecot.org From: andrzej.filip@gmail.com Date: Thu, 11 Jun 2009 19:36:33 +0200 CC: natanver@hotmail.com Subject: Re: [Dovecot] Sendmail + Deliver for virtual domains via /etc/procmailrcs scripts
Recipe for delivery to virtual dovecot domains via procmail scripts
- sendmail.mc lines [recompile it to sendmail.cf]
FEATURE(
mailertable') FEATURE(
virtusertable') MAILER(`procmail') LOCAL_CONFIG dnl File to keep non local domains processed via virtusertable F{VirtHost}/etc/mail/virtual-domains
- mailertable lines [recompile it with makemap program]
deliver messages to example.net domain via procmail script
# /etc/procmailrcs/example.net.rc # procmail treats scripts in /etc/procmailrcs in special way # if executed as root changes uid to uid of the script file owner example.net procmail:/etc/procmailrcs/example.net.rc
- access (database/file) lines [recompile it with makemap program]
accept messages addressesed to example.net from anywhere
to:example.net RELAY
- /etc/mail/virtual-domains file
example.net
- Check that example.net *IS NOT* listed on list on local email domains
echo '$=w' | sendmail -bt
If it is then 5a) disable auto-detection of local email domains http://www.sendmail.org/m4/tweaking_config.html#confDONT_PROBE_INTERFACES 5b) add local domains missing after turning off auto-detection manually [as mentioned in http://www.sendmail.org/faq/section4#4.5 ]
As I wrote it is a little bit messy and requires many different entries for single virtual domain but no patching of *.m4 files is required.
P.S. *IF* you add the line below to sendmail.mc define(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_') *THEN* you can list existing dovecot virtual users in virtusertable and reject remaining addresses
user1@example.net %0 user2@example.net %0 @example.net error:nouser User Unknown
-- [pl>en: Andrew] Andrzej Adam Filip : anfi@onet.eu You can't play your friends like marks, kid. -- Henry Gondorf, "The Sting"
Reageer op foto’s van je vrienden en bekijk hun reacties op de jouwe. Gegarandeerd hilariteit! http://www.microsoft.com/belux/nl/windows/windowslive/products/photos.aspx
participants (3)
-
Andrzej Adam Filip
-
Natan Vermeersch
-
Patrick Domack