diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-11 13:00:24 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-11 13:00:24 +0100 |
commit | a49a31b3f72d9a744c3bb53f60f7f39614eb7f35 (patch) | |
tree | ace290b79d51d65a64d55d0c27cfad6d96be055b /src/libserver | |
parent | b38a1ad26bbbc0a40bbdddf2b7d6dea6c3bd049a (diff) | |
download | rspamd-a49a31b3f72d9a744c3bb53f60f7f39614eb7f35.tar.gz rspamd-a49a31b3f72d9a744c3bb53f60f7f39614eb7f35.zip |
[Feature] Add limit for number of URLs in Lua
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/cfg_file.h | 1 | ||||
-rw-r--r-- | src/libserver/cfg_rcl.c | 6 | ||||
-rw-r--r-- | src/libserver/cfg_utils.c | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index f22b0cefc..4eea4db16 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -462,6 +462,7 @@ struct rspamd_config { guint lua_gc_step; /**< lua gc step */ guint lua_gc_pause; /**< lua gc pause */ guint full_gc_iters; /**< iterations between full gc cycle */ + guint max_lua_urls; /**< maximum number of urls to be passed to Lua */ GList *classify_headers; /**< list of headers using for statistics */ struct module_s **compiled_modules; /**< list of compiled C modules */ diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index cdf3d9b5b..d409e40e8 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -2195,6 +2195,12 @@ rspamd_rcl_config_init (struct rspamd_config *cfg, GHashTable *skip_sections) RSPAMD_CL_FLAG_INT_32, "Maximum count of heartbeats to be lost before trying to " "terminate a worker (default: 0 - disabled)"); + rspamd_rcl_add_default_handler (sub, + "max_lua_urls", + rspamd_rcl_parse_struct_integer, + G_STRUCT_OFFSET (struct rspamd_config, max_lua_urls), + RSPAMD_CL_FLAG_INT_32, + "Maximum count of URLs to pass to Lua to avoid DoS"); /* Neighbours configuration */ rspamd_rcl_add_section_doc (&sub->subsections, "neighbours", "name", diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index be709a051..5851e250f 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -195,6 +195,7 @@ rspamd_config_new (enum rspamd_config_init_flags flags) cfg->log_error_elts = 10; cfg->log_error_elt_maxlen = 1000; cfg->cache_reload_time = 30.0; + cfg->max_lua_urls = 1024; /* Default log line */ cfg->log_format_str = "id: <$mid>,$if_qid{ qid: <$>,}$if_ip{ ip: $,}" |