Changeset 8
- Timestamp:
- 02/04/05 07:05:59
- Files:
-
- trunk/plugins/dnsbl/dnsbl.pl (modified) (6 diffs)
- trunk/plugins/dnsbl/tmpl/dnsbl.tmpl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plugins/dnsbl/dnsbl.pl
r5 r8 45 45 proxycheck_enabled proxycheck_moderate proxycheck_ports 46 46 caching_enabled cache_limit 47 headers_enabled headers_moderate 47 headers_enabled headers_moderate headers_ignore 48 48 ); 49 49 } … … 68 68 sub default_domainbl_services { 69 69 'bsb.empty.us sc.surbl.org'; 70 } 71 72 sub default_headers_ignore { 73 '127.0.0.1 10. 192.168. 172.16. 172.17. 172.18. 172.19. 172.20. 172.21. 172.22. 172.23. 172.24. '. 74 '172.25. 172.26. 172.27. 172.28. 172.29. 172.30. 172.31.'; 70 75 } 71 76 … … 90 95 $data->{headers_enabled} = 0 unless exists $data->{headers_enabled}; 91 96 $data->{headers_moderate} = 1 unless exists $data->{headers_moderate}; 97 $data->{headers_ignore} = default_headers_ignore() 98 unless exists $data->{headers_ignore}; 92 99 $data->{proxycheck_enabled} = 0 unless exists $data->{proxycheck_enabled}; 93 100 $data->{proxycheck_moderate} = 1 unless exists $data->{proxycheck_moderate}; … … 241 248 my $ua = LWP::UserAgent->new( 242 249 # timeout after 5 seconds 243 timeout => 5,244 # become IE245 agent => q{Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)}250 timeout => 5, 251 # become IE 252 agent => q{Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)} 246 253 ); 247 254 my @ports = split /\s+/, $data->{proxycheck_ports}; … … 276 283 277 284 my $proxy = $app->get_header(qq{X-Forwarded-For}); 278 if (defined($proxy) && length($proxy)) { 279 #$app->log(qq{*** --> bingo ($proxy)}) if (LOG_DEBUG); 285 # extract list of IPs from header-value (yes, I've seen them 286 # separated by commas and/or whitespaces) 287 my @ips = split /[\s,]+/, $proxy; 288 my @headers_ignore = split /\s+/, $data->{headers_ignore}; 289 if(scalar(@headers_ignore)) { 290 # build regular expression 291 my $ignore_re = qq{^(}.join("|",@headers_ignore).qq{)}; 292 $ignore_re =~ s/\./\\\./g; 293 # extract list of IPs from header-value 294 @ips = grep {!/$ignore_re/} @ips; 295 } 296 297 if (scalar(@ips)) { 280 298 # if we have a X-Forwarded-For header, it was most likely 281 299 # added by the system that sent the request … … 284 302 . ' based on X-Forwarded-For header "'. $proxy); 285 303 return $data->{headers_moderate} ? MODERATE : BLOCK; 286 }287 return IGNORE;304 } 305 return IGNORE; 288 306 } 289 307 trunk/plugins/dnsbl/tmpl/dnsbl.tmpl
r4 r8 42 42 <input type="radio" name="headers_moderate" value="0" <TMPL_UNLESS NAME=HEADERS_MODERATE>checked="checked"</TMPL_UNLESS> /> Block on a match<br /> 43 43 <input type="radio" name="headers_moderate" value="1" <TMPL_IF NAME=HEADERS_MODERATE>checked="checked"</TMPL_IF> /> Moderate on a match 44 <p>Ignore the following IP addresses</p> 45 <textarea name="headers_ignore" id="headers_ignore" cols="50" rows="4"><TMPL_VAR NAME=HEADERS_IGNORE ESCAPE=HTML></textarea> 44 46 </div> 45 47 … … 73 75 <textarea name="proxycheck_ports" id="proxycheck_ports" cols="50" rows="4"><TMPL_VAR NAME=PROXYCHECK_PORTS ESCAPE=HTML></textarea> 74 76 </div> 77 78 <hr /> 75 79 76 80 <input onclick="toggle(this, 'caching_prefs')" value="1" type="checkbox" name="caching_enabled" id="caching_enabled" <TMPL_IF NAME=CACHING_ENABLED>checked="checked"</TMPL_IF> /><label for="caching_enabled">Enable caching of IP proxy tests</label><br />
