BSNSoft · Domain Reputation
Integration

Integrate the reputation service in your mail filter

Classic DNSBL at dnsbl.bsnsoft-hostings.de for sender domains and uri.dnsbl.bsnsoft-hostings.de for the domains of links in the body. HTTP API available as an alternative transport.

Rate limits & registration

Queries are rate-limited per source IP (the IP we see — not your mailserver, but the DNS resolver it uses):

TierLimitOver-limit behaviour
Free / unregistered100 queries/hour per IP (hard limit)No answer (NXDOMAIN, silent drop)
Registered (sign up free)1,000 queries/hour per verified IP, up to 5 IPs, 5,000/day (fair use)Still answered, only flagged — dashboard shows a hint after first overage
Mini / Pro (pricing)2,000 / 5,000 queries/hour per IP, 50,000 / 250,000 per day, fixed for the term (fair use)Still answered, only flagged; email when the daily limit is exceeded
Business / OEMIndividual volumesOn request — info@bsnsoft.de
⚠ Important: open resolvers fall into the free tier!

If your mailserver uses a public resolver like 8.8.8.8, 1.1.1.1, or 9.9.9.9 as DNS forwarder, we see the resolver's IP — shared with thousands of other users. That traffic hits the 100/hour free-tier limit collectively, and you get silently dropped. Fix:

Classification

The service answers with one of five classifications, encoded in the DNS return code:

ScoreClassSymbolDNS returnRecommended weight
9TOPBSN_REP_TOP127.0.0.0−2.0 (bonus)
7–8HIGHBSN_REP_HIGH127.0.0.[1-2]−0.5 (small bonus)
4–6MEDIUMBSN_REP_MEDIUM127.0.0.[3-5]+1.0
2–3LOWBSN_REP_LOW127.0.0.[6-7]+4.0
0–1BADBSN_REP_BAD127.0.0.[8-9]+6.0

With an RSpamD reject threshold of 12, our maximum contribution (+6.0) stays below half – our signal alone never rejects a message; only in combination with another indicator (DMARC fail, Bayes, IP RBL, …).

Two zones: sender domains and link domains

ZoneQuery nameUse for
dnsbl.bsnsoft-hostings.de<domain>.dnsbl.bsnsoft-hostings.deSender domains (From:, envelope sender) and reversed IPs
uri.dnsbl.bsnsoft-hostings.de<domain>.uri.dnsbl.bsnsoft-hostings.deDomains of links in the message body (rspamd rbl module with urls, SpamAssassin URIDNSBL)

Both zones return the same scores with the same encoding, and queries to both count against the same rate limit. One difference: a domain that does not exist in DNS (NXDOMAIN) is BAD in the sender zone, since mail claiming to come from it is worthless. In the link zone it is not listed (NXDOMAIN): mail filters also take file names such as manage.py or notes.md and similar text fragments for link domains whenever the ending happens to be a real top-level domain (.py is Paraguay, .md Moldova). A domain rated BAD for other reasons is BAD in the link zone as well. If you check body links against dnsbl.bsnsoft-hostings.de today, switch those rules to the link zone.

RSpamD · Lua plugin (recommended)

Looks up the domain in the From: header via our DNSBL. Small Lua file, loaded once, runs for every message. A good reputation (TOP/HIGH) only earns its bonus when the From domain is authenticated (DMARC pass, or aligned DKIM/SPF), so forged senders never profit from a brand's reputation. Penalties (MEDIUM/LOW/BAD) always apply. We check the From domain rather than the envelope sender because newsletters and transactional mail usually go out via the bounce domain of a mailing service, which tells you nothing about the sender.

If the zone has never seen a domain, the plugin defers the message once (soft reject, your MTA answers with a 4xx). The zone scores the domain within seconds of the first query, so the sender's retry already gets the score and the first wave from a fresh throwaway domain no longer slips through unscored. How long a message waits depends on the sender's retry interval. A domain is only deferred within two minutes of its first contact; after that mail passes even if the domain is still unknown. Names the zone never scores because they are on the Public Suffix List (for example myfritz.net or eu.org) get an empty answer instead of NXDOMAIN, so mail from them is never deferred. rspamd still runs all other checks while it defers, so clear spam is rejected right away. Set DEFER_UNKNOWN = false at the top of the file to only label, and always if your MTA only reads rspamd's score and ignores its action (for example Proxmox Mail Gateway with rspamd as custom check, see below).

Deferring needs three things: a registered resolver IP (without an account the zone answers NXDOMAIN above 100 queries per hour), an MTA that turns rspamd's soft reject into a 4xx (the rspamd milter does this by default; with Exim's spam ACL add a defer for $spam_action = soft reject), and a resolver that does not hold the answer "unknown" for long. If you raised cache-min-ttl in Unbound, exclude our zone with a stub-zone and stub-no-cache: yes. Redis is optional: the plugin uses rspamd's Redis settings to remember first contacts across workers and keeps daily counters in bsnrep:stat:YYYYMMDD.

Step 1 – save as /etc/rspamd/lua.local.d/bsn_reputation.lua. Rspamd loads every *.lua file in lua.local.d on its own, no further include needed:

-- BSNSoft domain reputation (dnsbl.bsnsoft-hostings.de), version 2026-11-13.2
-- Checks the domain in the From: header (the brand DMARC aligns to), not the
-- envelope sender (for newsletters usually the bounce domain of a mailing service).
-- Bonus (TOP/HIGH) only if the From domain is authenticated: DMARC pass, or a valid
-- DKIM signature / SPF pass aligned (relaxed) with it. Forged senders get no bonus.
-- Penalties (MEDIUM/LOW/BAD) always apply.

