Ignore:
Timestamp:
09/05/25 16:04:46 (12 days ago)
Author:
Kris Deugau
Message:

/trunk/dnsbl

The "begin the cleanup from production" cleanup commit

  • Move default DB connect info into DNSBL.pm
  • Move configuration fragment loading into DNSBL.pm
  • Change up configuration fragment to use %siteconfig instead of individual variables
  • Normalize parts of locating the module to at least a "good enough" level
  • if(0) out a chunk of export-dnsbl

Some things may be broken.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dnsbl/export-dnsbl

    r69 r73  
    33##
    44# $Id$
    5 # Copyright 2009-2012,2014,2018 Kris Deugau <kdeugau@deepnet.cx>
     5# Copyright 2009-2012,2014,2018,2025 Kris Deugau <kdeugau@deepnet.cx>
    66#
    77#    This program is free software: you can redistribute it and/or modify
     
    2727use lib "$FindBin::RealBin/";
    2828
    29 use DNSBL 2.2;
    30 
    31 my $dnsbl = new DNSBL;
    32 
    33 # default DB info - all other settings should be loaded from the DB.
    34 my $dbhost = "localhost";
    35 my $dbname = "dnsbl";
    36 my $dbuser = "dnsbl";
    37 my $dbpass = "spambgone";
     29use DNSBL 3.0;
    3830
    3931die "Need config argument\n" if !$ARGV[0];
    4032my $cfgname = shift @ARGV;
    4133
    42 # Load a config ref containing DB host, name, user, and pass info based on
    43 # from the server name + full script web path.  This allows us to host
    44 # multiple instances without having to duplicate the code.
    45 # This file is a Perl fragment to be processed inline.
    46 if (-e "/etc/dnsbl/$cfgname.conf") {
    47   my $cfg = `cat /etc/dnsbl/$cfgname.conf`;
    48   ($cfg) = ($cfg =~ /^(.+)$/s);         # avoid warnings, failures, and general nastiness with taint mode
    49   eval $cfg;
    50 }
    51 
    52 my $dbh = $dnsbl->connect($dbhost, $dbname, $dbuser, $dbpass);
     34my $dnsbl = new DNSBL (configfile => "/etc/dnsbl/$cfgname.conf");
     35$dnsbl->connect;
    5336
    5437my %config;
     
    6144my %iplist;
    6245my $ipref = \%iplist;
     46my @iplist2;
     47my $ipref2 = \@iplist2;
    6348
    6449my $mode = $ARGV[0] || 'tiny';
     
    6651$dnsbl->initexport;
    6752#$dnsbl->export($ipref,$mode,1,'50.22.0.0/15');
    68 $dnsbl->export($ipref,$mode);
     53#$dnsbl->export($ipref,$mode);
     54$dnsbl->export_alt($ipref2, $mode);
     55
    6956
    7057##fixme - mode should pick actual output, not just export mode
     
    7764
    7865  # more or less raw CIDR block-and-IP info.  rbldnsd format for convenience.
    79   foreach (sort ipcmp keys %iplist) {
     66
     67
     68
     69if (0) {
     70#  foreach (sort ipcmp keys %iplist) {
     71  foreach (keys %iplist) {
    8072    my $entry;
    8173    if ($iplist{$_} == -1) {
     
    10496    print $out;
    10597  }
     98}
     99
     100
    106101} else {
    107102  # default "mode";  tinyDNS data format
Note: See TracChangeset for help on using the changeset viewer.