I receivedo off-list question about using Spamhaus DQS (rather than
zen.spamhaus.org mentioned in the example below) due to upcoming
Spamhaus changes:

https://www.spamhaus.org/resource-hub/email-security/query-the-legacy-dnsbls-via-hetzner/

I'd like to make it clear that posted configuraiton is just example
for a common use-case: users should add their ip addresses to monitor
in the 'addresses' list, and zones they wish to query in the 'zones'
list -- adding or removing entries as needd.

Alerts sent by local sendmail is also the most simple
configuration. It is possible to use SMTP, Matrix or call HTTP API as
mentioned in https://uptime.is/pyng/#alerts.

I do not want to pollute the list with my stuff, but am happy to
answer any questions either off-list, or on IRC on #twisted at
libera.chat.

So in order to use DQS, one could use '<key>.sbl-xbl.dq.spamhaus.net',
which would make the example even simpler:

<conf>
# -*- python -*-

# set correct addresses here -- adjust as needed
pager = SendmailPager(
    sender='RBL ALERT <postmaster@whatever>',
    target='postmaster@whatever',
)

# ip addresses to monitor -- adjust as needed
addresses = [
    '127.0.0.1',
]

# DNSBL zones to query -- adjust as needed
zones = [
    'truncate.gbudb.net',
    # if using DQS, remember to obtain a key
    '<key>.sbl-xbl.dq.spamhaus.net',
    'b.barracudacentral.org',
    'ix.dnsbl.manitu.net',
    'spamsources.fabel.dk',
    'bl.mailspike.net',
    'bl.mxrbl.com',
    'psbl.surriel.com',
    'bl.spamcop.net',
    'bip.virusfree.cz',
    'bad.virusfree.cz',
]

checks = []
for a in addresses:
    for z in zones:
        c = DNSL(
            a,  # address
            z,  # zone
            server='localhost', # resolver to query -- adjust as needed
            interval=900, # check every 900 seconds -- adjust as needed
            alert=pager.alert(),
            desc=f'{a} (RBL: {z})',
        )
        checks.append(c)
</conf>


• Kirill Miazine via mailop [2025-02-04 17:27]:
> Hi, mailops
> 
> I finished writing docs for my local monitoring and alerting system Pyng:
> https://uptime.is/pyng/
> 
> One of the checks, DNSL - https://uptime.is/pyng/DNSL.html, is created for
> RBL monitoring, and I'd like to share an working configuration to monitor
> many zones for many addresses.
> 
> Pyng requies Python and Twisted, and DNSL check requires drill command.
> Sendmail pager is using, well, sendmail.  The configuration is self
> explanatory.
> 
> <conf>
> # -*- python -*-
> 
> pager = SendmailPager(
>     sender='RBL ALERT <postmaster@whatever>',
>     target='postmaster@whatever',
> )
> 
> addresses = [
>     '127.0.0.1',
> ]
> 
> zones = [
>     'truncate.gbudb.net',
>     'zen.spamhaus.org',
>     'b.barracudacentral.org',
>     'ix.dnsbl.manitu.net',
>     'spamsources.fabel.dk',
>     'bl.mailspike.net',
>     'bl.mxrbl.com',
>     'psbl.surriel.com',
>     'bl.spamcop.net',
>     'bip.virusfree.cz',
>     'bad.virusfree.cz',
> ]
> 
> 
> checks = []
> for a in addresses:
>     for z in zones:
>         c = DNSL(
>             a,  # address
>             z,  # zone
>             server='localhost',  # query local resolver
>             interval=900,  # check every 900 seconds
>             alert=pager.alert(),
>             desc=f'{a} (RBL: {z})',
>         )
>         if z == 'zen.spamhaus.org':  # ignore Spamhaus PBL
>             c.result = {'127.0.0.10', '127.0.0.11'}
>         checks.append(c)
> </conf>
> _______________________________________________
> mailop mailing list
> [email protected]
> https://list.mailop.org/listinfo/mailop

-- 
    -- Kirill Miazine <[email protected]>
_______________________________________________
mailop mailing list
[email protected]
https://list.mailop.org/listinfo/mailop

Reply via email to