-- Settings -----------------------------------------------------------------------
-- DEFER_UNKNOWN: if the zone has never seen the From domain, defer the message once
-- (soft reject, your MTA answers 4xx). The zone scores the domain within seconds, so
-- the sender's retry gets the score. DEFER_WINDOW is not a delay: it is the time after
-- the first contact with a domain during which mail from it may be deferred. After that
-- mail passes even if the domain is still unknown (e.g. it could not be scored).
-- rspamd still runs all other checks, so the score stays complete and clear spam is
-- rejected right away instead of deferred.
-- Set to false to only label, and always if your MTA ignores rspamd's soft reject and
-- only reads the score (e.g. Proxmox Mail Gateway with rspamd as custom check). Use true
-- only with a registered resolver IP: without an account the zone answers NXDOMAIN above
-- 100 queries per hour.
local DEFER_UNKNOWN = true
local DEFER_WINDOW  = 120
-- ---------------------------------------------------------------------------------

local rspamd_logger = require "rspamd_logger"
local rspamd_util = require "rspamd_util"
local lua_redis = require "lua_redis"
local N = "bsn_reputation"
local RBL = "dnsbl.bsnsoft-hostings.de"
local MEMO_TTL = 86400      -- how long the first contact of a domain is remembered
local STAT_TTL = 2678400    -- daily counters bsnrep:stat:YYYYMMDD in Redis, 31 days
local DEFER_MESSAGE = "Sender domain is being checked, please try again later"
local NXDOMAIN_ERR = "no records with this name"

local SCORES = {
  BSN_REP_TOP     = -2.0,
  BSN_REP_HIGH    = -0.5,
  BSN_REP_MEDIUM  =  1.0,
  BSN_REP_LOW     =  4.0,
  BSN_REP_BAD     =  6.0,
  BSN_REP_NOAUTH  =  0.0,  -- good reputation, From domain not authenticated: no bonus
  BSN_REP_UNKNOWN =  0.0,  -- domain not yet known to the zone: deferred or passed
}

-- Redis: remember the first contact, count, list deferred domains. Returns 1 = defer.
local UNKNOWN_SCRIPT = [=[
local first = redis.call('GET', KEYS[1])
if not first then
  redis.call('SET', KEYS[1], ARGV[1], 'EX', ARGV[2])
  first = ARGV[1]
end
redis.call('HINCRBY', KEYS[2], 'unknown', 1)
redis.call('EXPIRE', KEYS[2], ARGV[5])
if tonumber(ARGV[1]) - tonumber(first) < tonumber(ARGV[3]) then
  redis.call('HINCRBY', KEYS[2], 'deferred', 1)
  redis.call('SADD', KEYS[3], ARGV[4])
  redis.call('EXPIRE', KEYS[3], ARGV[5])
  return 1
end
redis.call('HINCRBY', KEYS[2], 'passed_window', 1)
return 0
]=]

-- Redis: once per domain, count the class a previously unknown domain ended up in.
local KNOWN_SCRIPT = [=[
if redis.call('EXISTS', KEYS[1]) == 1 and redis.call('SET', KEYS[3], '1', 'NX', 'EX', ARGV[2]) then
  redis.call('HINCRBY', KEYS[2], 'after_' .. ARGV[1], 1)
  redis.call('EXPIRE', KEYS[2], ARGV[3])
  return 1
end
return 0
]=]

-- Uses the Redis servers from rspamd's global redis settings, if any.
-- Without Redis the first contact is remembered per worker process.
local redis_params, unknown_script_id, known_script_id
if DEFER_UNKNOWN then
  redis_params = lua_redis.parse_redis_server(N)
  if redis_params then
    unknown_script_id = lua_redis.add_redis_script(UNKNOWN_SCRIPT, redis_params)
    known_script_id = lua_redis.add_redis_script(KNOWN_SCRIPT, redis_params)
  end
end
local memo, memo_size = {}, 0

local function day()
  return os.date("!%Y%m%d")
end

local function same_org(a, b)
  if not a or not b or a == "" or b == "" then return false end
  return rspamd_util.strequal_caseless(rspamd_util.get_tld(a), rspamd_util.get_tld(b))
end

local function authenticated(task, domain, source)
  if source == "mime" and task:has_symbol("DMARC_POLICY_ALLOW") then return true end
  local smtp = ((task:get_from("smtp") or {})[1] or {}).domain
  if not smtp or smtp == "" then smtp = task:get_helo() end
  if task:has_symbol("R_SPF_ALLOW") and same_org(smtp, domain) then return true end
  if source == "mime" then
    local trace = task:get_symbol("DKIM_TRACE")
    local opts = trace and trace[1] and trace[1].options
    for _, opt in ipairs(opts or {}) do
      if string.sub(opt, -1) == "+" and same_org(string.sub(opt, 1, -3), domain) then return true end
    end
  end
  return false
end

-- Never defer authenticated users, local senders or mail another module already decided.
local function may_defer(task)
  if not DEFER_UNKNOWN then return false end
  if task:get_user() then return false end
  local ip = task:get_from_ip()
  if not ip or not ip:is_valid() or ip:is_local() then return false end
  if task.has_pre_result and task:has_pre_result() then return false end
  return true
end

-- "least": soft reject is the minimum action. rspamd keeps evaluating the other rules,
-- and if the full score calls for reject, reject wins.
local function defer(task, domain)
  task:insert_result("BSN_REP_UNKNOWN", 1.0, domain, "deferred")
  task:set_pre_result({ action = "soft reject", message = DEFER_MESSAGE, module = N, flags = "least" })
