httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Estrade <>
Subject Re: Initial mod_smtpd code.
Date Wed, 20 Jul 2005 19:57:04 GMT
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
>>>     SmtpUserMap
>>>     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
>     Relay On
>     # mod_smtpd_easyfilter
>     <Filter>
>         # matches against email in MAIL TO: smtp command
>         RegexMailTo "/$/"
>         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> or 
<VirtualDomain *>
and in each tag, put some process and filter setup.


SmtpUser pam (or ldap or mysql etc like auth in httpd)
SmtpSpool /var/spool/mail (directive from mod smtp core)
SmtpRelay (With something

(then here directive for other smtp modules


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 
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: -> 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


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 user1@domain-local user2@domain-to-relay user3@domain-relay
We could directly relay user1 and user3 in the same action and local 
deliver for user inside domain-local.



> 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

View raw message