如何配置sendmail ldap路由以在使用mailRoutingAddress时为最终收件人执行mailHost查找

时间:2015-08-27 18:48:40

标签: ldap sendmail

我使用sendmail / openldap在地理位置分散的群集中传递邮件。这在很大程度上是有效的,但我遇到邮件转发问题。

当我为同一域内的用户设置LDAP mailRoutingAddress时,sendmail不会获取最终收件人的mailHost,而是执行本地传递。我意识到这是预期的行为,但我需要找到一种方法让sendmail在为mailRoutingAddress(ldapmra)完成map_rewrite之后为新收件人执行LDAP mailHost查找(ldapmh)。

我希望某人有一些严肃的sendmail-fu,可以建议一种方法,可以修改sendmail规则以注入LDAP mailHost查找(请参阅解析器输出中的## COMMENT)。

典型的LDAP条目可能如下所示:

dn: uid=allan, dc=my, dc=example
mailLocalAddress: allan@my.example
mailRoutingAddress: babs@my.example

dn: uid=babs, dc=my, dc=example
mailLocalAddress: babs@my.example
mailHost: east.my.example

dn: uid=chuck, dc=my, dc=example
mailLocalAddress: chuck@my.example
mailHost: west.my.example

dn: uid=diane, dc=my, dc=example
mailLocalAddress: diane@my.example
mailRoutingAddress: someuser@freemail.example

以下是解析器输出示例

   mailgw# sendmail -d -bt
Version 8.14.7

###debug output redacted

============ SYSTEM IDENTITY (after readcf) ============
      (short domain name) $w = mailgw
  (canonical domain name) $j = mailgw.my.example
         (subdomain name) $m = my.example
              (node name) $k = mailgw.my.example
========================================================

ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> /parse allan@my.example
crackaddr(allan@my.example)
crackaddr=>` 0x81 g'
Cracked address =  0x81 g
Parsing envelope recipient address

--parseaddr(allan@my.example)
canonify           input: allan @ my . example
Canonify2          input: allan < @ my . example >
map_lookup(host, my.example) => host_map_lookup(my.example) => map_rewrite(my.example), av =
    my.example
map_rewrite => my.example.
FOUND my.example
my.example. (0)
Canonify2        returns: allan < @ my . example . >
canonify         returns: allan < @ my . example . >
parse              input: allan < @ my . example . >
Parse0             input: allan < @ my . example . >
map_lookup(dequote, allan) => NOT FOUND (0)
Parse0           returns: allan < @ my . example . >
ParseLocal         input: allan < @ my . example . >
ParseLocal       returns: allan < @ my . example . >
Parse1             input: allan < @ my . example . >
LDAPExpand         input: < allan < @ my . example . > > < allan @ my . example > < >
map_lookup(ldapmra, allan@my.example) => map_rewrite(babs@my.example), av =
    allan@my.example
map_rewrite => babs@my.example
babs@my.example (0)
map_lookup(ldapmh, allan@my.example) => NOT FOUND (68)
canonify           input: babs @ my . example
Canonify2          input: babs < @ my . example >
map_lookup(host, my.example) => host_map_lookup(my.example) => CACHE my.example
#### COMMENT: This is where I need to dip LDAP
map_rewrite(my.example), av =
    my.example
map_rewrite => my.example.
my.example. (0)
Canonify2        returns: babs < @ my . example . >
canonify         returns: babs < @ my . example . >
Parse0             input: babs < @ my . example . >
map_lookup(dequote, babs) => NOT FOUND (0)
Parse0           returns: babs < @ my . example . >
LDAPExpand       returns: babs < @ my . example . >
map_lookup(virtuser, babs@my.example) => map_rewrite(babs), av =
    babs@my.example
    babs
map_rewrite => babs
babs (0)
Recurse            input: babs
canonify           input: babs
Canonify2          input: babs
Canonify2        returns: babs
canonify         returns: babs
parse              input: babs
Parse0             input: babs
map_lookup(dequote, babs) => NOT FOUND (0)
Parse0           returns: babs
ParseLocal         input: babs
ParseLocal       returns: babs
Parse1             input: babs
Parse1           returns:  0x96  local  0x98  babs
parse            returns:  0x96  local  0x98  babs
Recurse          returns:  0x96  local  0x98  babs
Parse1           returns:  0x96  local  0x98  babs
parse            returns:  0x96  local  0x98  babs
2                  input: babs
2                returns: babs
EnvToL             input: babs
EnvToL           returns: babs
final              input: babs
final            returns: babs
parseaddr-->0xbfbfd8c0=allan@my.example:
    mailer 8 (local), host `'
    user `babs', ruser `<null>'
    state=OK, next=0x0, alias 0x0, uid 0, gid 0
    flags=180<QPINGONFAILURE,QPINGONDELAY>
    owner=(none), home="(none)", fullname="(none)"
    orcpt="(none)", statmta=(none), status=(none)
    finalrcpt="(none)"
    rstatus="(none)"
    statdate=(none)
mailer local, user babs

0 个答案:

没有答案