end

local function handle_unknown(task, domain)
  if not DEFER_UNKNOWN then
    task:insert_result("BSN_REP_UNKNOWN", 1.0, domain, "label-only")
    return
  end
  if not may_defer(task) then
    task:insert_result("BSN_REP_UNKNOWN", 1.0, domain, "not-deferrable")
    return
  end
  local now = math.floor(rspamd_util.get_time())

  if not unknown_script_id then
    local first = memo[domain]
    if not first or now - first >= MEMO_TTL then
      if memo_size > 50000 then memo, memo_size = {}, 0 end
      if not first then memo_size = memo_size + 1 end
      memo[domain] = now
      first = now
    end
    if now - first < DEFER_WINDOW then
      defer(task, domain)
    else
      task:insert_result("BSN_REP_UNKNOWN", 1.0, domain, "window-expired")
    end
    return
  end

  local d = day()
  lua_redis.exec_redis_script(unknown_script_id,
    { task = task, is_write = true, key = "bsnrep:first:" .. domain },
    function(err, data)
      if err then  -- Redis trouble: let the mail pass
        rspamd_logger.infox(task, "%s: redis error for %s, mail passes: %s", N, domain, err)
        task:insert_result("BSN_REP_UNKNOWN", 1.0, domain, "redis-error")
        return
      end
      if tonumber(data) == 1 then
        defer(task, domain)
      else
        task:insert_result("BSN_REP_UNKNOWN", 1.0, domain, "window-expired")
      end
    end,
    { "bsnrep:first:" .. domain, "bsnrep:stat:" .. d, "bsnrep:deferred:" .. d },
    { tostring(now), tostring(MEMO_TTL), tostring(DEFER_WINDOW), domain, tostring(STAT_TTL) })
end

local function note_known(task, domain, sym)
  if not known_script_id then return end
  lua_redis.exec_redis_script(known_script_id,
    { task = task, is_write = true, key = "bsnrep:first:" .. domain },
    function() end,
    { "bsnrep:first:" .. domain, "bsnrep:stat:" .. day(), "bsnrep:done:" .. domain },
    { string.sub(sym, 9), tostring(MEMO_TTL), tostring(STAT_TTL) })
end

local function reputation_cb(task)
  local source = "mime"
  local from = task:get_from("mime")
  if not from or not from[1] or not from[1]["domain"] or from[1]["domain"] == "" then
    source = "smtp"
    from = task:get_from("smtp")
  end
  if not from or not from[1] then return false end
  local domain = (from[1]["domain"] or ""):lower()
  if domain == "" then return false end

  local resolver = task:get_resolver()
  if not resolver then return false end

  resolver:resolve_a({
    task = task,
    name = domain .. "." .. RBL,
    callback = function(_, _, results, err)
      if err then
        -- only a clean NXDOMAIN means "unknown"; timeouts and errors never defer
        if err == NXDOMAIN_ERR then handle_unknown(task, domain) end
        return
      end
      if not results or #results == 0 then return end
      local last = tonumber(tostring(results[1]):match("%.(%d+)$"))
      if not last then return end
      local sym
      if     last == 0 then sym = "BSN_REP_TOP"
      elseif last <= 2 then sym = "BSN_REP_HIGH"
      elseif last <= 5 then sym = "BSN_REP_MEDIUM"
      elseif last <= 7 then sym = "BSN_REP_LOW"
      else                  sym = "BSN_REP_BAD"
      end
      note_known(task, domain, sym)
      if (sym == "BSN_REP_TOP" or sym == "BSN_REP_HIGH") and not authenticated(task, domain, source) then
        task:insert_result("BSN_REP_NOAUTH", 1.0, domain, sym)
        return
      end
      task:insert_result(sym, 1.0, domain, source)
    end,
  })
  return false
end

local id = rspamd_config:register_symbol({
  name = "BSN_REPUTATION_CHECK", type = "callback", callback = reputation_cb,
})
for sub, sc in pairs(SCORES) do
  rspamd_config:register_symbol({ name = sub, type = "virtual", parent = id, group = N, score = sc })
end
-- run after SPF, DKIM and DMARC so their results are available
for _, dep in ipairs({"SPF_CHECK", "DKIM_CHECK", "DMARC_CHECK"}) do
  rspamd_config:register_dependency("BSN_REPUTATION_CHECK", dep)
end
rspamd_logger.infox(rspamd_config, "%s: loaded (zone=%s, defer unknown domains: %s, redis: %s)",
  N, RBL, DEFER_UNKNOWN and ("on, window " .. DEFER_WINDOW .. " s") or "off", unknown_script_id and "yes" or "no")

Step 2 – set the weights in /etc/rspamd/local.d/groups.conf (append the block if the file already exists). The plugin ships the same values as defaults; this group overrides them and gives the symbols a description in the web UI:

group "bsn_reputation" {
    description = "BSNSoft domain reputation of the From domain";
    symbols {
        "BSN_REP_TOP"    { weight = -2.0; description = "Top reputation, From domain authenticated"; }
        "BSN_REP_HIGH"   { weight = -0.5; description = "Strong reputation, From domain authenticated"; }
        "BSN_REP_MEDIUM" { weight =  1.0; description = "Neutral or unclear reputation"; }
        "BSN_REP_LOW"    { weight =  4.0; description = "Weak reputation"; }
        "BSN_REP_BAD"    { weight =  6.0; description = "Throwaway or spam infrastructure"; }
        "BSN_REP_NOAUTH" { weight =  0.0; description = "Good reputation, From domain not authenticated: no bonus"; }
        "BSN_REP_UNKNOWN" { weight = 0.0; description = "From domain not yet known to the zone: deferred or passed"; }
    }
}

