Changeset 101 for trunk


Ignore:
Timestamp:
09/24/25 11:01:28 (2 days ago)
Author:
Kris Deugau
Message:

/trunk/uribl

File off most of the rough edges on configuration from the misc table; all
keys now have defaults in the object, overrides happen correctly, and all
keys are filled in to the appropriate places in the output rather than
hardcoding things.

Location:
trunk/uribl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/uribl/Makefile

    r100 r101  
    77
    88PKGNAME=uridb
    9 VERSION=0.2.2
     9VERSION=0.2.3
    1010
    1111# bloody stupid Debian config puts OS-provided packaged sitelib under
  • trunk/uribl/URIdb.pm

    r100 r101  
    7272        dbuser => "dnsbl",
    7373        dbpass => "spambgone",
     74        misc => {
     75                blzone => "uribl.company.com",
     76                altblzone => "uri.dnsbl",
     77                bladmin => "systems.company.com",
     78                ttl => 600,
     79                soa => "600 600 600 600",
     80        },
    7481  );
    7582
     
    136143  }
    137144  $self->{misc}{blzone} = 'uribl.company.com' if !$self->{misc}{blzone};
     145  $self->{misc}{altblzone} = 'uribl.company.com' if !$self->{misc}{altblzone};
    138146  return $dbh;
    139147}
     
    192200  my $sth;
    193201
    194 ##fixme:  should probably rejig this key to point to a FQDN rather than a "something that will get published under .dnsbl"
    195   my $blzone = ($self->{misc}{blzone} ? $self->{misc}{blzone} : 'uri.dnsbl');
    196   my $bladmin = ($self->{misc}{bladmin} ? $self->{misc}{bladmin} : 'systems.company.com');
    197   my $blttl = ($self->{misc}{ttl} ? $self->{misc}{ttl} : '900');
    198 ##fixme:  should probably add some configuration strings for the nameserver value
    199 
    200202  if ($target eq 'rbldnsd') {
    201     print $blfh "\$SOA 900 $blzone $bladmin 0 1200 600 600 900\n".
     203    print $blfh "\$SOA 900 $self->{misc}{blzone} $self->{misc}{bladmin} 0 $self->{misc}{soa}\n".
    202204        "\$NS 3600 127.0.0.1\n".
    203         "\$TTL $blttl\n";
     205        "\$TTL $self->{misc}{ttl}\n";
    204206    print $blfh ":127.0.0.2:Domain found in reported missed-spam, no legitimate root or www content\n";
    205207    $sth = $dbh->prepare("SELECT uri FROM urilist WHERE list=2");
     
    227229    }
    228230  } elsif ($target eq 'tinydns') {
    229     print $blfh "Z$blzone:$blzone:$bladmin::600:600:600:600\n";
    230     print $blfh "\&$blzone:127.0.0.1::900\n";
     231    my $soa = $self->{misc}{soa};
     232    $soa =~ s/\s+/:/g;
     233    print $blfh "Z$self->{misc}{blzone}:$self->{misc}{blzone}:$self->{misc}{bladmin}::$soa\n";
     234    print $blfh "\&$self->{misc}{blzone}:127.0.0.1::3600\n";
    231235    $sth = $dbh->prepare("SELECT uri FROM urilist WHERE list=2");
    232236    $sth->execute;
    233237    while (my ($uri) = $sth->fetchrow_array) {
    234       print $blfh "'$uri.$blzone:Domain found in reported missed-spam, no legitimate root or www content:900::\n".
    235         "+$uri.$blzone:127.0.0.2:900::\n";
     238      print $blfh "'$uri.$self->{misc}{blzone}:Domain found in reported missed-spam, no legitimate root or www content:$self->{misc}{ttl}::\n".
     239        "+$uri.$self->{misc}{blzone}:127.0.0.2:$self->{misc}{ttl}::\n";
    236240    }
    237241    $sth = $dbh->prepare("SELECT uri FROM urilist WHERE list=4");
    238242    $sth->execute;
    239243    while (my ($uri) = $sth->fetchrow_array) {
    240       print $blfh "'$uri.$blzone:Domain seen repeatedly in reported missed-spam, some legitimate root or www content:900::\n".
    241         "+$uri.$blzone:127.0.0.4:900::\n";
     244      print $blfh "'$uri.$self->{misc}{blzone}:Domain seen repeatedly in reported missed-spam, some legitimate root or www content:$self->{misc}{ttl}::\n".
     245        "+$uri.$self->{misc}{blzone}:127.0.0.4:$self->{misc}{ttl}::\n";
    242246    }
    243247    $sth = $dbh->prepare("SELECT uri FROM urilist WHERE list=8");
    244248    $sth->execute;
    245249    while (my ($uri) = $sth->fetchrow_array) {
    246       print $blfh "'$uri.$blzone:Abused URL-shortener or redirector domain:900::\n".
    247         "+$uri.$blzone:127.0.0.8:900::\n";
     250      print $blfh "'$uri.$self->{misc}{blzone}:Abused URL-shortener or redirector domain:$self->{misc}{ttl}::\n".
     251        "+$uri.$self->{misc}{blzone}:127.0.0.8:$self->{misc}{ttl}::\n";
    248252    }
    249253    $sth = $dbh->prepare("SELECT uri FROM urilist WHERE list=16");
    250254    $sth->execute;
    251255    while (my ($uri) = $sth->fetchrow_array) {
    252       print $blfh "'$uri.$blzone:High-risk domain:900::\n".
    253         "+$uri.$blzone:127.0.0.16:900::\n";
     256      print $blfh "'$uri.$self->{misc}{blzone}:High-risk domain:$self->{misc}{ttl}::\n".
     257        "+$uri.$self->{misc}{blzone}:127.0.0.16:$self->{misc}{ttl}::\n";
    254258    }
    255259  } elsif ($target eq 'bind') {
  • trunk/uribl/uridb.cgi

    r91 r101  
    103103    ($domain) = split /:/, $domain;
    104104    $domain =~ s/^\+//;
    105     $domain =~ s/\.$uridb->{misc}{blzone}//;
     105    $domain =~ s/\.$uridb->{misc}{blzone}// if $uridb->{misc}{blzone};
    106106    # and a secondary zone name Just In Case(TM)
    107     $domain =~ s/\.$uridb->{misc}{altblzone}//;
     107    $domain =~ s/\.$uridb->{misc}{altblzone}// if $uridb->{misc}{altblzone};
    108108    # trim any non-FQDN URI parts
    109109    $domain =~ s{/.+$}{};
     
    113113    chomp $domain;
    114114    # now, see if it's multilisted
    115     if ($domain =~ / on (\w+)\s*$/) {
     115    if ($domain =~ / on ([\w-]+)\s*$/) {
    116116      my $sub = $1;
    117       #$domain =~ s/ on \w+\s*$//;
     117      $domain =~ s/ on [\w-]+\s*$//;
    118118      $domlist[$domcount-1]->{otherlists} .= ",$sub";
    119119      next;
Note: See TracChangeset for help on using the changeset viewer.