release candidate
authorDirk Koopman <djk@tobit.co.uk>
Tue, 10 Jan 2023 12:30:16 +0000 (12:30 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 10 Jan 2023 12:30:16 +0000 (12:30 +0000)
Add readdir of /spider/local_host/badip.* files.
Add a default /spider/data/baddx.issue file.
Move PC[61]1 baddx check after the IP address check code.
Add baddx callsign check to RBN

Changes
data/baddx.issue [new file with mode: 0644]
perl/DXCIDR.pm
perl/DXProtHandle.pm
perl/RBN.pm

diff --git a/Changes b/Changes
index ab75b6b124b4126ca6c8277a109cd4a8d5160a9f..8b0bfa4e0703f91f9f51abeb5c3a2a105dca1427 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,8 +1,28 @@
+10Jan23=======================================================================
+1. Add baddx on incoming callsign in RBN.
+2. Search for all /spider/local_data/badip.* files to allow more control on
+   which IP addresses are detected. e.g. badip.torexit, badip.torrelay as well
+   as baddx.local. The suffixes, apart from .local (created by set/badip) are
+   completely arbitrary. You can use whichever suffix name you like. This is
+   a more useful arrangement for the ever increasing sources of "bad ip
+   addresses" that we need to deter.  
+
+   NOTE: all badip.<suffix> are read only EXCEPT badip.local (which can be
+   altered in real time by the sysop using set/badip <ip address> ...). 
+   If one uses periodic crontab jobs to update any other badip.<suffix>
+   files from web resources then don't forget to 'load/badip' afterwards. 
+3. Add a /spider/data/baddx.issue file which can be copied to (or used as a 
+   basis to create) /spider/local_data/baddx
 09Jan23=======================================================================
 1. Finish implemention of DXCIDR ip address filtering. This works on both 
    logins (treated the same as locked out - i.e. just disconnected) and also
    with PC61s where these sentences are just dropped. Also attempt to prevent
    any *following* PC11s with the same data getting through. 
+
+   YOU WILL NEED either 'cpanm Net::CIDR::Lite' or debian/ubuntu based distros 
+   'apt install libnet-cidr-lite-perl'. RedHat based systems will have similar
+   packages available.
+
 2. Recognise PC18s coming from CC Clusters more nicely.
 04Jan23=======================================================================
 1. Fillout DXCIDR, attach checks in PC61 and logins. Login that fail will 
diff --git a/data/baddx.issue b/data/baddx.issue
new file mode 100644 (file)
index 0000000..c3b0d3a
--- /dev/null
@@ -0,0 +1,26 @@
+bless( {
+  ID10T => 1673336995,
+  name => 'baddx',
+  SALE => 1471525525,
+  F0OL => 1673336913,
+  PIRATE => 1471525604,
+  WANTED => 1471525604,
+  TEST => 1471525604,
+  EY0RE => 1673336913,
+  FO0L => 1673336913,
+  F0SALE => 1673337052,
+  N1L => 1673337039,
+  R0BOT => 1673336913,
+  FORSALE => 1471525525,
+  CUNT => 1672857612,
+  L1D => 1673336913,
+  ID1OT => 1168880653,
+  FROG => 1471525525,
+  WH0RE => 1673336913,
+  NOCALL => 1471525604,
+  TR0LL => 1673336913,
+  P1RATE => 1471525604,
+  NIL => 1471525604,
+  FERRARI => 1471525604,
+  DXTEST => 1471525604
+}, 'DXHash' )
index 88a26d5c552631e4b66c173eb0c3262400e17d0d..fdade7fc8989bae6d17fad741ff636604c0d2938 100644 (file)
@@ -202,10 +202,23 @@ sub reload
 {
        new();
 
-       my $count = _load('base');
-       $count += _load('local');
-
-       LogDbg('DXProt', "DXCIDR::reload $count ip addresses found (IPV4: $count4 IPV6: $count6)" );
+       my $count = 0;
+       my $files = 0;
+
+       LogDbg('DXProt', "DXCIDR::reload reload database" );
+
+       my $dir;
+       opendir($dir, $main::local_data);
+       while (my $fn = readdir $dir) {
+               next unless my ($suffix) = $fn =~ /^badip\.(\w+)$/;
+               my $c = _load($suffix);
+               LogDbg('DXProt', "DXCIDR::reload: $fn read containing $c ip addresses" );
+               $count += $c;
+               $files++;
+       }
+       closedir $dir;
+       
+       LogDbg('DXProt', "DXCIDR::reload $count ip addresses found (IPV4: $count4 IPV6: $count6) in $files badip files" );
 
        return $count;
 }
index f1972b094af888870e44470c1ca5458762eb4085..fc6e13ef25032a3e9148d529be12dac5ce214ecd 100644 (file)
@@ -107,7 +107,7 @@ sub handle_10
                return;
        }
 
-       # if this is a 'bad spotter' user then ignore it
+
        my $nossid = $from;
        $nossid =~ s/-\d+$//;
        if ($badspotter->in($nossid)) {
@@ -186,16 +186,6 @@ sub handle_11
                return;
        }
 
-       # if this is a 'bad spotter' or an unknown user then ignore it. BUT if it's got an IP address then allow it through
-       my $nossid = $pc->[6];
-       $nossid =~ s/-\d+$//;
-       if ($badspotter->in($nossid)) {
-               dbg($line) if isdbg('nologchan');
-               dbg("PCPROT: Bad Spotter $pc->[6], dropped");
-               return;
-       }
-
-
        # convert the date to a unix date
        my $d = cltounix($pc->[3], $pc->[4]);
        # bang out (and don't pass on) if date is invalid or the spot is too old (or too young)
@@ -221,6 +211,8 @@ sub handle_11
                return;
        }
        
+       my $nossid = $pc->[6];
+    $nossid =~ s/-\d+$//;
 
        my @spot = Spot::prepare($pc->[1], $pc->[2], $d, $pc->[5], $nossid, $pc->[7], $pc->[8]);
 
@@ -238,6 +230,13 @@ sub handle_11
                }
        }
 
+       # is this is a 'bad spotter' or an unknown user then ignore it. 
+       if ($badspotter->in($nossid)) {
+               dbg($line) if isdbg('nologchan');
+               dbg("PCPROT: Bad Spotter $pc->[6], dropped");
+               return;
+       }
+
        # global spot filtering on INPUT
        if ($self->{inspotsfilter}) {
                my ($filter, $hops) = $self->{inspotsfilter}->it(@spot);
@@ -247,6 +246,7 @@ sub handle_11
                }
        }
 
+
        # this is where we decide to delay PC11s in the hope that a PC61 will be along soon.
        
        my $key = join '|', @spot[0..2,4,7]; # not including text
index 87cedaa71c73447a78d174e988094f6aeff08897..e0d096b9dcd6ecf389ed349c3a0b4362cb6ac084 100644 (file)
@@ -259,6 +259,14 @@ sub normal
                return;
        }
 
+       # is it 'baddx'
+       if ($DXProt::baddx->in($call)) {
+               dbg("RBN: Bad DX spot '$call', ignored");
+               dbg($line) if isdbg('nologchan');
+               return;
+       }
+
+       
        # remove all extraneous crap from the origin - just leave the base callsign
        my $norigin = basecall($origin);
        unless ($norigin) {