Author: Richard.Hall Date: To: exim-users Subject: [exim] Easiest way to handle a specific domain literal address?
Having gone round in ever-decreasing circles with this one, I hope someone
can point me in the right (or at least, the simplest) direction.
I preface this by saying that the server in question is using Exim 4.43,
with *no* hope of a quick upgrade to pick up any new facilities which
might have solved my problem. I now throw myself on the mercy of the list
...
I am trying to deal with a dumb device whose idea of an SMTP conversation
is to chuck the following data at me and then run away:-
HELO 192.168.1.1
MAIL FROM: xyz@???
RCPT TO: me@???
DATA
From: xyz@???
To: me@???
Subject: A Message From 192.168.1.1
message data
.
QUIT
I've already dealt with its propensity to play Knock Down Ginger by use of
control = no_enforce_sync. I'm now trying to deal with the domain literal
addresses. I tried enabling allow_domain_literals, but the changes
required start proliferating, so I backed off. (Although one day I
half-intend to allow postmaster@[my.ip.ad.dr], so I might have to bite
that bullet anyway)
The simplest solution I've come up with so far is an SMTP-time rewrite:-
\N^(.*)@\[192\.168\.1\.1\]$\N $1@??? S
which takes care of the MAIL FROM command. Ignoring the broken HELO is
pretty straightforward. And frankly I'm not too bothered if I can't deal
with the From: header. Job done.
Or maybe not?
- the rewrite seemed to be tried on both the envelope addresses, not just
the sender. Is that the case, or did I misinterpret the voluminous
debugging? If it is the case, is there any way to restrict it to just one
or the other?
- am I opening up a security hole? Section 31.11 "Rewriting examples" of
the (4.63) spec initially got me worried, but I'm now thinking that there
is no real difference between forging one of my IP addresses and forging
one of my host names?
- it is likely that I am going to be dealing with more of these devices in
the future. I don't want to have a separate rewrite rule for each such IP
address (or turn the one above into something unreadable with multiple
alternatives in the regex), so what would be the best and/or simplest way
to generalise what I've got? I'm thinking some sort of lookup, but my
brain faded at that point ...
- when I was experimenting with domain literals, I found myself with a
hostlist in one hand, but needing a domain list in the other, eg to have a
router with
domains = +dumb_device_hostlist
(and I know that doesn't make sense, not least because it would need some
brackets [] sprinkled on it) Is there any easy way of converting between
the two, or should I be looking at a lookup again ?
Finally, slightly off at a tangent, ...
Section 8 of the spec says that Exim (normally) recognises regular
expressions by prefixing them with '^', eg ^\\d{3} - is this an anchored
regex, or would I have to write ^^\\d{3} to anchor it?