SpamAssassin: No DNS servers available!

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,923
A bug in the Net::DNS was reported causing error that look like this:
Code:
[COLOR=#000000][FONT=courier new]Oct 11 16:54:09 server spamd[474]: plugin: eval failed: available_nameservers: No DNS servers available![/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]Oct 11 16:54:09 server spamd[474]: rules: failed to run NO_DNS_FOR_FROM RBL test, skipping:[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]Oct 11 16:54:09 server spamd[474]:  (available_nameservers: [...] No DNS servers available!)[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]Oct 11 16:54:09 server spamd[474]: spf: lookup failed: available_nameservers: No DNS servers available![/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]Oct 11 16:54:09 server spamd[474]: spf: lookup failed: available_nameservers: No DNS servers available![/FONT][/COLOR]
So we've got a guide here to help repair it:
http://help.directadmin.com/item.php?id=570

I've also added the patch directly into the Mail-SpamAssassin-3.4.0.tar.gz which will cause this error in custombuild when you update, which will be normal and can be ignored:
Code:
File already exists:    Mail-SpamAssassin-3.4.0.tar.gz

[SIZE=3][B]*** MD5 Checksum for Mail-SpamAssassin-3.4.0.tar.gz Failed.  Redownloading...***[/B][/SIZE]


Downloading             Mail-SpamAssassin-3.4.0.tar.gz...
--2014-10-11 16:33:27--  http://files1.directadmin.com/services/custombuild/Mail-SpamAssassin-3.4.0.tar.gz
Resolving files1.directadmin.com... 216.144.254.90
Connecting to files1.directadmin.com|216.144.254.90|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1294260 (1.2M) [application/x-gzip]
Saving to: `/usr/local/directadmin/custombuild/Mail-SpamAssassin-3.4.0.tar.gz'


100%[==========================================================================================================================================>] 1,294,260   --.-K/s   in 0.1s


2014-10-11 16:33:27 (11.2 MB/s) - `/usr/local/directadmin/custombuild/Mail-SpamAssassin-3.4.0.tar.gz' saved [1294260/1294260]


MD5 Checksum on Mail-SpamAssassin-3.4.0.tar.gz passed.
John
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,463
I don't find any of those errors in any of my log files. So I might not be affected then? Is there any easy way to find out if I am affected?

Would recompiling SpamAssassin in custombuild also fix the issue? (I noticed that when doing ./build update it redownloaded SpamAssassin)
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,923
It was reported to us from a client, and then I noticed it was doing the same thing one of our brand new test boxes..
our current da.com server was installed maybe 1 year ago and wasn't affected, so not 100% sure on the conditions.
You'd probably know fairly quickly if you were affected; those error above showed up for every single email coming in that was scanned.
If your mail headers show scores that include dns (spf, reverse dns, rbl, etc...) then you're probably not affected.

If you do re-install SA via CB, it would probably ensure you've got the patch, but again, I'm not 100% sure on the details on how to duplicate it exactly.

John
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
8,340
Location
LT, EU
ditto, the bug affects Net:: DNS version >= 0.76 only, that's why you might be not experiencing problems on your box :)
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,463
@smtalk, I went into cpan and typed r to get the versions of all modules. It said I have Net:: DNS 0.74.

@John, thank you, then I might wait until the next SpamAssassin version is released before I recompile.
 

cRipTz

Verified User
Joined
Sep 5, 2014
Messages
12
Location
Almeria (España)
its a bug
just editing an file and restarting exim will solved.

Code:
--- Mail/SpamAssassin/DnsResolver.pm.orig 2014-05-07 
17:54:29.000000000 +0200 
+++ Mail/SpamAssassin/DnsResolver.pm 2014-06-18 02:13:32.936306639 
+0200 
@@ -205,6 +205,8 @@ 
dbg("dns: servers set by config to: %s", join(', ',@ns_addr_port)); 
} elsif ($res) { # default as provided by Net::DNS, e.g. 
/etc/resolv.conf 
- @ns_addr_port = map(untaint_var("[$_]:" . $res->{port}), 
- @{$res->{nameservers}}); 
+ my @ns = $res->UNIVERSAL::can('nameservers') ? $res->nameservers 
+ : 
@{$res->{nameservers}}; 
+ my $port = $res->UNIVERSAL::can('port') ? $res->port : 
$res->{port}; 
+ @ns_addr_port = map(untaint_var("[$_]:" . $port), @ns); 
dbg("dns: servers obtained from Net::DNS : %s", join(', 
',@ns_addr_port)); 
}
source : http://www.gossamer-threads.com/lists/spamassassin/users/185470

OR apply the patch from directadmin.

IF : spamd[474]: spf: lookup failed: available_nameservers: No DNS servers available! <-- INTO LOG
THEN...
Code:
cd /root
wget http://files1.directadmin.com/services/custombuild/patches/dns_resolver.patch
patch -p0 < dns_resolver.patch
finally restart spamd via exim
Code:
/etc/init.d/exim restart
 
Last edited:

Erulezz

Verified User
Joined
Sep 14, 2015
Messages
435
Location
Arnhem, NL
I am still getting this error when i check with systemctl status spamassassin.service. Every message that is coming in gets this error. I tried rebuilding with CustomBuild, applying the patch, nothing resolves this error. I have all the modules installed that SpamAssassin is using and everything is up2date. I have two IPv6 nameservers, tried it with IPv4 and no improvement. I am using CentOS 7.

Does anybody has a clue what the issue could be? I'm out of ideas :(
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,923
If the nameservers are IPv6, perhaps try editing:
/etc/systemd/system/spamassassin.service

and remove --ipv4 in the ExecStart line.

Then restart the spamassassin service (systemd will tell you to reload the script, so just run it's mentioned command)

Might not be a bad idea to add the "nameserver 8.8.8.8" to the bottom of your /etc/resolv.conf file, as an IPv4 backup... or even 127.0.0.1, so it has something to use, in case it can't figure out IPv6 nameservers.

John
 

Erulezz

Verified User
Joined
Sep 14, 2015
Messages
435
Location
Arnhem, NL
Thanks!! That was it. It's working now!

If i build SpamAssassin again or there is an update available, do i need to make these changes again?

Again, thanks for the quick reply!;)
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,854
Location
GMT +7.00
Hello,

Directadmin does not touch /etc/resolv.conf , so your customization should be save, unless you run a VPS server based on OpenVZ. If you do run an OpenVZ VPS then the file will be reset to its original view with a server reboot.
 

Erulezz

Verified User
Joined
Sep 14, 2015
Messages
435
Location
Arnhem, NL
Hello,

I mean the changes made in /etc/systemd/sytem/spamassassin.service :) I did not change my resolve.conf, i would like to keep using the IPv6 nameservers from my VPS provider. :)

Removing the --ipv4 line in that file is working great. If i update or rebuild SpamAssassin, do i need to remove the --ipv4 line again?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,854
Location
GMT +7.00
Copy the modified file to /usr/local/directadmin/custombuild/custom/systemd/. That should help.
 
Top