Step 3 – check the configuration, then restart. Restart only if the check prints syntax OK:

rspamadm configtest && systemctl restart rspamd

Rspamd logs bsn_reputation: loaded once at startup. Verify with:

printf "From: t@heise.de\nTo: r@x.de\nSubject: t\n\nbody\n" | \
  rspamc -F "t@heise.de" | grep BSN_REP

This hand-made test mail carries no DKIM signature and no sending IP, so a well-known domain shows up as BSN_REP_NOAUTH (no bonus). Real, authenticated mail from the same domain gets BSN_REP_TOP; you can simulate that by adding -i <IP> with an address from the domain's SPF record.

Upgrading an older installation? Earlier versions of this guide put the plugin in /etc/rspamd/local.d/, loaded it with a dofile(…) line in /etc/rspamd/rspamd.local.lua and set the weights in /etc/rspamd/local.d/scores.conf. Move the plugin to lua.local.d and delete the dofile line, otherwise it is loaded twice. Rspamd does not read local.d/scores.conf, so weights there never took effect: move them into groups.conf as shown above. Then run step 3. Coming from version 2026-11-06: replace the file, add the BSN_REP_UNKNOWN line to groups.conf and run step 3. Coming from version 2026-11-13: replace the file. That version stopped rspamd's other checks when it deferred a message, so an MTA that ignores the soft reject only saw a partial score; 2026-11-13.2 keeps the score complete.

RSpamD · rbl module (optional, for body-URLs)

The Lua plugin above covers sender-domain reputation. If you additionally want to match domains that appear as URLs inside the body text, add the native rbl module on top, querying the link zone uri.dnsbl.bsnsoft-hostings.de (see Two zones). Be careful not to set weights that double-count between sender-based (Lua) and URL-based (rbl) hits.

File /etc/rspamd/local.d/rbl.conf:

rbls {
  bsnsoft_reputation_urls {
    symbol = "BSN_URL_REPUTATION";
    rbl = "uri.dnsbl.bsnsoft-hostings.de";
    checks = ["urls", "content_urls"];
    emails_domainonly = true;
    unknown = false;
    returncodes {
      BSN_URL_TOP    = "127.0.0.0";
      BSN_URL_HIGH   = "127.0.0.[1-2]";
      BSN_URL_MEDIUM = "127.0.0.[3-5]";
      BSN_URL_LOW    = "127.0.0.[6-7]";
      BSN_URL_BAD    = "127.0.0.[8-9]";
    }
  }
}

Separate symbol names (BSN_URL_*) prevent double-scoring with the Lua sender-check (BSN_REP_*). Typical weights: use smaller numbers for URL hits, since most legit mails contain URLs to mid-reputation domains (shorteners, trackers).

Weights in /etc/rspamd/local.d/groups.conf (next to the bsn_reputation group). Links to good domains earn no bonus, because anyone can put them into a spam mail:

group "bsn_reputation_urls" {
    description = "BSNSoft domain reputation of URLs in the message body";
    symbols {
        "BSN_URL_TOP"    { weight = 0.0; description = "URL domain: top reputation"; }
        "BSN_URL_HIGH"   { weight = 0.0; description = "URL domain: strong reputation"; }
        "BSN_URL_MEDIUM" { weight = 0.0; description = "URL domain: neutral or unclear reputation"; }
        "BSN_URL_LOW"    { weight = 1.5; description = "URL domain: weak reputation"; }
        "BSN_URL_BAD"    { weight = 3.0; description = "URL domain: throwaway or spam infrastructure"; }
    }
}

Apply changes with rspamadm configtest && systemctl reload rspamd.

SpamAssassin · AskDNS (Postfix + amavis)

The zone answers in graded form: the last octet is 9 − score, so 127.0.0.0 means TOP and 127.0.0.9 means BAD (see Classification above). Every answer is a valid A record, including the good ones. Two traps when you set this up in SpamAssassin:

Sender-domain lookup via the AskDNS plugin (SpamAssassin 3.4 or later). Make sure it is loaded: loadplugin Mail::SpamAssassin::Plugin::AskDNS in /etc/spamassassin/v340.pre (active by default on most distributions). _AUTHORDOMAIN_ is the domain of the From: header. Save as /etc/spamassassin/bsn_reputation.cf:

ifplugin Mail::SpamAssassin::Plugin::AskDNS

askdns   BSN_REP_TOP    _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.0$/
describe BSN_REP_TOP    Sender domain: top reputation (BSNSoft)
tflags   BSN_REP_TOP    net nice
score    BSN_REP_TOP    -0.8

askdns   BSN_REP_HIGH   _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[12]$/
describe BSN_REP_HIGH   Sender domain: high reputation (BSNSoft)
tflags   BSN_REP_HIGH   net nice
score    BSN_REP_HIGH   -0.2

askdns   BSN_REP_MEDIUM _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[345]$/
describe BSN_REP_MEDIUM Sender domain: medium reputation (BSNSoft)
tflags   BSN_REP_MEDIUM net
score    BSN_REP_MEDIUM 0.4

askdns   BSN_REP_LOW    _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[67]$/
describe BSN_REP_LOW    Sender domain: low reputation (BSNSoft)
tflags   BSN_REP_LOW    net
score    BSN_REP_LOW    1.7

