Rian Hunter wrote:
On Jul 19, 2005, at 6:51 AM, Nick Kew wrote:
the problem i found when i did my poc is when there is in the command,
different destination email. It's difficult here to keep the
virtualHost
scheme.
It would be nice to keep a conf file like
<virtualHost>
ServerName mail.bla.com
SmtpUserMap mail.bla.com-user.map
or SmtpRelay host
....
</virtualHost>
Yes. I think there is a logical difficulty here. smtpd_create_request
is run before process_smtp_connection_internal, and the design doesn't
allow for multiple recipients to be processed differently.
My own feeling was that multiple recipients require a request each.
Maybe we could get that in your design by creating a subrequest
for each RCPT TO?
This is possible but I'm not sure what the advantage is. Would you
mind setting up a hypothetical situation where this is necessary? I
figure that ultimately the handler will be responsible for dealing
with each rcpt to differently.
Early on I wanted configuration possibility similar to:
#########
Listen 21
<VirtualHost *:21>
# mod_smtpd conf
SmtpProtocol On
SetHandler unix-module
# mod_smtpd_unix
AcceptDomains thelaststop.net www.thelaststop.net
Relay On
# mod_smtpd_easyfilter
<Filter>
# matches against email in MAIL TO: smtp command
RegexMailTo "/thelaststop.net$/"
SetHandler maildir-module
# mod_smtpd_maildir conf
MaildirBase "/usr/local/virtual"
MailboxLimit 50M
</Filter>
# Simple spam filter using mod_smtpd_easyfilter
# Default handler does nothing with mail message
<Filter>
RegexHeader "Subject" "/cialis/"
SetHandler none
</Filter>
</VirtualHost>
##########
imho, your conf is too complex.
first, it would be good to create some <VirtualDomain bla.org> or
<VirtualDomain *>
and in each tag, put some process and filter setup.
<VirtualDomain apache.org>
ServerAlias prc.apache.org apr.apache.org
SmtpUser pam (or ldap or mysql etc like auth in httpd)
SmtpSpool /var/spool/mail (directive from mod smtp core)
or
SmtpRelay 1.2.3.4
SmtpRelay 1.3.4.5 (With something
(then here directive for other smtp modules
</VirtualDomain>
if we consider the SmtpUser as a function hooked in something created
specialy, like ap_hook_smtp_user, we run this function to find the user
inside the local/ldap/pam or whatever choosen. maybe a user profile
provider.
We could also have a hook for register new command, like we could
register new method in http.
it could be:
command 1 -> processed by function for this command
command 2 -> processed by function for this command
rcpt to: [EMAIL PROTECTED] -> get_domain then get_user(domain) then register
user and action to do (maybe in a array) (SmtpSpool or SmtpRelay
function, maybe a ap_hook_smtp_action)
....
command y -> processed by function for this command
end command
DATA
Here we execute actions (registered with users and domain before, as
filter or as hook)
user 1 -> Relay -> execute relay
user 2 -> Local Delivery -> put mail inside Spool
user 3 -> Relay etc...
imho, delivering, relaying etc could be done sequentialy
Maybe we could have inside the user array, something ordered per vdomain
coz they have the same action.
if [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
We could directly relay user1 and user3 in the same action and local
deliver for user inside domain-local.
Cheers,
Matthieu
In the case of this httpd.conf embedded filtering mechanism, I
figured the handlers could be changed based on the certain RegExs
right before ap_run_handler() was called. Maybe ap_run_fixups() could
be called, and my hypothetical mod_smtpd_easyfilter would have a
fixups hook where it accomplished something similar to this
situation. Although after thinking about it I realize now that
mod_smtpd_easyfilter couldn't set different handlers for different
rcpt tos. Is this what you meant?
I think this requires some more thought considering different smtp
connections and server requirements. The main drawback to sub-
requesting each rcpt to is that we have two different handlers trying
to read data from the socket. Is this problem solved by spooling the
data, and letting the two separate requests read from the spool bucket?
-rian