Luzilla / dnsbl_exporter

Prometheus compatible exporter to query DNSBLs/RBLs.
https://www.luzilla-capital.com/
Other
30 stars 8 forks source link

Fix loop over targets of all hosts #193

Closed s-diez closed 8 months ago

s-diez commented 8 months ago

Hi,

the refactor commit e88b79f contains an error and only iterates over the targets of the first resolved hostname. This can easily be tested with make run-dev. I hope the somewhat larger refactoring is fine with you.

till commented 8 months ago

Thanks for the contribution, can you check the linter? I'll test it this week as well.

s-diez commented 8 months ago

The linter should be fixed now.

till commented 8 months ago

@s-diez so the problem was if you add multiple targets, it would only check the first host?

s-diez commented 8 months ago

@s-diez so the problem was if you add multiple targets, it would only check the first host?

Exactly. These are the metrics from make run-dev

Current main branch:

luzilla_rbls_ips_blacklisted{hostname="smtp.gmail.com",ip="142.250.27.109",rbl="ix.dnsbl.manitu.net"} 0
luzilla_rbls_ips_blacklisted{hostname="smtp.gmail.com",ip="142.250.27.109",rbl="zen.spamhaus.org"} 0

With my changes:

luzilla_rbls_ips_blacklisted{hostname="mail.gmx.net",ip="212.227.17.168",rbl="ix.dnsbl.manitu.net"} 0
luzilla_rbls_ips_blacklisted{hostname="mail.gmx.net",ip="212.227.17.168",rbl="zen.spamhaus.org"} 0
luzilla_rbls_ips_blacklisted{hostname="mail.gmx.net",ip="212.227.17.190",rbl="ix.dnsbl.manitu.net"} 0
luzilla_rbls_ips_blacklisted{hostname="mail.gmx.net",ip="212.227.17.190",rbl="zen.spamhaus.org"} 0
luzilla_rbls_ips_blacklisted{hostname="mail.messagingengine.com",ip="103.168.172.36",rbl="ix.dnsbl.manitu.net"} 0
luzilla_rbls_ips_blacklisted{hostname="mail.messagingengine.com",ip="103.168.172.36",rbl="zen.spamhaus.org"} 0
luzilla_rbls_ips_blacklisted{hostname="mail.messagingengine.com",ip="103.168.172.51",rbl="ix.dnsbl.manitu.net"} 0
luzilla_rbls_ips_blacklisted{hostname="mail.messagingengine.com",ip="103.168.172.51",rbl="zen.spamhaus.org"} 0
luzilla_rbls_ips_blacklisted{hostname="smtp.fastmail.com",ip="103.168.172.45",rbl="ix.dnsbl.manitu.net"} 0
luzilla_rbls_ips_blacklisted{hostname="smtp.fastmail.com",ip="103.168.172.45",rbl="zen.spamhaus.org"} 0
luzilla_rbls_ips_blacklisted{hostname="smtp.fastmail.com",ip="103.168.172.60",rbl="ix.dnsbl.manitu.net"} 0
luzilla_rbls_ips_blacklisted{hostname="smtp.fastmail.com",ip="103.168.172.60",rbl="zen.spamhaus.org"} 0
luzilla_rbls_ips_blacklisted{hostname="smtp.gmail.com",ip="142.250.27.109",rbl="ix.dnsbl.manitu.net"} 0
luzilla_rbls_ips_blacklisted{hostname="smtp.gmail.com",ip="142.250.27.109",rbl="zen.spamhaus.org"} 0
till commented 8 months ago

Thank you! 🙏 I see I screwed this up with the refactoring. Do you think we can add an additional test?

s-diez commented 8 months ago

Thank you! 🙏 I see I screwed this up with the refactoring. Do you think we can add an additional test?

Looking into it. Looks like it should be testable.

till commented 8 months ago

@s-diez @torvitas Thank you very much for this! :)

s-diez commented 8 months ago

@till Thanks for the project and the fast responses