Skip to content

Instantly share code, notes, and snippets.

@croessner
Created October 17, 2019 09:12
Show Gist options
  • Save croessner/4e883c7bdfbe1fae4dfcc3e181dd1123 to your computer and use it in GitHub Desktop.
Save croessner/4e883c7bdfbe1fae4dfcc3e181dd1123 to your computer and use it in GitHub Desktop.
Segfault for rspamadm configtest
-- rspamd.local.lua
local rspamd_logger = require "rspamd_logger"
local function mark_mail_ham(task)
local result = task:learn(false)
if result then
rspamd_logger.infox("Message learned as ham")
else
rspamd_logger.warnx("Message could not be learned as ham!")
end
end
rspamd_config.POLICY_SUBMISSION = {
callback = function(task)
mark_mail_ham(task)
return 1
end,
condition = function(task)
return task:has_symbol("LOCAL_META_LEARN_HAM")
end,
description = "Settings policy for submission originating messages",
group = 'local_policies'
}
rspamd_config.POLICY_CUSTOM = {
callback = function(task)
mark_mail_ham(task)
return 1
end,
condition = function(task)
return task:has_symbol("LOCAL_META_LEARN_HAM")
end,
description = "Settings policy for incoming custom messages",
group = 'local_policies'
}
-- Dummy symbols for user settings
--[[
rspamd_config:register_symbol{
type = "virtual",
name = "POLICY_ROLEACCOUNT",
group = 'local_policies',
description = "Settings policy for postmaster and abuse addresses",
flags = "skip"
}
rspamd_config:register_symbol{
type = "virtual",
name = "POLICY_RNSNETWORK",
group = 'local_policies',
description = "Settings policy for service messages originating from the local network",
flags = "skip"
}
rspamd_config:register_symbol{
type = "virtual",
name = "POLICY_ZABBIX",
group = 'local_policies',
description = "Settings policy for Zabbix monitoring messages",
flags = "skip"
}
rspamd_config:register_symbol{
type = "virtual",
name = "POLICY_MAILINGLIST",
group = 'local_policies',
description = "Settings policy for well-known mailing lists",
flags = "skip"
}
--]]
-- vim: syn=lua ts=3 sw=3 expandtab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment