OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Postfix Archives: feature comments

feature comments


Subject: feature comments
From: Alex Samonte (asamontePrison.NET)
Date: Mon Jan 10 2000 - 17:55:20 CST


I've been meaning to do a patch for postfix to accomplish some
things that I had implemented on a sendmail + ldap based combo about 2 years
back.

I'm looking to answer a few questions:

1) Is there already a way to do this that I haven't considered?
2) If not, would it be a useful feature for the general populace
3) If so would my patch be the 'right way' (in accordance with some of the
    postfix design goals) to accomplish this?

The scenario is a postfix + ldap combination.
The goal is to do specific types of LDAP lookups based upon a prefix or
suffix to the username.

Right now there is already ways to specify different types of ldap lookups
but the only way to really do them is serially. As the number of different
lookups I want to do increases so does the amount of lookups which I would like
to minimize.

Currently all email addresses are rewritten via ldap using alias_maps with
a ldap:map type specified.

basic goal of usernameourdomain.com is rewritten to
usernamelocalmailserver.ourdomain.com via the alias_maps by looking up
the mailacceptinggeneralid, and replacing it with the maildrop attribute

I'd like to add something that looks for page-* and looks up the match
with the mailacceptinggeneralid: attribte and replaces it with a
emailpager: attribute.

so page-asamonteourdomain.com would lookup asamonteourdomain.com in
the mailacceptinggeneralid: field and replace it with
12345skytel.com,asamonteourdomain.com

This way I could give users editable control over the emailpager: field
without letting them go crazy on mailacceptinggeneralid: (which leads to stupid
aliases such as iamcoolourdomain.com etc).

A possible suggestion could be to just add page-usernameourdomain.com
and usernameourdomain.com to mailacceptinggeneralid:
and then have the alias_maps do ldap:ldap-pagerlookup, ldap:ldap-defaultlookup

That works without too much overhead in this case where there is just one
lookup I want to do, but as that number increases, so does the overhead.

Plus I already have a bunch of existing tools which are already set up
to work with the layout when I was using sendmail + ldap. Things for
administration, a LDAP using mailing list manager...though I think we're going
to LDAPify gnu mailmain...it's a nice program.

I could also do something like a regexp canonical_map which would
map page-usernameourdomain.com to usernamepage.ourdomain.com and then
have a transport map for page.ourdomain.com which goes to some
external delivery agent that does the appropriate ldap lookup and delivery.
This would actually be nearly identical to the sendmail solution I had
a while ago. But I would like to do it all within postfix, and be able to
deal with things other than pagers.

What I think could do the trick would be something like this

a regexp canonical_map that had the LHS that matched the prefix I was
looking for, and a RHS which was a ldap:map. The ldap:map would use
the $1 match for the regexp for its %s.

It would look something like:

main.cf:
canonical_maps = regexp:/etc/postfix/canonical_regexp
page-ldap_query_filter = (mailacceptinggeneralid=%s)
page-ldap_result_attribute = emailpager
owner-ldap_query_filter = (mailacceptinggeneralid=%s)
owner-ldap_result_attribute = mmowner
archive-ldap_query_filter = (mailacceptinggeneralid=%s)
archive-ldap_result_attribute = mmarchive
request-ldap_query_filter = (mailacceptinggeneralid=%s)
request-ldap_result_attribute = mmrequest

canonical_regexp:
/^page-(.*)/ ldap:page-ldap
/^owner-(.*)/ ldap:owner-ldap
/^archive-(.*)/ ldap:archive-ldap
/^request-(.*)/ ldap:request-ldap

So back to the original 3 questions:
1) Is there already a way to do this that I haven't considered?

There may be, but I have a few requirements which make this seem like
the way that would work for me. But if anyone else has any suggestions
let me know

2) If not, would it be a useful feature for the general populace
I could just be coding this by myself for myself, but if this functionality
is useful id like to make sure it wasn't just some kludge.

3) If so would my patch be the 'right way' (in accordance with some of the
    postfix design goals) to accomplish this?

This I think is the more important question. Would having a map type (not
just ldap) on the RHS of a mapping table be a good thing? Should it be
that way for all of them (canonical, alias, virtual, transport)?

-Alex



This archive was generated by hypermail 2b27 : Mon Jan 10 2000 - 22:32:14 CST