Skip to main content

DNSXL

DNSbl (DNS block list) and DNSwl (DNS white list) are DNS based services used to identify IP addresses flagged for email spam. This plugin enables interaction with both lists by querying the desiered DNS.

Usage

In this example, we will setup the plugin to be used in the SMTP SMTP Receiver service. First, create a handle to the desired csv file.

// /etc/vsmtp/smtp-receiver/services/bl.rhai
// Import the plugin stored in the `plugins` directory.
import "plugins/libvsmtp_plugin_dnsxl" as dnsxl;

export const spamhaus = dnsxl::build(#{
// Desiered block lists we want to query.
bl: ["spamhaus"]
});

Then, query the block list in your rules.

import "services/bl" as bl;

fn on_connect(ctx) {
ctx.run([
action "checking if my ip is blacklisted" || {
let res = bl::spamhaus.contains("x.x.x.x");
// Checking if a map is returned to see if the IP was found in the provided blacklist.
if (res != ()) {
log("info", "IP x.x.x.x is blacklisted");
// Let's take a look at the return records.
for record in res["spamhaus"] {
log("info", `code -> ${record}`);
}
}
}
]);
}