Skip to content
Snippets Groups Projects
Commit 66782922 authored by Georg Sauthoff's avatar Georg Sauthoff
Browse files

blacklist blocklist for ipv6

parent bc68faed
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,9 @@ import sys ...@@ -16,6 +16,9 @@ import sys
import time import time
ipv6_incapable = { 'bl.0spam.org', 'rbl.0spam.org', 'nbl.0spam.org' }
default_blacklists = [ default_blacklists = [
('zen.spamhaus.org' , 'Spamhaus SBL, XBL and PBL' , 'https://www.spamhaus.org' ), ('zen.spamhaus.org' , 'Spamhaus SBL, XBL and PBL' , 'https://www.spamhaus.org' ),
('dnsbl.sorbs.net' , 'SORBS aggregated' , 'http://www.sorbs.net' ), ('dnsbl.sorbs.net' , 'SORBS aggregated' , 'http://www.sorbs.net' ),
...@@ -394,6 +397,8 @@ def check_dnsbl(addr, bl): ...@@ -394,6 +397,8 @@ def check_dnsbl(addr, bl):
def check_rdns(addrs): def check_rdns(addrs):
errs = 0 errs = 0
for (addr, domain) in addrs: for (addr, domain) in addrs:
if domain is None:
continue
log.debug('Check if there is a reverse DNS record that maps address {} to {}' log.debug('Check if there is a reverse DNS record that maps address {} to {}'
.format(addr, domain)) .format(addr, domain))
try: try:
...@@ -449,6 +454,9 @@ def check_bls(addrs, bls, dest, retries): ...@@ -449,6 +454,9 @@ def check_bls(addrs, bls, dest, retries):
t = max(i * 23 - max(now - ts, 0), 0) t = max(i * 23 - max(now - ts, 0), 0)
time.sleep(t) time.sleep(t)
try: try:
if ':' in addr and bl[0] in ipv6_incapable:
log.debug(f"Ignoring {bl[0]} because it doesn't support IPv6 ({addr})")
continue
log.debug(f'Checking if address {addr} (via {dest}) is listed in {bl[0]} ({bl[1]})') log.debug(f'Checking if address {addr} (via {dest}) is listed in {bl[0]} ({bl[1]})')
s = check_dnsbl(addr, bl[0]) s = check_dnsbl(addr, bl[0])
if s: if s:
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
%endif %endif
Name: gms-utils Name: gms-utils
Version: 0.6.2 Version: 0.6.3
Release: 1%{?dist} Release: 1%{?dist}
Summary: Collection of command line utilities Summary: Collection of command line utilities
URL: https://github.com/gsauthof/utility URL: https://github.com/gsauthof/utility
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment