develooper Front page | perl.qpsmtpd | Postings from March 2006

Re: dnsbl or spamhaus occassionally blocks wrong IP

Thread Previous | Thread Next
Peter J. Holzer
March 14, 2006 14:50
Re: dnsbl or spamhaus occassionally blocks wrong IP
Message ID:
On 2006-03-14 14:17:14 -0800, Elliot Foster wrote:
> John Peacock wrote:
> >Peter J. Holzer wrote:
> >>2) Net::DNS assigns a random id when the package is loaded and just
> >>   increments the id for each request. This also makes ID guessing easy.
> >>   What's worse, with forkserver the package is loaded in the parent
> >>   process, so every child goes through the same sequence of IDs!
> >
> >This is more of a problem, since we are actively urging people to use 
> >forkserver.  Can we use eval "use Net::DNS" after we fork to prevent 
> >this from happening?  Can we poke a new ID value manually for each 
> >fork instance?
> There is code in trunk to deal with this specific issue, around line 124 
> of ~/qpsmtpd, where the _fork subroutine is defined.

You are right. But I don't understand it:

    # cope with different versions of Net::DNS
    eval {
        $Net::DNS::Resolver::global{id} = 1;
        $Net::DNS::Resolver::global{id} = int(rand(Net::DNS::Resolver::MAX_ID()));
        # print "Next DNS ID: $Net::DNS::Resolver::global{id}\n";
    if ($@) {
        # print "Next DNS ID: " . Net::DNS::Header::nextid() . "\n";

which version of Net::DNS has a variable %Net::DNS::Resolver::global?
Neither 0.48 nor 0.57 seem to have it. Is this for some old version or a
new one which hasn't been released yet?

the ($@) branch doesn't do anything.


   _  | Peter J. Holzer    | Ich sehe nun ein, dass Computer wenig
|_|_) | Sysadmin WSR       | geeignet sind, um sich was zu merken.
| |   |         |
__/   | |	-- Holger Lembke in dan-am

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About