askdns   BSN_REP_BAD    _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[89]$/
describe BSN_REP_BAD    Sender domain: bad reputation (BSNSoft)
tflags   BSN_REP_BAD    net
score    BSN_REP_BAD    2.5

endif

The weights are the rspamd weights above, scaled to SpamAssassin's default threshold of 5 (rspamd: reject at 12). As with rspamd, our maximum contribution (+2.5) stays at half the threshold – our signal alone never marks a message as spam.

Optional: domains in body URIs

To also check domains that appear as links in the body, add a URIDNSBL rule on the link zone uri.dnsbl.bsnsoft-hostings.de (see Two zones: file names that SpamAssassin reads as link domains are not listed there). Match only the BAD range and keep the weight small, since most legit mails link to mid-reputation domains (shorteners, trackers):

ifplugin Mail::SpamAssassin::Plugin::URIDNSBL

urirhssub BSN_URI_BAD uri.dnsbl.bsnsoft-hostings.de. A 127.0.0.8-127.0.0.9
body      BSN_URI_BAD eval:check_uridnsbl('BSN_URI_BAD')
describe  BSN_URI_BAD URI domain: bad reputation (BSNSoft)
tflags    BSN_URI_BAD net domains_only
score     BSN_URI_BAD 0.5

endif

To weight the other tiers of body links as well, use the summarised version in the next section.

Verify

spamassassin --lint
spamassassin -D askdns -t < mail.eml 2>&1 | grep -E 'BSN_|X-Spam-Status'

The debug output shows the query (launching query (BSN_REP_TOP): example.com.dnsbl.bsnsoft-hostings.de) and the answer for each rule; the report lists the rule that matched. With amavis, restart it afterwards (systemctl restart amavis) so it loads the new rules.

A domain we have not seen before returns NXDOMAIN on its first lookup and is rated in the background; later lookups get the score. SpamAssassin 4 skips AskDNS lookups for domains in uridnsbl_skip_domains (large providers such as gmail.com), so those get no rule of ours.

SpamAssassin · summarised to best and worst hit

A setup from the production mail gateways of a university computing centre, published here with kind permission. It checks the sender domain and the domains of body links, and counts per message at most one best and one worst hit for each.

Why summarise. A SpamAssassin rule fires at most once per message, however many links match. But a message with many links usually hits several tiers at once, for example MEDIUM for a tracker, LOW for a CDN and BAD for one more link. With one weighted rule per tier the scores add up, and mails with many links were rated too harshly in practice. So here the five tier rules only score ±0.01 (they show up in the report but carry no weight), and meta rules pick the best hit (TOP or HIGH) and the worst hit (MEDIUM, LOW or BAD).

Why five rules with exact filters. The answer is graded, from 127.0.0.0 = score 9 to 127.0.0.9 = score 0, and every answer is a hit in DNS terms. Each tier rule filters exactly its range. Don't simplify to a rule without a subtest: it matches every answer, TOP included, so a link to a well-rated domain would count as a spam hit.

Requires the AskDNS (SpamAssassin 3.4 or later) and URIDNSBL plugins, both loaded by default on most distributions. Save as /etc/spamassassin/bsn_reputation.cf. It replaces the basic file above; don't load both, the rule names are the same.

# BSNSoft Domain Reputation: sender domain and link domains,
# summarised to the best and the worst hit per message.
# /etc/spamassassin/bsn_reputation.cf (replaces the basic version)
#
# The tier rules (BSN_REP_*, BSN_URI_*) score only +-0.01: visible in
# the report, no weight. The *_HIT meta rules carry the weight: per
# message at most one best hit (TOP or HIGH) and one worst hit
# (MEDIUM, LOW or BAD), for the sender and for the links separately.
# Starting weights are deliberately low, raise LOW/BAD after testing.
# Sender: dnsbl.bsnsoft-hostings.de, links: uri.dnsbl.bsnsoft-hostings.de

# --- Sender domain (From: header) --------------------------------------
ifplugin Mail::SpamAssassin::Plugin::AskDNS

askdns   BSN_REP_TOP    _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.0$/
describe BSN_REP_TOP    Sender domain: top reputation (BSNSoft)
tflags   BSN_REP_TOP    net nice
score    BSN_REP_TOP    -0.01

askdns   BSN_REP_HIGH   _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[12]$/
describe BSN_REP_HIGH   Sender domain: high reputation (BSNSoft)
tflags   BSN_REP_HIGH   net nice
score    BSN_REP_HIGH   -0.01

askdns   BSN_REP_MEDIUM _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[345]$/
describe BSN_REP_MEDIUM Sender domain: medium reputation (BSNSoft)
tflags   BSN_REP_MEDIUM net
score    BSN_REP_MEDIUM 0.01

askdns   BSN_REP_LOW    _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[67]$/
describe BSN_REP_LOW    Sender domain: low reputation (BSNSoft)
tflags   BSN_REP_LOW    net
score    BSN_REP_LOW    0.01

askdns   BSN_REP_BAD    _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[89]$/
describe BSN_REP_BAD    Sender domain: bad reputation (BSNSoft)
tflags   BSN_REP_BAD    net
score    BSN_REP_BAD    0.01

meta     BSN_REP_TOP_HIT    (BSN_REP_TOP)
describe BSN_REP_TOP_HIT    Sender domain: best hit TOP (BSNSoft)
tflags   BSN_REP_TOP_HIT    nice
score    BSN_REP_TOP_HIT    -0.3

