Help with spamassassin and PERL module GeoIP2::Database::Reader
Hello,
I would like some help in order to make spamassassin RelayCountry and install required PERL modules..
I've followed instructions on this link: https://support.cpanel.net/hc/en-us/articles/1500011265202-How-do-I-install-mod-geoip
Also my server uses Litespeed, and I've configured MaxMind database at /usr/share/GeoIP/GeoLite2-Country.mmdb, created cronjob and it works with litespeed server (I've tested it with blocking access to wp-admin, wp-login.php. It works.)
When I run /usr/local/cpanel/3rdparty/bin/spamassassin -D --lint this is the error:
Feb 19 09:57:41.810 [213785] dbg: diag: [...] optional module not installed: GeoIP2::Database::Reader ('require' failed)
Feb 19 09:57:41.810 [213785] dbg: diag: [...] optional module installed: Geo::IP, version 1.51
Feb 19 09:57:41.810 [213785] dbg: diag: [...] optional module not installed: IP::Country::DB_File ('require' failed)
Here is Perl modules:
Feb 19 09:57:44.849 [213785] dbg: metadata: RelayCountry: GeoIP2: /usr/share/GeoIP/GeoLite2-Country.mmdb load failed: Can't locate GeoIP2/Database/Reader.pm in @INC (you may need to install the GeoIP2::Database::Reader module) (@INC contains: /var/lib/spamassassin/compiled/5.036/3.004006 /var/lib/spamassassin/compiled/5.036/3.004006/auto /usr/local/cpanel/3rdparty/perl/536/cpanel-lib/x86_64-linux /usr/local/cpanel/3rdparty/perl/536/cpanel-lib /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/536/lib/x86_64-linux /usr/local/cpanel/3rdparty/perl/536/lib /opt/cpanel/perl5/536/site_lib/x86_64-linux /opt/cpanel/perl5/536/site_lib) at /usr/local/cpanel/3rdparty/perl/536/cpanel-lib/Mail/SpamAssassin/Plugin/RelayCountry.pm line 284.
Feb 19 09:57:44.849 [213785] dbg: metadata: [...] , trying IP::Country::Fast as fallback
Feb 19 09:57:44.849 [213785] dbg: metadata: RelayCountry: failed to load 'IP::Country::Fast', skipping: Can't locate IP/Country/Fast.pm in @INC (you may need to install the IP::Country::Fast module) (@INC contains: /var/lib/spamassassin/compiled/5.036/3.004006 /var/lib/spamassassin/compiled/5.036/3.004006/auto /usr/local/cpanel/3rdparty/perl/536/cpanel-lib/x86_64-linux /usr/local/cpanel/3rdparty/perl/536/cpanel-lib /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/536/lib/x86_64-linux /usr/local/cpanel/3rdparty/perl/536/lib /opt/cpanel/perl5/536/site_lib/x86_64-linux /opt/cpanel/perl5/536/site_lib) at /usr/local/cpanel/3rdparty/perl/536/cpanel-lib/Mail/SpamAssassin/Plugin/RelayCountry.pm line 332.
Anybody has any ideas how to make this work?
Thanks!
Nermin
-
Hey there! It looks like that tool is requiring additional Perl modules. Were you able to install the IP::Country::DB_File module as well?
0 -
I think (and perhaps cPRex can confirm), that WHM's "Install a Perl Module"/"Module Installers" only installs it for usage by customers (aka the server's Perl binary) - whereas SpamAssassin probably uses the "cPanel Perl" installation (which is built/configured to operate WHM/cPanel and auxiliary programs).
If this is the case, you'll need to install the modules via the command line - https://support.cpanel.net/hc/en-us/articles/1500012484701-Optional-Perl-modules-for-SpamAssassin-are-not-preinstalled lists which ones you probably need - but I know my server is running Perl 5.36 (instead of 532) so I'll need to use:
/usr/local/cpanel/3rdparty/perl/536/bin/cpan install GeoIP2::Database::Reader
/usr/local/cpanel/3rdparty/perl/536/bin/cpan install IP::Country::DB_File
/usr/local/cpanel/3rdparty/perl/536/bin/cpan install Net::Patricia
/usr/local/cpanel/3rdparty/perl/536/bin/cpan install Net::DNS::Nameserverinstead. To find out what version of "cPanel Perl" you are running, try:
ls /usr/local/cpanel/3rdparty/bin/perl -alh
which will return something like:
lrwxrwxrwx 1 root root 44 Aug 5 2022 /usr/local/cpanel/3rdparty/bin/perl -> /usr/local/cpanel/3rdparty/perl/536/bin/perl
with the "536" bit being the current version.
1 -
Hello, I did as you wrote:
/usr/local/cpanel/3rdparty/perl/536/bin/cpan install GeoIP2::Database::Reader
/usr/local/cpanel/3rdparty/perl/536/bin/cpan install IP::Country::DB_File
/usr/local/cpanel/3rdparty/perl/536/bin/cpan install Net::Patricia
/usr/local/cpanel/3rdparty/perl/536/bin/cpan install Net::DNS::Nameserverand they are loading now without problems in lint.
However, this all was in order to attempt block emails sent thru africa, south america, asia and some other countries around the world, if they were relayed thru some of the countries that I would list.
I am using Mailscanner Front End from Configserver and I would like it to show up in header, but for some reason it does not show up.
Here is header in MailScanner FE:
It just writes _RELAYCOUNTRY_ without any country code.
As far as I can understand it should write AR, BR, DE, or any country.
Ive added this code to local.cf, and to init.pre and to mailscanner.cf
loadplugin Mail::SpamAssassin::Plugin::RelayCountry
ifplugin Mail::SpamAssassin::Plugin::RelayCountry
add_header all Relay-Countries _RELAYCOUNTRY_
add_header all Relay-Country _RELAYCOUNTRY_
report X-Relay-Countries: _RELAYCOUNTRY_
report X-Relay-Country: _RELAYCOUNTRY_
header RC_GOD X-Relay-Countries =~ /(BA|HR|DE)/
describe RC_GOD Relayed through a prohibited country at some point
score RC_GOD 0.1
endifDoes anybody have any idea how to make this work, because a lot of hacked email accounts are used for phishing, and as far as I can see they are sent thru third countries arround the world.
If there is some way to filter them out it would be awesome.
0 -
For MailScanner specific questions, it'll be best to ask on the ConfigServer forums at https://forum.configserver.com/viewforum.php?f=20 as it is 3rd party software (and more chance of Chirpy - the developer - seeing and responding to it there)
0
Please sign in to leave a comment.
Comments
4 comments