Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] Submitter DNS name resolution and forgery detection

2013-08-08 by Jim Klimov

Hello all,
   As a follow-up on the recent post about un-bracketing unresolved names,
I'd like to submit a rework of that code and a new patch for review.
* milter-greylist-4.4.3-resolveBrackets.patch

This updated patch moves the code to construct an ip-addr.arpa
name for DNS PTR lookups from a provided IP address string into
a separate function (not published into headers at the moment).

The routine uses a caller-provided buffer to store the resulting
string, so I hope this is thread-safe the way I understand it
(not much, really). Review and constructive criticism welcome ;)

Beside keeping the code cleaner, this separation is intended to
help if a DNS forgery/mismatch routine (keyword?) were to be
implemented. I am not sure I'll get around to coding it, though.
Also note that the code was not yet really tested with "clear"
IP address strings (with only dotted-quads without brackets),
though it should work.

I thought about also moving the DNS lookup into a function, but
it is relatively compact, and with parsing of output structure -
pretty unique anyway (forgery detection would be different).

The updated patch also includes keywords unbracket and nounbracket
to enable or disable this functionality via config-file. The default
is to do resolutions of bad names, and "nounbracket" can be used by
customers with bad DNS resolvers to achieve legacy behaviour as it
works (or doesn't) today. If it is deemed that legacy should be
default for backwards compatibility, the default value can be set
in code, and the other flag variable is available and tested to
enable these name resolutions :)

Man page also updated; default config samples, readmes, etc. - no.
BTW, I believe this is a very old timestamp in the manpage file:
.TH "greylist.conf" "5" "May 10, 2005" "" ""


* milter-greylist-4.4.3-override-packaging-strings.patch

This allows a package maintainer to override the package email and
url contacts, the name and version, add a version suffix and build
a new name+version+suffix string. Also this adds output of these
values into help/error-help text so that the version can be easily
reviewed (i.e. a locally maintained build number can go into this,
or a date-time-stamp, to identify the resulting binaries; or really
for distro-maintenance).

Probably the most popular override for private distros would be
   --with-package-version-suffix="-MyOrg"
which would be appended to PACKAGE_VERSION and PACKAGE_STRING based
on current release's "upstream" version.

Tested to compile, work, and also influence the RPM spec-file.


* milter-greylist-4.4.3-jimbuild-Makefile.patch

This is basically what I posted around the 4.4.2 timeframe - the
improved Makefile.in which makes possible to build this package
over NFS using parallel and sequential builds for different steps.
Since over the past months there are no reports of this slightly
complicated logic breaking anyone's builds, and there is at least
my report that it allows to build the project at least on my farm,
I think it may be added to the dev-branch of code, and sometime
in the future might even make it into releases ;)



** I also use the patch to fix the chown errors for inet sockets,
but it is not mine and IIRC it was added to current trunk...


PS: Also, I've previously posted a patch to use the client_addr
macro instead of if_addr if the former is not available; maybe
called milter-greylist-4.4.3-augment-if_addr-by-client_addr.diff
I now believe that given the macros' different content and purpose,
that patch would be misleading and should not be included.
Absent input is absent, after all; it should not be replaced by
an arbitrary string just because we have it - even if this is
only used for cosmetic outputs right now ;)

HTH,
//Jim Klimov

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.