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.
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.
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?
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.
Try starting spamassassin later. Run “systemctl edit spamassassin.service” and insert two lines:
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.
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
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: Use of uninitialized value $rr_type in string eq at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/AskDNS.pm line 592.
“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).