Yves-Eric wrote:
> require 'resolv'
> domain = "i-dont-exist-iutjdfuyoxfugy.com"
> Resolv::DNS.open { |dns| dns.getresources(domain,
> Resolv::DNS::Resource::IN::MX)}
> 
> On my development machine, this returns an empty list, as expected
> (the domain does not exist, it cannot have an MX record!).
> However, in my production environment, the same code returns:
> => [#<Resolv::DNS::Resource::IN::MX:0xb7cde342
> @exchange=#<Resolv::DNS::Name: mydomain.com.>, @preference=10>]
> 
> It returns the production machine itself as a valid MX for a domain
> that does not exist!
> 
> I double-checked on the command line that "nslookup -q=mx i-dont-exist-
> iutjdfuyoxfugy.com" indeed returns NXDOMAIN...

Also try "dig i-dont-exist-iutjdfuyoxfugy.com mx" - dig is a bit 
lower-level than nslookup.

If you still see the difference between Ruby and dig, then I suggest you 
run tcpdump (on both your loopback interface and your external 
interface) for udp port 53.

I suspect this will show something different in the queries, e.g. they 
are being sent to different nameservers. Perhaps there is a wildcard MX 
record floating around.

Regards,

Brian.
-- 
Posted via http://www.ruby-forum.com/.