Re: [exim] SMTP-time rewriting

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Nikita Koshikov
Ημερομηνία:  
Προς: John Jetmore
Υ/ο: exim-users
Αντικείμενο: Re: [exim] SMTP-time rewriting
On Mon, 21 Jun 2010 21:39:20 -0400
John Jetmore wrote:

> On Mon, Jun 21, 2010 at 7:38 AM, Nikita Koshikov <koshikov@???> wrote:
> > Hello exim experts,
> >
> > I need exim to rewrite addresses like: <user@domain*admin> to the form <user@domain>.
> >
> > Here is the rule I made for this:
> >
> > \N^(.*)\*admin(.*)?$\N          $1$2 S
> >
> > This is working on smtp-time MAIL FROM stage as I needed, but headers doesn't touched by it.
> > Adding one more rule without S flag didn't help and body headers From, Sender, etc list unrewritten data.
> >
> > What's wrong and how can I fix this ?
>
> See chapter 31 on rewriting in the doc at
> http://www.exim.org/exim-html-current/doc/html/spec_html/ch31.html.
> Specifically 31.7, 31.8, and 31.9, which deals with rewriting flags.
> I suspect that in addition to "S" you'll want "h" for "rewrite all
> headers". These flags all go on the same rule-line, so it would look
> something like this (I think, I didn't actually test this):
>
> \N^(.*)\*admin(.*)?$\N          $1$2 Sh
>

The problem that - it doesn't work. I have tried various combination of flags, RhFfs etc, but headers in body never touched by rewrite.

> FWIW I think that rule will match more than you expect it to if your
> example is accurate. But that's a different question which you didn't
> ask yet...
>


Yes, the rule is a bit overabundant, but I think this is not the problem of broken rewrite behavior.

Now I have 2 rules:

\N^(.*)\*admin(.*)?$\N          $1$2 ShR
\N^(.*)\*admin(.*)?$\N          $1$2 h


Result:

root@mail test 0:0 # exim -C /etc/exim/test/exim.conf -d+rewrite  -brw '<user@???*admin>'
Exim version 4.72 uid=0 gid=0 pid=17662 D=fbb95cfd
Berkeley DB: Berkeley DB 4.7.25: (2010-06-10)
Support for: crypteq iconv() PAM Perl TCPwrappers OpenSSL Content_Scanning DKIM Old_Demime Experimental_SPF Experimental_SRS
Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch ldap ldapdn ldapm passwd sqlite
Authenticators: cram_md5 dovecot plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore autoreply pipe smtp
Fixed never_users: 0
Size of off_t: 4
OpenSSL compile-time version: OpenSSL 0.9.8o 01 Jun 2010
OpenSSL runtime version: OpenSSL 0.9.8o 01 Jun 2010
changed uid/gid: forcing real = effective
  uid=0 gid=0 pid=17662
  auxiliary group list: <none>
seeking password data for user "root": cache not available
getpwnam() succeeded uid=0 gid=0
seeking password data for user "nut": cache not available
getpwnam() succeeded uid=84 gid=84
configuration file is /etc/exim/test/exim.conf
log selectors = 00009ffe 0023940d
Starting Perl interpreter
cwd=/etc/exim/test 6 args: exim -C /etc/exim/test/exim.conf -d+rewrite -brw <user@???*admin>
trusted user
admin user
changed uid/gid: privilege not needed
  uid=8 gid=12 pid=17662
  auxiliary group list: 12
seeking password data for user "mailman": cache not available
getpwnam() succeeded uid=280 gid=280
originator: uid=0 gid=0 login=root name=root
LOG: address_rewrite MAIN
  "<user@???*admin>" from smtp sender rewritten as "<user@???>" by rule 1
    SMTP: user@???
search_tidyup called

>>>>>>>>>>>>>>>> Exim pid=17662 terminating with rc=0 >>>>>>>>>>>>>>>>