i run

        spamassassin -V
        SpamAssassin version 3.4.6
          running on Perl version 5.34.1

i maintain GeoIP2 data updates from MaxMind,

        systemctl status geoipdb
                ○ geoipdb.service - update geoipdb service
                     Loaded: loaded (/etc/systemd/system/geoipdb.service; 
static)
                     Active: inactive (dead) since Tue 2022-08-30 14:55:17 EDT; 
22s ago
                TriggeredBy: ● geoipdb.timer
                    Process: 34949 ExecStart=/usr/bin/geoipupdate (code=exited, 
status=0/SUCCESS)
                   Main PID: 34949 (code=exited, status=0/SUCCESS)
                        CPU: 265ms

which execs

        /usr/bin/geoipupdate

to maintain / populate

        tree /usr/share/GeoIP/
                /usr/share/GeoIP/
                ├── GeoLite2-ASN.mmdb
                ├── GeoLite2-City.mmdb
                └── GeoLite2-Country.mmdb

RelayCountry plugin is enabled / in use

        grep RelayCountry init.pre
                # RelayCountry - add metadata for Bayes learning, marking the 
countries
                loadplugin Mail::SpamAssassin::Plugin::RelayCountry

for use with the GeoIP2 data,

        
https://github.com/apache/spamassassin/blob/39ea11b27b55f99a945d2542779175d393d35334/build/announcements/3.4.2.txt#L96
                "GeoIP2 support has been added to RelayCountry and URILocalBL 
plugins due
                 to GeoIP legacy API deprecations."

config points to the data above

        cat local.cf
                ...
                ifplugin Mail::SpamAssassin::Plugin::RelayCountry
                  country_db_type GeoIP2
                  country_db_path /usr/share/GeoIP/GeoLite2-Country.mmdb
                  add_header all Relay-Country _RELAYCOUNTRY_
                endif
                ...

source for RelayCountry.pm

        
https://metacpan.org/dist/Mail-SpamAssassin/source/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm

includes,

        elsif ($country_db_type eq "GeoIP2") {
            if (!$country_db_path) {
              # Try some default locations
              foreach (@{$opts->{conf}->{geoip2_default_db_path}}) {
                if (-f $_) {
                  $country_db_path = $_;
                  last;
                }
              }
            }
            if (-f $country_db_path) {
              eval {
                require GeoIP2::Database::Reader;
                $db = GeoIP2::Database::Reader->new(
                  file => $country_db_path,
                  locales => [ 'en' ]
                );
                die "unknown error" unless $db;
                $db_info = sub {
                  my $m = $db->metadata();
                  return "GeoIP2 ".$m->description()->{en}." / 
".localtime($m->build_epoch());
                };
                1;
              } or do {
                # Fallback to IP::Country::Fast
                $@ =~ s/\s+Trace begun.*//s;
                dbg("metadata: RelayCountry: GeoIP2: ${country_db_path} load failed: 
$@, trying IP::Country::Fast as fallback");
                $country_db_type = "Fast";
              }


which specifies 'require'

        require GeoIP2::Database::Reader;

which, checking @ 
https://metacpan.org/dist/GeoIP2/source/lib/GeoIP2/Database/Reader.pm, further 
requires,

        use Data::Validate::IP 0.25 qw( is_private_ip );
        use GeoIP2::Error::Generic;
        use GeoIP2::Error::IPAddressNotFound;
        use GeoIP2::Model::ASN;
        use GeoIP2::Model::AnonymousIP;
        use GeoIP2::Model::City;
        use GeoIP2::Model::ConnectionType;
        use GeoIP2::Model::Country;
        use GeoIP2::Model::Domain;
        use GeoIP2::Model::Enterprise;
        use GeoIP2::Model::Insights;
        use GeoIP2::Model::ISP;
        use GeoIP2::Types qw( Str );
        use MaxMind::DB::Reader 1.000000;

where

        https://metacpan.org/pod/MaxMind::DB::Reader

                Deprecated.
                The maintainer of this distribution has indicated that it is 
deprecated and no longer suitable for use.

and all (sub)modules under

        https://metacpan.org/dist/GeoIP2

                Deprecated.
                The maintainer of this distribution has indicated that it is 
deprecated and no longer suitable for use.

verifying, @ https://dev.maxmind.com/geoip/docs/web-services?lang=en, Perl 
support is in fact deprecated


        Language or Framework
        ...
        Node.js
!!      Perl (deprecated) <--------------------------
        PHP
        Python
        Ruby
        ...

What alternative, non-deprecated support, if any, exists, or is planned, for SA 
RelayCountry plugin usage with MaxMind GeoIP2 *.mmdb data?

Reply via email to