meta     BSN_REP_HIGH_HIT   (BSN_REP_HIGH && !BSN_REP_TOP)
describe BSN_REP_HIGH_HIT   Sender domain: best hit HIGH (BSNSoft)
tflags   BSN_REP_HIGH_HIT   nice
score    BSN_REP_HIGH_HIT   -0.1

meta     BSN_REP_MEDIUM_HIT (BSN_REP_MEDIUM && !BSN_REP_LOW && !BSN_REP_BAD)
describe BSN_REP_MEDIUM_HIT Sender domain: worst hit MEDIUM (BSNSoft)
score    BSN_REP_MEDIUM_HIT 0.2

meta     BSN_REP_LOW_HIT    (BSN_REP_LOW && !BSN_REP_BAD)
describe BSN_REP_LOW_HIT    Sender domain: worst hit LOW (BSNSoft)
score    BSN_REP_LOW_HIT    0.8

meta     BSN_REP_BAD_HIT    (BSN_REP_BAD)
describe BSN_REP_BAD_HIT    Sender domain: worst hit BAD (BSNSoft)
score    BSN_REP_BAD_HIT    1.5

endif

# --- Domains of links in the body ---------------------------------------
ifplugin Mail::SpamAssassin::Plugin::URIDNSBL

urirhssub BSN_URI_TOP    uri.dnsbl.bsnsoft-hostings.de. A 127.0.0.0
body      BSN_URI_TOP    eval:check_uridnsbl('BSN_URI_TOP')
describe  BSN_URI_TOP    Link domain: top reputation (BSNSoft)
tflags    BSN_URI_TOP    net domains_only nice
score     BSN_URI_TOP    -0.01

urirhssub BSN_URI_HIGH   uri.dnsbl.bsnsoft-hostings.de. A 127.0.0.1-127.0.0.2
body      BSN_URI_HIGH   eval:check_uridnsbl('BSN_URI_HIGH')
describe  BSN_URI_HIGH   Link domain: high reputation (BSNSoft)
tflags    BSN_URI_HIGH   net domains_only nice
score     BSN_URI_HIGH   -0.01

urirhssub BSN_URI_MEDIUM uri.dnsbl.bsnsoft-hostings.de. A 127.0.0.3-127.0.0.5
body      BSN_URI_MEDIUM eval:check_uridnsbl('BSN_URI_MEDIUM')
describe  BSN_URI_MEDIUM Link domain: medium reputation (BSNSoft)
tflags    BSN_URI_MEDIUM net domains_only
score     BSN_URI_MEDIUM 0.01

urirhssub BSN_URI_LOW    uri.dnsbl.bsnsoft-hostings.de. A 127.0.0.6-127.0.0.7
body      BSN_URI_LOW    eval:check_uridnsbl('BSN_URI_LOW')
describe  BSN_URI_LOW    Link domain: low reputation (BSNSoft)
tflags    BSN_URI_LOW    net domains_only
score     BSN_URI_LOW    0.01

urirhssub BSN_URI_BAD    uri.dnsbl.bsnsoft-hostings.de. A 127.0.0.8-127.0.0.9
body      BSN_URI_BAD    eval:check_uridnsbl('BSN_URI_BAD')
describe  BSN_URI_BAD    Link domain: bad reputation (BSNSoft)
tflags    BSN_URI_BAD    net domains_only
score     BSN_URI_BAD    0.01

# Spammers mix reputable domains into their links: the best link hit
# is logged, not weighted.
meta      BSN_URI_TOP_HIT    (BSN_URI_TOP)
describe  BSN_URI_TOP_HIT    Link domains: best hit TOP (BSNSoft)
tflags    BSN_URI_TOP_HIT    nice
score     BSN_URI_TOP_HIT    -0.01

meta      BSN_URI_HIGH_HIT   (BSN_URI_HIGH && !BSN_URI_TOP)
describe  BSN_URI_HIGH_HIT   Link domains: best hit HIGH (BSNSoft)
tflags    BSN_URI_HIGH_HIT   nice
score     BSN_URI_HIGH_HIT   -0.01

meta      BSN_URI_MEDIUM_HIT (BSN_URI_MEDIUM && !BSN_URI_LOW && !BSN_URI_BAD)
describe  BSN_URI_MEDIUM_HIT Link domains: worst hit MEDIUM (BSNSoft)
score     BSN_URI_MEDIUM_HIT 0.1

meta      BSN_URI_LOW_HIT    (BSN_URI_LOW && !BSN_URI_BAD)
describe  BSN_URI_LOW_HIT    Link domains: worst hit LOW (BSNSoft)
score     BSN_URI_LOW_HIT    0.5

meta      BSN_URI_BAD_HIT    (BSN_URI_BAD)
describe  BSN_URI_BAD_HIT    Link domains: worst hit BAD (BSNSoft)
score     BSN_URI_BAD_HIT    1.0

endif

Weights: start low

Meta ruleSender BSN_REP_…Links BSN_URI_…
TOP …_TOP_HIT−0.3−0.01 (log only)
HIGH …_HIGH_HIT−0.1−0.01 (log only)
MEDIUM …_MEDIUM_HIT+0.2+0.1
LOW …_LOW_HIT+0.8+0.5
BAD …_BAD_HIT+1.5+1.0

The five sender rules share one DNS lookup per message, the five link rules one lookup per link domain (by default SpamAssassin checks up to 20 domains per message, uridnsbl_max_domains). Link checks raise your query volume considerably, so register the IP of your resolver (see Rate limits above).

Verify

