Anti-spam DNSBL by BOates [CHANGES REQUIRED TO WORK WITH SPAMASSASSIN 3.4.2 or later in v76+]

RafaelEbarola

Well-Known Member
Jun 19, 2015
50
2
58
Philippines
cPanel Access Level
Root Administrator
Hi @BOates,

I have difficulties creating this one

2) Copy/Paste the below code inside and save it
Code:
sub trimdomain {
require Mail::SpamAssassin::Util::RegistrarBoundaries;
my $domain = shift;
my $trimmed_domain = Mail::SpamAssassin::Util::RegistrarBoundaries::trim_domain($domain);
return $trimmed_domain;
}


Although I already created directory mkdir /usr/local/cpanel/etc/exim/perl/trimdomain but I cant copy paste step 2 scripts using nano /usr/local/cpanel/etc/exim/perl/trimdomain. Did I miss something??

but I'm done with this steps /usr/local/cpanel/etc/exim/acls/ACL_MAIL_POST_BLOCK/custom_begin_mail_post
and Copy/Paste the below code inside and save it.

Thanks for your help.
 

Vinayak

Well-Known Member
Jun 27, 2003
288
5
168
Bharat
cPanel Access Level
Root Administrator
With today's cPanel nightly update, this ACL has stopped working.

Code:
failed to expand ACL string "fresh.dieinafire.com/${perl{trimdomain}{$sender_address_domain}}": Can't locate Mail/SpamAssassin/Util/RegistrarBoundaries.pm in @INC (you may need to install the Mail::SpamAssassin::Util::RegistrarBoundaries module)
 

vlee

Well-Known Member
Oct 13, 2005
373
26
178
Spokane, Washington
cPanel Access Level
Root Administrator
Just to let you know this has stopped working properly when cPanel updated to version 76.0.4

Code:
Checking the cause of delivery inability, this was due to custom directives in the Exim Configuration.

The following lines :

drop
!authenticated = *
dnslists = fresh.dieinafire.com/${perl{trimdomain}{$sender_address_domain}}
message = Fresh Domain Blocked - [${perl{trimdomain}{$sender_address_domain}}] is listed on (fresh.dieinafire.com)


Which were located under section :

custom_begin_mail_post

Initially resulted in error along the following lines.


2018-11-06 11:21:10 H=(mail.asthenervestop.icu) [192.119.96.109]:33352 temporarily rejected MAIL <[email protected].icu>: failed to expand ACL string "fresh.dieinafire.com/${perl{trimdomain}{$sender_address_domain}}": Can't locate Mail/SpamAssassin/Util/RegistrarBoundaries.pm in @INC (you may need to install the Mail::SpamAssassin::Util::RegistrarBoundaries module) (@INC contains: /usr/local/cpanel /etc/exim/perl /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/cpanel_lib/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/cpanel_lib /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/5.26.0/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/5.26.0 /opt/cpanel/perl5/526/site_lib/x86_64-linux-64int /opt/cpanel/perl5/526/site_lib) at /etc/exim.pl.local line 1963.

There was a SpamAssassin update in which the module was deprecated and replaced as shown here :

https://www.gsp.com/cgi-bin/man.cgi?section=3&topic=Mail::SpamAssassin::Util::RegistrarBoundaries
I had no choice to remove this from my servers due the fact I was not able to receive any emails at all.
 

cPanelNick

Administrator
Staff member
Mar 9, 2015
3,481
35
208
cPanel Access Level
DataCenter Provider
The SpamAssassin functionality this tool is using was deprecated in version 3.4.1 and removed in version 3.4.2 because it is now provided by another method.

Mail::SpamAssassin::Util::RegistrarBoundaries(3) - domain delegation rules This module is DEPRECATED AND REPLACED WITH Mail::SpamAssassin::RegistryBoundaries !! DO NOT USE. This is left as transition fallback for third party plugins. It will be removed in the future but all functionality has been transitioned to Mail::SpamAssassin::RegistryBoundaries and the TLD updates via 20_aux_tlds.cf delivered via sa-update with version 3.4.1

As this plugin has not yet been updated to work with the latest version of SpamAssassin, the only option at this time is to uninstall it when upgrading to a version of cPanel that bundles SpamAssassin 3.4.2 (v76+) in order to ensure mail continues to function.
 
  • Like
Reactions: Infopro

BOates

Active Member
PartnerNOC
May 28, 2005
39
13
158
Michigan
cPanel Access Level
Root Administrator
Hey folks,

The modifications to /usr/local/cpanel/etc/exim/perl/trimdomain to become compliant with SpamAssassin 3.4.2 / cPanel & WHM v76 would be:

Code:
sub trimdomain {
    require Mail::SpamAssassin::RegistryBoundaries;
    my $domain = shift;
    my $rb = new Mail::SpamAssassin::RegistryBoundaries;
    return $rb->trim_domain($domain);
}
I wasn't aware that anyone was really making much use of this still, although I continue to use it for personal use. The DNSBL has been in continuous operation since the post was made with no plans to stop operation. Admittedly, I hadn't been keeping up with cPanel & WHM changes and this caught me by surprise. My apologies.
 

BOates

Active Member
PartnerNOC
May 28, 2005
39
13
158
Michigan
cPanel Access Level
Root Administrator
I am unable to edit old posts myself, but it looks like one of the cPanel staff members (cPanelMichael, it looks like) already updated the original post in this thread with the changes. So the original post is now accurate again.
 

cbverneo

Registered
Jul 10, 2008
1
0
51
I am unable to edit old posts myself, but it looks like one of the cPanel staff members (cPanelMichael, it looks like) already updated the original post in this thread with the changes. So the original post is now accurate again.
Any plan to share your code? Due to my bandwidth speed and latency limitation, I am thinking to install it on my own network, so the DNSBL query can be local not going to your server
 

Fiuza2019

Registered
Jun 6, 2019
1
0
1
Brazil
cPanel Access Level
Root Administrator
Does it work with version 80.0.13?
Has anyone succeeded to make it work these days?

It looks like a very good solution but I tried to install and tests was unsuccessful.
BR.
 

sparek-3

Well-Known Member
Aug 10, 2002
2,087
243
368
cPanel Access Level
Root Administrator
Sorry to dig up an old thread - but seems relevant here.

It seems SpamAssassin updated at some point and using Mail::SpamAssassin::RegistryBoundaries started to generate errors:

config: registryboundaries: no tlds defined, need to run sa-update

In the exim_mainlog.

Or maybe it's something specific to my setup. Anybody else seeing this in their logs?
 

ddaddy

Well-Known Member
Aug 19, 2015
63
11
58
UK
cPanel Access Level
Root Administrator
Yes I am also getting these errors in the exam_mainlog.
I guess that explains why I have started getting a load of spam again, and is also a testament to how good this method of spam blocking is.
I wish CPanel would integrate this into WHM.

I patiently await any ideas on how to get it working again.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
10,360
1,627
363
cPanel Access Level
Root Administrator
@sparek-3 - when I've seen that issue in the past, we've just reinstalled SpamAssassin as that indicates it's missing some of the required tools. We have a guide for performing this work here, so I'd recommend trying that and seeing if that gets things working:

 

ddaddy

Well-Known Member
Aug 19, 2015
63
11
58
UK
cPanel Access Level
Root Administrator
My previous message seems to be pending moderator approval for some reason, but I have tried reinstalling SpamAssassin and will see how it works over the next day.

Thanks