aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-03 17:13:14 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-03 17:13:24 +0000
commitfbce349729b85fd5b6ded13d50674bc3cd758871 (patch)
treec6fea5d0d83e2d592e1ab4bff3c28002276dc3c8
parentfcefb0a6d71faaa1b47f5f5f6a3961d41e94cfc3 (diff)
downloadrspamd-fbce349729b85fd5b6ded13d50674bc3cd758871.tar.gz
rspamd-fbce349729b85fd5b6ded13d50674bc3cd758871.zip
Add local_addrs/local_networks option
-rw-r--r--conf/options.inc3
-rw-r--r--doc/markdown/configuration/options.md1
-rw-r--r--src/libserver/cfg_rcl.c12
-rw-r--r--src/plugins/spf.c2
4 files changed, 17 insertions, 1 deletions
diff --git a/conf/options.inc b/conf/options.inc
index 29e737712..44ba68bd6 100644
--- a/conf/options.inc
+++ b/conf/options.inc
@@ -32,3 +32,6 @@ allow_raw_input = true;
# Start ignore words when reaching the following limit, so the total
# amount of words processed will not be *LIKELY more than the twice of that limit
words_decay = 200;
+
+# Local networks
+local_addrs = "192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/8";
diff --git a/doc/markdown/configuration/options.md b/doc/markdown/configuration/options.md
index 44b9abe2b..9d11a2007 100644
--- a/doc/markdown/configuration/options.md
+++ b/doc/markdown/configuration/options.md
@@ -54,6 +54,7 @@ symbol).
* `cores_dir`: directory where rspamd is intended to drop core files
* `max_cores_size`: maximum total size of core files that are placed in `cores_dir`
* `max_cores_count`: maximum number of files in `cores_dir`
+* `local_addrs` or `local_networks`: map or list of ip networks used as local, so certain checks are skipped for them (e.g. SPF checks)
## DNS options
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index ff349e75e..c0daef15e 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -1604,6 +1604,18 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
G_STRUCT_OFFSET (struct rspamd_config, max_cores_count),
RSPAMD_CL_FLAG_INT_SIZE,
"Limit of files count in `cores_dir`");
+ rspamd_rcl_add_default_handler (sub,
+ "local_addrs",
+ rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct rspamd_config, local_addrs),
+ 0,
+ "Use the specified addresses as local ones");
+ rspamd_rcl_add_default_handler (sub,
+ "local_networks",
+ rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct rspamd_config, local_addrs),
+ 0,
+ "Use the specified addresses as local ones (alias for `local_addrs`)");
/* New DNS configuration */
ssub = rspamd_rcl_add_section_doc (&sub->subsections, "dns", NULL, NULL,
diff --git a/src/plugins/spf.c b/src/plugins/spf.c
index c54c27215..ac2f1ddb4 100644
--- a/src/plugins/spf.c
+++ b/src/plugins/spf.c
@@ -358,7 +358,7 @@ spf_symbol_callback (struct rspamd_task *task, void *unused)
}
if (task->user != NULL || rspamd_inet_address_is_local (task->from_addr)) {
- msg_info_task ("skip SPF checks for local and authorized users");
+ msg_info_task ("skip SPF checks for local networks and authorized users");
return;
}