Run spamassassin --lint and a test mail with spamassassin -t as above. For a message whose sender domain is BAD and whose links cover all five tiers, the report shows every tier rule with ±0.0, but only the two worst hits and the logged best hit carry a score:

 1.5 BSN_REP_BAD_HIT   Sender domain: worst hit BAD (BSNSoft)
 1.0 BSN_URI_BAD_HIT   Link domains: worst hit BAD (BSNSoft)
-0.0 BSN_URI_TOP_HIT   Link domains: best hit TOP (BSNSoft)
 0.0 BSN_URI_LOW       Link domain: low reputation (BSNSoft)
 …

Linted and tested with SpamAssassin 3.4.6 and 4.0.1.

Proxmox Mail Gateway

PMG filters with SpamAssassin and loads the AskDNS plugin by default, so the sender-domain check needs no extra package. Three things are specific to PMG: the resolver, where the rules go, and how to restart the filter. Tested with PMG 9.1 (SpamAssassin 4.0.2).

Step 1 – a resolver that passes 127.0.0.x answers

Like every DNSBL, our zone answers with addresses from 127.0.0.0/8. Many router and firewall resolvers drop such answers as "DNS rebinding" (Unbound on pfSense and OPNsense, dnsmasq with stop-dns-rebind). The lookup then returns no address, and every DNSBL rule stays silent without an error. Check on the PMG host:

getent hosts gmail.com.dnsbl.bsnsoft-hostings.de
# expected: 127.0.0.0       gmail.com.dnsbl.bsnsoft-hostings.de

If nothing comes back, give PMG a resolver of its own. Public DNSBLs block large shared resolvers anyway, so a local one is a good idea on every mail gateway:

apt install unbound
# /etc/resolv.conf: nameserver 127.0.0.1
# PMG in an LXC container: on the Proxmox VE host run  pct set <CTID> --nameserver 127.0.0.1
# With DHCP the DHCP client overwrites /etc/resolv.conf. Add to /etc/dhcp/dhclient.conf:
#   supersede domain-name-servers 127.0.0.1;

With a local resolver the queries come from PMG's public IP: that is the IP to register.

Step 2 – the rules

Append to /etc/mail/spamassassin/custom.cf. PMG keeps this file across updates and, in a cluster, copies it from the master node to all others, so edit it on the master only. A good reputation earns its bonus only with a valid DKIM signature of the From domain (DKIM_VALID_AU), so forged senders never profit from a brand's reputation. PMG lists SpamAssassin's DMARC plugin but does not ship the Mail::DMARC module it needs, so the rules do not rely on DMARC.

# BSNSoft Domain Reputation for Proxmox Mail Gateway, version 2026-11-13
# Sender domain (From: header). Bonus only with a valid DKIM signature of that
# domain; penalties always apply. Weights fit PMG's default rule, which
# quarantines from score 3: the sender penalty stays at half of it (+1.5).
ifplugin Mail::SpamAssassin::Plugin::AskDNS

askdns   __BSN_REP_TOP  _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.0$/
askdns   __BSN_REP_HIGH _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[12]$/

meta     BSN_REP_TOP    __BSN_REP_TOP && DKIM_VALID_AU
describe BSN_REP_TOP    Sender domain: top reputation, DKIM-authenticated (BSNSoft)
tflags   BSN_REP_TOP    net nice
score    BSN_REP_TOP    -0.5

meta     BSN_REP_HIGH   __BSN_REP_HIGH && DKIM_VALID_AU
describe BSN_REP_HIGH   Sender domain: high reputation, DKIM-authenticated (BSNSoft)
tflags   BSN_REP_HIGH   net nice
score    BSN_REP_HIGH   -0.1

meta     BSN_REP_NOAUTH (__BSN_REP_TOP || __BSN_REP_HIGH) && !DKIM_VALID_AU
describe BSN_REP_NOAUTH Sender domain: good reputation, From not DKIM-authenticated: no bonus (BSNSoft)
tflags   BSN_REP_NOAUTH net
score    BSN_REP_NOAUTH 0.001

askdns   BSN_REP_MEDIUM _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[345]$/
describe BSN_REP_MEDIUM Sender domain: medium reputation (BSNSoft)
tflags   BSN_REP_MEDIUM net
score    BSN_REP_MEDIUM 0.25

askdns   BSN_REP_LOW    _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[67]$/
describe BSN_REP_LOW    Sender domain: low reputation (BSNSoft)
tflags   BSN_REP_LOW    net
score    BSN_REP_LOW    1.0

askdns   BSN_REP_BAD    _AUTHORDOMAIN_.dnsbl.bsnsoft-hostings.de A /^127\.0\.0\.[89]$/
describe BSN_REP_BAD    Sender domain: bad reputation (BSNSoft)
tflags   BSN_REP_BAD    net
score    BSN_REP_BAD    1.5

endif

# Optional: domains of links in the body, BAD range only, small weight.
ifplugin Mail::SpamAssassin::Plugin::URIDNSBL

urirhssub BSN_URI_BAD uri.dnsbl.bsnsoft-hostings.de. A 127.0.0.8-127.0.0.9
body      BSN_URI_BAD eval:check_uridnsbl('BSN_URI_BAD')
describe  BSN_URI_BAD URI domain: bad reputation (BSNSoft)
tflags    BSN_URI_BAD net domains_only
score     BSN_URI_BAD 0.3

endif

Check and load. pmgconfig sync alone does not reload the rules, the filter has to restart:

spamassassin --siteconfigpath=/etc/mail/spamassassin --lint
systemctl restart pmg-smtp-filter

