| 146 |
Note that, as with C<urirhsbl>, you must also define a body-eval rule calling |
Note that, as with C<urirhsbl>, you must also define a body-eval rule calling |
| 147 |
C<check_uridnsbl()> to use this. |
C<check_uridnsbl()> to use this. |
| 148 |
|
|
| 149 |
|
=item urifullnsrhsbl NAME_OF_RULE rhsbl_zone lookuptype |
| 150 |
|
|
| 151 |
|
Perform a RHSBL-style domain lookup against the contents of the NS records for |
| 152 |
|
each URI. In other words, a URI using the domain C<foo.com> will cause an NS |
| 153 |
|
lookup to take place; assuming that domain has an NS of C<ns0.bar.com>, that |
| 154 |
|
will cause a lookup of C<ns0.bar.com.uriblzone.net>. Note that hostnames are |
| 155 |
|
stripped from the domain used in the URI. |
| 156 |
|
|
| 157 |
|
C<NAME_OF_RULE> is the name of the rule to be used, C<rhsbl_zone> is the zone |
| 158 |
|
to look up domain names in, and C<lookuptype> is the type of lookup (B<TXT> or |
| 159 |
|
B<A>). |
| 160 |
|
|
| 161 |
|
Note that, as with C<urirhsbl>, you must also define a body-eval rule calling |
| 162 |
|
C<check_uridnsbl()> to use this. |
| 163 |
|
|
| 164 |
|
=item urifullnsrhssub NAME_OF_RULE rhsbl_zone lookuptype subtest |
| 165 |
|
|
| 166 |
|
Specify a RHSBL-style domain-NS lookup, as above, with a sub-test. |
| 167 |
|
C<NAME_OF_RULE> is the name of the rule to be used, C<rhsbl_zone> is the zone |
| 168 |
|
to look up domain names in, and C<lookuptype> is the type of lookup (B<TXT> or |
| 169 |
|
B<A>). C<subtest> is the sub-test to run against the returned data; see |
| 170 |
|
<urirhssub>. |
| 171 |
|
|
| 172 |
|
Note that, as with C<urirhsbl>, you must also define a body-eval rule calling |
| 173 |
|
C<check_uridnsbl()> to use this. |
| 174 |
|
|
| 175 |
=back |
=back |
| 176 |
|
|
| 177 |
=head1 ADMINISTRATOR SETTINGS |
=head1 ADMINISTRATOR SETTINGS |
| 257 |
# only hit DNSBLs for active rules (defined and score != 0) |
# only hit DNSBLs for active rules (defined and score != 0) |
| 258 |
$scanner->{'uridnsbl_active_rules_rhsbl'} = { }; |
$scanner->{'uridnsbl_active_rules_rhsbl'} = { }; |
| 259 |
$scanner->{'uridnsbl_active_rules_nsrhsbl'} = { }; |
$scanner->{'uridnsbl_active_rules_nsrhsbl'} = { }; |
| 260 |
|
$scanner->{'uridnsbl_active_rules_fullnsrhsbl'} = { }; |
| 261 |
$scanner->{'uridnsbl_active_rules_revipbl'} = { }; |
$scanner->{'uridnsbl_active_rules_revipbl'} = { }; |
| 262 |
|
|
| 263 |
foreach my $rulename (keys %{$scanner->{conf}->{uridnsbls}}) { |
foreach my $rulename (keys %{$scanner->{conf}->{uridnsbls}}) { |
| 266 |
my $rulecf = $scanner->{conf}->{uridnsbls}->{$rulename}; |
my $rulecf = $scanner->{conf}->{uridnsbls}->{$rulename}; |
| 267 |
if ($rulecf->{is_rhsbl}) { |
if ($rulecf->{is_rhsbl}) { |
| 268 |
$scanner->{uridnsbl_active_rules_rhsbl}->{$rulename} = 1; |
$scanner->{uridnsbl_active_rules_rhsbl}->{$rulename} = 1; |
| 269 |
|
} elsif ($rulecf->{is_fullnsrhsbl}) { |
| 270 |
|
$scanner->{uridnsbl_active_rules_fullnsrhsbl}->{$rulename} = 1; |
| 271 |
} elsif ($rulecf->{is_nsrhsbl}) { |
} elsif ($rulecf->{is_nsrhsbl}) { |
| 272 |
$scanner->{uridnsbl_active_rules_nsrhsbl}->{$rulename} = 1; |
$scanner->{uridnsbl_active_rules_nsrhsbl}->{$rulename} = 1; |
| 273 |
} else { |
} else { |
| 529 |
}); |
}); |
| 530 |
|
|
| 531 |
push (@cmds, { |
push (@cmds, { |
| 532 |
|
setting => 'urifullnsrhsbl', |
| 533 |
|
is_priv => 1, |
| 534 |
|
code => sub { |
| 535 |
|
my ($self, $key, $value, $line) = @_; |
| 536 |
|
if ($value =~ /^(\S+)\s+(\S+)\s+(\S+)$/) { |
| 537 |
|
my $rulename = $1; |
| 538 |
|
my $zone = $2; |
| 539 |
|
my $type = $3; |
| 540 |
|
$self->{uridnsbls}->{$rulename} = { |
| 541 |
|
zone => $zone, type => $type, |
| 542 |
|
is_fullnsrhsbl => 1 |
| 543 |
|
}; |
| 544 |
|
} |
| 545 |
|
elsif ($value =~ /^$/) { |
| 546 |
|
return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE; |
| 547 |
|
} |
| 548 |
|
else { |
| 549 |
|
return $Mail::SpamAssassin::Conf::INVALID_VALUE; |
| 550 |
|
} |
| 551 |
|
} |
| 552 |
|
}); |
| 553 |
|
|
| 554 |
|
push (@cmds, { |
| 555 |
|
setting => 'urifullnsrhssub', |
| 556 |
|
is_priv => 1, |
| 557 |
|
code => sub { |
| 558 |
|
my ($self, $key, $value, $line) = @_; |
| 559 |
|
if ($value =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\d{1,10}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/) { |
| 560 |
|
my $rulename = $1; |
| 561 |
|
my $zone = $2; |
| 562 |
|
my $type = $3; |
| 563 |
|
my $subrule = $4; |
| 564 |
|
$self->{uridnsbls}->{$rulename} = { |
| 565 |
|
zone => $zone, type => $type, |
| 566 |
|
is_fullnsrhsbl => 1, is_subrule => 1 |
| 567 |
|
}; |
| 568 |
|
$self->{uridnsbl_subs}->{$zone} ||= { }; |
| 569 |
|
push (@{$self->{uridnsbl_subs}->{$zone}->{$subrule}->{rulenames}}, $rulename); |
| 570 |
|
} |
| 571 |
|
elsif ($value =~ /^$/) { |
| 572 |
|
return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE; |
| 573 |
|
} |
| 574 |
|
else { |
| 575 |
|
return $Mail::SpamAssassin::Conf::INVALID_VALUE; |
| 576 |
|
} |
| 577 |
|
} |
| 578 |
|
}); |
| 579 |
|
|
| 580 |
|
push (@cmds, { |
| 581 |
setting => 'uridnsbl_skip_domain', |
setting => 'uridnsbl_skip_domain', |
| 582 |
default => {}, |
default => {}, |
| 583 |
code => sub { |
code => sub { |
| 640 |
|
|
| 641 |
my $rhsblrules = $scanner->{uridnsbl_active_rules_rhsbl}; |
my $rhsblrules = $scanner->{uridnsbl_active_rules_rhsbl}; |
| 642 |
my $nsrhsblrules = $scanner->{uridnsbl_active_rules_nsrhsbl}; |
my $nsrhsblrules = $scanner->{uridnsbl_active_rules_nsrhsbl}; |
| 643 |
|
my $fullnsrhsblrules = $scanner->{uridnsbl_active_rules_fullnsrhsbl}; |
| 644 |
my $reviprules = $scanner->{uridnsbl_active_rules_revipbl}; |
my $reviprules = $scanner->{uridnsbl_active_rules_revipbl}; |
| 645 |
|
|
| 646 |
if ($single_dnsbl) { |
if ($single_dnsbl) { |
| 657 |
# perform NS, A lookups to look up the domain in the non-RHSBL subset, |
# perform NS, A lookups to look up the domain in the non-RHSBL subset, |
| 658 |
# but only if there are active reverse-IP-URIBL rules |
# but only if there are active reverse-IP-URIBL rules |
| 659 |
if ($dom !~ /^\d+\.\d+\.\d+\.\d+$/ && |
if ($dom !~ /^\d+\.\d+\.\d+\.\d+$/ && |
| 660 |
(scalar keys %{$reviprules} || scalar keys %{$nsrhsblrules})) |
(scalar keys %{$reviprules} || |
| 661 |
|
scalar keys %{$nsrhsblrules} || |
| 662 |
|
scalar keys %{$fullnsrhsblrules})) |
| 663 |
{ |
{ |
| 664 |
$self->lookup_domain_ns($scanner, $obj, $dom); |
$self->lookup_domain_ns($scanner, $obj, $dom); |
| 665 |
} |
} |
| 697 |
my $IPV4_ADDRESS = IPV4_ADDRESS; |
my $IPV4_ADDRESS = IPV4_ADDRESS; |
| 698 |
my $IP_PRIVATE = IP_PRIVATE; |
my $IP_PRIVATE = IP_PRIVATE; |
| 699 |
my $nsrhsblrules = $scanner->{uridnsbl_active_rules_nsrhsbl}; |
my $nsrhsblrules = $scanner->{uridnsbl_active_rules_nsrhsbl}; |
| 700 |
|
my $fullnsrhsblrules = $scanner->{uridnsbl_active_rules_fullnsrhsbl}; |
| 701 |
|
|
| 702 |
foreach my $rr (@answer) { |
foreach my $rr (@answer) { |
| 703 |
my $str = $rr->string; |
my $str = $rr->string; |
| 707 |
if ($str =~ /IN\s+NS\s+(\S+)/) { |
if ($str =~ /IN\s+NS\s+(\S+)/) { |
| 708 |
my $nsmatch = $1; |
my $nsmatch = $1; |
| 709 |
my $nsrhblstr = $nsmatch; |
my $nsrhblstr = $nsmatch; |
| 710 |
|
my $fullnsrhblstr = $nsmatch; |
| 711 |
|
$fullnsrhblstr =~ s/\.$//; |
| 712 |
|
|
| 713 |
if ($nsmatch =~ /^\d+\.\d+\.\d+\.\d+\.?$/) { |
if ($nsmatch =~ /^\d+\.\d+\.\d+\.\d+\.?$/) { |
| 714 |
$nsmatch =~ s/\.$//; |
$nsmatch =~ s/\.$//; |
| 730 |
|
|
| 731 |
$scanner->register_async_rule_start($rulename); |
$scanner->register_async_rule_start($rulename); |
| 732 |
} |
} |
| 733 |
|
|
| 734 |
|
foreach my $rulename (keys %{$fullnsrhsblrules}) { |
| 735 |
|
my $rulecf = $scanner->{conf}->{uridnsbls}->{$rulename}; |
| 736 |
|
$self->lookup_single_dnsbl($scanner, $ent->{obj}, $rulename, |
| 737 |
|
$fullnsrhblstr, $rulecf->{zone}, $rulecf->{type}); |
| 738 |
|
|
| 739 |
|
$scanner->register_async_rule_start($rulename); |
| 740 |
|
} |
| 741 |
} |
} |
| 742 |
} |
} |
| 743 |
} |
} |
| 869 |
|
|
| 870 |
if ($scanner->{uridnsbl_active_rules_revipbl}->{$rulename} |
if ($scanner->{uridnsbl_active_rules_revipbl}->{$rulename} |
| 871 |
|| $scanner->{uridnsbl_active_rules_nsrhsbl}->{$rulename} |
|| $scanner->{uridnsbl_active_rules_nsrhsbl}->{$rulename} |
| 872 |
|
|| $scanner->{uridnsbl_active_rules_fullnsrhsbl}->{$rulename} |
| 873 |
|| $scanner->{uridnsbl_active_rules_rhsbl}->{$rulename}) |
|| $scanner->{uridnsbl_active_rules_rhsbl}->{$rulename}) |
| 874 |
{ |
{ |
| 875 |
# TODO: this needs to handle multiple domain hits per rule |
# TODO: this needs to handle multiple domain hits per rule |