DevHeads.net

Centos 7 specific cure for Spamassassin DNS lookup problem

I have the following error message in my /var/log/spamd

spf: lookup failed: available_nameservers: No DNS servers available!

Having Googled the error message I've found a number of responses which
involve patching Perl or Spamassassin or other cures.

Before I start changing things I was wondering if there was a Centos 7
specific resolution. Where possible, on production machines I prefer to stay
with RPM's rather than amending software directly.

Also, many of these responses are over 10 years old, so I'm a little sceptical
about their success today.

Gary

Comments

Re: Centos 7 specific cure for Spamassassin DNS lookup

By Gordon Messmer at 08/10/2017 - 12:45

On 08/10/2017 01:21 AM, Gary Stainburn wrote:

Try starting spamassassin later. Run "systemctl edit
spamassassin.service" and insert two lines:

[Unit]
After=network-online.target

Re: Centos 7 specific cure for Spamassassin DNS lookup

By Gary Stainburn at 08/14/2017 - 03:38

On Thursday 10 August 2017 18:45:32 Gordon Messmer wrote:

I will add the code, although updating RPM contents is one of the things I was
trying to avoid. Having said that, I have restarted the service after bootup
has completed and this does not fix the problem.

Re: Centos 7 specific cure for Spamassassin DNS lookup

By Gordon Messmer at 08/14/2017 - 10:51

On 08/14/2017 01:38 AM, Gary Stainburn wrote:
"systemctl edit" creates a "drop-in" that overrides a portion of the
vendor-provided file. It exists specifically to avoid editing
rpm-provided files.

Well, that error can also be caused by Net::DNS being unable to parse
/etc/resolv.conf, or the spamassassin force_ipv4 or force_ipv6 setting
with no DNS servers of that address family.

What does your /etc/resolv.conf look like?

You might also try starting spamd manually, and adding "-D dns" to the
arguments currently used. That will log a good deal of additional
information about the DNS configuration, and you should be able to
figure out where spamd is getting its DNS servers (configuration or
Net::DNS).

Re: Centos 7 specific cure for Spamassassin DNS lookup

By Paul Heinlein at 08/10/2017 - 09:37

I run SpamAssassin on CentOS 7; the SPF plugin is loaded via
/etc/mail/spamassassin/init.pre. I have no trouble with spf at all.

Is it possible the problem is with local DNS resolution?

Re: Centos 7 specific cure for Spamassassin DNS lookup

By Phil Perry at 08/10/2017 - 12:25

On 10/08/17 15:37, Paul Heinlein wrote:
Same here, no issues with spamassassin and SPF.

In addition to Paul's question which seems like the most obvious initial
avenue of investigation, I assume you have perl-Mail-SPF and
perl-Net-DNS installed? They should be as both are deps for the
spamassassin package.

Re: Centos 7 specific cure for Spamassassin DNS lookup

By Gary Stainburn at 08/14/2017 - 03:38

On Thursday 10 August 2017 18:25:44 Phil Perry wrote:
Both deps are installed, and from what I can tell the SPF code was loading
fine, but then failing when called.

Local DNS resolution was working fine, with the correct entries in
resolve.conf, and nslookup, dig, and all other services working fine.

The research I had done into this error messsage stated that because of
problems with Net::DNS SA had cheated and looked at the internals of the
module to obtain the DNS list. These internals then broke which meant that SA
could no longer detect the DNS servers. By adding

dns_server x.x.x.x

to the local.cf I got round this problem and the error messages have gone.

However, as I said in my other post I am now getting

spamd[102425]: Use of uninitialized value $rr_type in string eq
at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/AskDNS.pm line 592.

instead

Gary

Re: Centos 7 specific cure for Spamassassin DNS lookup

By Gary Stainburn at 08/10/2017 - 08:49

On Thursday 10 August 2017 09:21:31 Gary Stainburn wrote:
One of the solutions that I've found is to add dns_server entries into the
config file. As this did not entail updating the software this is the option
I've chosen.

This has fixed the original 'spf' error message, but now gives me a different
error message. I now get one or more

Use of uninitialized value $rr_type in string eq
at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/AskDNS.pm line 592.

I'm now looking into this one, but any assistance would be appreciated.

Gary