In a cluster the other nodes restart their filter on their own once they have synced custom.cf. You can change the weights later in the GUI under Spam Detector → Custom Scores.

The weights are lower than in the SpamAssassin sections above. PMG's default rule set quarantines from score 3 (Quarantine/Mark Spam (Level 3)), not 5, so the weights are scaled to that: a bad sender domain adds +1.5, half of it, and together with a bad link +1.8. Our signal alone never sends a message to quarantine.

Two limits of SpamAssassin in PMG. PMG cuts messages above its Max Spam Size (default 256 KiB) before SpamAssassin sees them; the DKIM signature of such a message then fails, so large mails get no bonus, while penalties still apply. And SpamAssassin 4 skips AskDNS lookups for the large providers in its uridnsbl_skip_domains list (gmail.com, t-online.de and others): mail from them gets no rule of ours.

Step 3 (optional) – let PMG's greylisting do the deferral

SpamAssassin asks the zone only after the message has been accepted, so a domain we have never seen gets no score on its first mail. PMG greylists unknown IPv4 senders by default and lets the retry through after three minutes at the earliest. If Postfix asks the zone already during the first, greylisted attempt, the zone has scored the domain by the time the retry arrives:

cp /var/lib/pmg/templates/main.cf.in /etc/pmg/templates/main.cf.in
# /etc/pmg/templates/main.cf.in, in smtpd_sender_restrictions right after permit_mynetworks:
        warn_if_reject reject_rhsbl_sender dnsbl.bsnsoft-hostings.de=127.0.0.[8..9]

pmgconfig sync --restart 1

The line rejects nothing. It triggers the lookup and logs a reject_warning for senders with a BAD domain. It looks up the envelope sender: for direct spam that is usually the From domain, for newsletters the bounce domain of the mailing service, whose From domain is then still new at the retry. PMG does not update a custom template on upgrades, so compare it with /var/lib/pmg/templates/main.cf.in afterwards.

rspamd as custom check

If PMG hands mail to rspamd through its custom check script (as in this forum tutorial), use the rspamd plugin with DEFER_UNKNOWN = false: PMG only takes the score from rspamd, a soft reject would get lost. Step 1 and step 3 apply here too.

Verify

spamassassin --siteconfigpath=/etc/mail/spamassassin -t < mail.eml | grep BSN_

The filter logs the hits per message (tracking center or journalctl -u pmg-smtp-filter), for example a small DKIM-signed mail from a TOP domain and a mail from a BAD domain:

SA score=0/5 … hits=BSN_REP_TOP(-0.5),DKIM_SIGNED(0.1),DKIM_VALID(-0.1),DKIM_VALID_AU(-0.1),…
SA score=… hits=…,BSN_REP_BAD(1.5),FROM_FMBLA_NEWDOM14(0.999),…

Postfix · postfwd policy

Without rspamd or SpamAssassin, the policy daemon postfwd can query the zone during the SMTP dialogue. It only sees the envelope sender, not the From: header, so for newsletters it checks the bounce domain of the mailing service. Match the answer exactly: postfwd's default pattern (^127\.0\.0\.\d+$) counts every answer as a hit, TOP included. The rules below only mark mail from LOW and BAD sender domains with a header; your content filter or a Sieve rule decides what happens to it. Our signal alone should not reject a message.

# /etc/postfwd/postfwd.cf
id=BSN_REP_BAD ; rhsbl_sender=dnsbl.bsnsoft-hostings.de/^127\.0\.0\.[89]$/300 ; action=PREPEND X-BSN-Reputation: BAD
id=BSN_REP_LOW ; rhsbl_sender=dnsbl.bsnsoft-hostings.de/^127\.0\.0\.[67]$/300 ; action=PREPEND X-BSN-Reputation: LOW

In Postfix's main.cf, after permit_mynetworks and reject_unauth_destination:

smtpd_recipient_restrictions =
    permit_mynetworks,
    reject_unauth_destination,
    check_policy_service inet:127.0.0.1:10040

The /300 keeps answers for five minutes, so a domain that was unknown at its first contact is looked up again soon. Tested with postfwd 1.35 on Debian 12: a TOP domain gets DUNNO, a LOW domain PREPEND X-BSN-Reputation: LOW, a BAD domain PREPEND X-BSN-Reputation: BAD.

HTTP API

Single lookup:

curl https://dnsbl.bsnsoft-hostings.de/api/score/example.com

Response format:

{
  "rawInput": "example.com",
  "normalizedDomain": "example.com",
  "score": 8,
  "classification": "HIGH",
  "status": "INDEXED"
}

Status values:

StatusMeaning
INDEXEDScore available in score / classification
INVALID_DOMAINInput is not a valid domain
NOT_FOUNDNo longer returned since November 2026: a domain that does not exist in DNS is rated BAD (score 0, status INDEXED) and checked again daily.
UNKNOWNThe DNS lookup for the domain failed; no score (the DNSBL answers NXDOMAIN). Checked again later.

Set generous client timeouts (at least 90 seconds).

Query activity, the numbers behind the chart on the start page:

curl https://dnsbl.bsnsoft-hostings.de/api/activity

Queries per hour for the last 168 complete hours (UTC hour starts, the current hour is not included), plus totals for 24 hours and 7 days, average and peak per hour. Every incoming query counts, across both DNS zones, the API and the web form, including queries over the rate limit. Totals only, no sources. Refreshed every 5 minutes.

Questions or enterprise usage?

Contact: info@bsnsoft.de · bsnsoft.de