type = 'prefilter,nostat', | type = 'prefilter,nostat', | ||||
callback = asn_check, | callback = asn_check, | ||||
priority = 5, | priority = 5, | ||||
flags = 'empty', | |||||
}) | }) | ||||
if options['symbol'] then | if options['symbol'] then | ||||
rspamd_config:register_symbol({ | rspamd_config:register_symbol({ | ||||
name = options['symbol'], | name = options['symbol'], | ||||
parent = id, | parent = id, | ||||
type = 'virtual' | |||||
type = 'virtual', | |||||
flags = 'empty', | |||||
}) | }) | ||||
end | end | ||||
else | else |
name = 'CLICKHOUSE_COLLECT', | name = 'CLICKHOUSE_COLLECT', | ||||
type = 'idempotent', | type = 'idempotent', | ||||
callback = clickhouse_collect, | callback = clickhouse_collect, | ||||
priority = 10 | |||||
priority = 10, | |||||
flags = 'empty', | |||||
}) | }) | ||||
rspamd_config:register_finish_script(function(task) | rspamd_config:register_finish_script(function(task) | ||||
if nrows > 0 then | if nrows > 0 then |
name = 'ELASTIC_COLLECT', | name = 'ELASTIC_COLLECT', | ||||
type = 'idempotent', | type = 'idempotent', | ||||
callback = elastic_collect, | callback = elastic_collect, | ||||
priority = 10 | |||||
priority = 10, | |||||
flags = 'empty', | |||||
}) | }) | ||||
rspamd_config:add_on_load(function(cfg, ev_base,worker) | rspamd_config:add_on_load(function(cfg, ev_base,worker) |
type = 'normal', | type = 'normal', | ||||
name = name, | name = name, | ||||
callback = cb, | callback = cb, | ||||
flags = 'empty', | |||||
}) | }) | ||||
for _, a in ipairs(atoms) do | for _, a in ipairs(atoms) do | ||||
rspamd_config:register_dependency(id, a) | rspamd_config:register_dependency(id, a) | ||||
end | end | ||||
t.name = 'FORCE_ACTION_' .. name | t.name = 'FORCE_ACTION_' .. name | ||||
t.callback = cb | t.callback = cb | ||||
t.flags = 'empty' | |||||
local id = rspamd_config:register_symbol(t) | local id = rspamd_config:register_symbol(t) | ||||
if t.type == 'normal' then | if t.type == 'normal' then | ||||
for _, a in ipairs(atoms) do | for _, a in ipairs(atoms) do |
name = 'GREYLIST_SAVE', | name = 'GREYLIST_SAVE', | ||||
type = 'postfilter', | type = 'postfilter', | ||||
callback = greylist_set, | callback = greylist_set, | ||||
priority = 6 | |||||
priority = 6, | |||||
flags = 'empty', | |||||
}) | }) | ||||
rspamd_config:register_symbol({ | rspamd_config:register_symbol({ | ||||
name = 'GREYLIST_CHECK', | name = 'GREYLIST_CHECK', | ||||
type = 'prefilter', | type = 'prefilter', | ||||
callback = greylist_check, | callback = greylist_check, | ||||
priority = 6 | |||||
priority = 6, | |||||
flags = 'empty', | |||||
}) | }) | ||||
end | end | ||||
end | end |
name = 'HISTORY_SAVE', | name = 'HISTORY_SAVE', | ||||
type = 'idempotent', | type = 'idempotent', | ||||
callback = history_save, | callback = history_save, | ||||
flags = 'empty', | |||||
priority = 150 | priority = 150 | ||||
}) | }) | ||||
rspamd_plugins['history'] = { | rspamd_plugins['history'] = { |
type = 'postfilter,nostat', | type = 'postfilter,nostat', | ||||
priority = 5, | priority = 5, | ||||
callback = ip_score_set, | callback = ip_score_set, | ||||
flags = 'empty', | |||||
}) | }) | ||||
rspamd_config:register_symbol({ | rspamd_config:register_symbol({ | ||||
name = options['symbol'], | name = options['symbol'], | ||||
callback = ip_score_check, | callback = ip_score_check, | ||||
group = 'reputation', | group = 'reputation', | ||||
score = 2.0 | |||||
score = 2.0, | |||||
flags = 'empty', | |||||
}) | }) | ||||
else | else | ||||
rspamd_lua_utils.disable_module(N, "redis") | rspamd_lua_utils.disable_module(N, "redis") |
name = 'EXPORT_METADATA_' .. k, | name = 'EXPORT_METADATA_' .. k, | ||||
type = 'postfilter,idempotent', | type = 'postfilter,idempotent', | ||||
callback = gen_exporter(r), | callback = gen_exporter(r), | ||||
priority = 10 | |||||
priority = 10, | |||||
flags = 'empty', | |||||
}) | }) | ||||
end | end |
name = 'MILTER_HEADERS', | name = 'MILTER_HEADERS', | ||||
type = 'postfilter,idempotent', | type = 'postfilter,idempotent', | ||||
callback = milter_headers, | callback = milter_headers, | ||||
priority = 10 | |||||
priority = 10, | |||||
flags = 'empty', | |||||
}) | }) |
name = settings.symbol_bad_mx, | name = settings.symbol_bad_mx, | ||||
type = 'normal', | type = 'normal', | ||||
callback = mx_check, | callback = mx_check, | ||||
flags = 'empty', | |||||
}) | }) | ||||
rspamd_config:register_symbol({ | rspamd_config:register_symbol({ | ||||
name = settings.symbol_no_mx, | name = settings.symbol_no_mx, |
name = 'REDIS_SETTINGS' .. tostring(id), | name = 'REDIS_SETTINGS' .. tostring(id), | ||||
type = 'prefilter,nostat', | type = 'prefilter,nostat', | ||||
callback = gen_redis_callback(h, id), | callback = gen_redis_callback(h, id), | ||||
priority = 10 | |||||
priority = 10, | |||||
flags = 'empty', | |||||
}) | }) | ||||
end, redis_key_handlers) | end, redis_key_handlers) | ||||
end | end | ||||
name = 'SETTINGS_CHECK', | name = 'SETTINGS_CHECK', | ||||
type = 'prefilter,nostat', | type = 'prefilter,nostat', | ||||
callback = check_settings, | callback = check_settings, | ||||
priority = 10 | |||||
priority = 10, | |||||
flags = 'empty', | |||||
}) | }) |