From 71a370bd1a4abb9e2acf5173146629733d7bdf15 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 10 Mar 2016 19:03:51 +0000 Subject: [PATCH] [Feature] Rework includes system in the configuration --- conf/common.conf | 6 +++--- conf/composites.conf | 4 ++-- conf/metrics.conf | 4 ++-- conf/modules.d/chartable.conf | 6 ++++-- conf/modules.d/dkim.conf | 6 ++++-- conf/modules.d/dmarc.conf | 6 ++++-- conf/modules.d/emails.conf | 6 ++++-- conf/modules.d/forged_recipients.conf | 6 ++++-- conf/modules.d/fuzzy_check.conf | 4 +++- conf/modules.d/hfilter.conf | 4 +++- conf/modules.d/ip_score.conf | 6 ++++-- conf/modules.d/maillist.conf | 6 ++++-- conf/modules.d/mime_types.conf | 4 +++- conf/modules.d/multimap.conf | 6 ++++-- conf/modules.d/once_received.conf | 4 +++- conf/modules.d/phishing.conf | 6 ++++-- conf/modules.d/ratelimit.conf | 4 +++- conf/modules.d/rbl.conf | 4 +++- conf/modules.d/rspamd_update.conf | 4 +++- conf/modules.d/spf.conf | 6 ++++-- conf/modules.d/surbl.conf | 4 +++- conf/modules.d/whitelist.conf | 6 ++++-- conf/rspamd.systemd.conf | 16 ++++++++-------- conf/rspamd.sysvinit.conf | 16 ++++++++-------- conf/statistic.conf | 4 ++-- 25 files changed, 93 insertions(+), 55 deletions(-) diff --git a/conf/common.conf b/conf/common.conf index 50accb406..b6ad9192a 100644 --- a/conf/common.conf +++ b/conf/common.conf @@ -10,9 +10,9 @@ lua = "$RULESDIR/rspamd.lua" .include "$CONFDIR/modules.conf" # User local settings -.include(try=true) "$CONFDIR/rspamd.conf.local" -.include(try=true,priority=10) "$CONFDIR/rspamd.conf.local.override" -.include(try=true,priority=10) "$CONFDIR/rspamd.conf.override" +.include(try=true) "$LOCAL_CONFDIR/rspamd.conf.local" +.include(try=true,priority=10) "$LOCAL_CONFDIR/rspamd.conf.local.override" +.include(try=true,priority=10) "$LOCAL_CONFDIR/rspamd.conf.override" modules { path = "$PLUGINSDIR/lua/" diff --git a/conf/composites.conf b/conf/composites.conf index b964ff80f..70021a7f0 100644 --- a/conf/composites.conf +++ b/conf/composites.conf @@ -17,5 +17,5 @@ composite { expression = "(-RBL_SPAMHAUS_XBL | -RBL_SPAMHAUS_XBL1 | -RBL_SPAMHAUS_XBL2 | -RBL_SPAMHAUS_XBL3) & RECEIVED_SPAMHAUS_XBL"; } -.include(try=true; priority=1) "$CONFDIR/local.d/composites.conf" -.include(try=true; priority=10) "$CONFDIR/override.d/composites.conf" \ No newline at end of file +.include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/composites.conf" +.include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/composites.conf" \ No newline at end of file diff --git a/conf/metrics.conf b/conf/metrics.conf index fb1751fb8..b61b28bc2 100644 --- a/conf/metrics.conf +++ b/conf/metrics.conf @@ -1231,6 +1231,6 @@ metric { } } - .include(try=true; priority=1) "$CONFDIR/local.d/metrics.conf" - .include(try=true; priority=10) "$CONFDIR/override.d/metrics.conf" + .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/metrics.conf" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/metrics.conf" } diff --git a/conf/modules.d/chartable.conf b/conf/modules.d/chartable.conf index bf454f65a..0f4374fbb 100644 --- a/conf/modules.d/chartable.conf +++ b/conf/modules.d/chartable.conf @@ -1,5 +1,7 @@ chartable { - .include(try=true,priority=1) "${DBDIR}/dynamic/forged_recipients.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/chartable.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/chartable.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/chartable.conf" threshold = 0.300000; symbol = "R_MIXED_CHARSET"; -} \ No newline at end of file +} diff --git a/conf/modules.d/dkim.conf b/conf/modules.d/dkim.conf index e148783ea..189c13346 100644 --- a/conf/modules.d/dkim.conf +++ b/conf/modules.d/dkim.conf @@ -1,8 +1,10 @@ dkim { - .include(try=true,priority=1) "${DBDIR}/dynamic/dkim.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/dkim.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/dkim.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/dkim.conf" dkim_cache_size = 2k; dkim_cache_expire = 1d; time_jitter = 6h; trusted_only = false; skip_multi = false; -} \ No newline at end of file +} diff --git a/conf/modules.d/dmarc.conf b/conf/modules.d/dmarc.conf index df984cfd2..fad8c9bf2 100644 --- a/conf/modules.d/dmarc.conf +++ b/conf/modules.d/dmarc.conf @@ -1,3 +1,5 @@ dmarc { - .include(try=true,priority=1) "${DBDIR}/dynamic/dmarc.conf" -} \ No newline at end of file + .include(try=true,priority=5) "${DBDIR}/dynamic/dmarc.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/dmarc.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/dmarc.conf" +} diff --git a/conf/modules.d/emails.conf b/conf/modules.d/emails.conf index 1adffca85..67263ec24 100644 --- a/conf/modules.d/emails.conf +++ b/conf/modules.d/emails.conf @@ -1,3 +1,5 @@ emails { - .include(try=true,priority=1) "${DBDIR}/dynamic/emails.conf" -} \ No newline at end of file + .include(try=true,priority=5) "${DBDIR}/dynamic/emails.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/emails.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/emails.conf" +} diff --git a/conf/modules.d/forged_recipients.conf b/conf/modules.d/forged_recipients.conf index 6f66674b6..e71d2ee24 100644 --- a/conf/modules.d/forged_recipients.conf +++ b/conf/modules.d/forged_recipients.conf @@ -1,5 +1,7 @@ forged_recipients { - .include(try=true,priority=1) "${DBDIR}/dynamic/forged_recipients.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/forged_recipients.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/forged_recipients.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/forged_recipients.conf" symbol_sender = "FORGED_SENDER"; symbol_rcpt = "FORGED_RECIPIENTS"; -} \ No newline at end of file +} diff --git a/conf/modules.d/fuzzy_check.conf b/conf/modules.d/fuzzy_check.conf index e3c839cf5..eb347b656 100644 --- a/conf/modules.d/fuzzy_check.conf +++ b/conf/modules.d/fuzzy_check.conf @@ -1,6 +1,8 @@ fuzzy_check { # Include dynamic conf for the rule - .include(try=true,priority=1) "${DBDIR}/dynamic/fuzzy_check.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/fuzzy_check.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/fuzzy_check.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/fuzzy_check.conf" min_bytes = 100; rule { servers = "rspamd.com:11335"; diff --git a/conf/modules.d/hfilter.conf b/conf/modules.d/hfilter.conf index 0d4ee107e..46cc78cb4 100644 --- a/conf/modules.d/hfilter.conf +++ b/conf/modules.d/hfilter.conf @@ -1,5 +1,7 @@ hfilter { - .include(try=true,priority=1) "${DBDIR}/dynamic/hfilter.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/hfilter.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/hfilter.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/hfilter.conf" helo_enabled = true; hostname_enabled = true; url_enabled = true; diff --git a/conf/modules.d/ip_score.conf b/conf/modules.d/ip_score.conf index 949aee333..a37eef100 100644 --- a/conf/modules.d/ip_score.conf +++ b/conf/modules.d/ip_score.conf @@ -1,9 +1,11 @@ ip_score { - .include(try=true,priority=1) "${DBDIR}/dynamic/ip_score.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/ip_score.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/ip_score.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/ip_score.conf" # servers = "localhost"; # treshold = 100; # reject_score = 3; # no_action_score = -2; # add_header_score = 1; # whitelist = "file:///ip_map"; -} \ No newline at end of file +} diff --git a/conf/modules.d/maillist.conf b/conf/modules.d/maillist.conf index f6ee49c70..59e24ad5d 100644 --- a/conf/modules.d/maillist.conf +++ b/conf/modules.d/maillist.conf @@ -1,4 +1,6 @@ maillist { - .include(try=true,priority=1) "${DBDIR}/dynamic/maillist.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/maillist.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/maillist.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/maillist.conf" symbol = "MAILLIST"; -} \ No newline at end of file +} diff --git a/conf/modules.d/mime_types.conf b/conf/modules.d/mime_types.conf index 4f3eb2e3d..fac9aa63b 100644 --- a/conf/modules.d/mime_types.conf +++ b/conf/modules.d/mime_types.conf @@ -1,4 +1,6 @@ mime_types { - .include(try=true,priority=1) "${DBDIR}/dynamic/mime_types.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/mime_types.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/mime_types.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/mime_types.conf" file = "${CONFDIR}/mime_types.inc"; } diff --git a/conf/modules.d/multimap.conf b/conf/modules.d/multimap.conf index 4115f67c8..aeaaef5e5 100644 --- a/conf/modules.d/multimap.conf +++ b/conf/modules.d/multimap.conf @@ -1,3 +1,5 @@ multimap { - .include(try=true,priority=1) "${DBDIR}/dynamic/multimap.conf" -} \ No newline at end of file + .include(try=true,priority=5) "${DBDIR}/dynamic/multimap.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/multimap.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/multimap.conf" +} diff --git a/conf/modules.d/once_received.conf b/conf/modules.d/once_received.conf index e0f7cd2b2..84431888e 100644 --- a/conf/modules.d/once_received.conf +++ b/conf/modules.d/once_received.conf @@ -1,5 +1,7 @@ once_received { - .include(try=true,priority=1) "${DBDIR}/dynamic/once_received.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/once_received.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/once_received.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/once_received.conf" good_host = "mail"; bad_host = "static"; bad_host = "dynamic"; diff --git a/conf/modules.d/phishing.conf b/conf/modules.d/phishing.conf index 810a0f1b7..e48b13407 100644 --- a/conf/modules.d/phishing.conf +++ b/conf/modules.d/phishing.conf @@ -1,4 +1,6 @@ phishing { - .include(try=true,priority=1) "${DBDIR}/dynamic/phishing.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/phishing.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/phishing.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/phishing.conf" symbol = "PHISHING"; -} \ No newline at end of file +} diff --git a/conf/modules.d/ratelimit.conf b/conf/modules.d/ratelimit.conf index 317957ac4..04654840a 100644 --- a/conf/modules.d/ratelimit.conf +++ b/conf/modules.d/ratelimit.conf @@ -1,5 +1,7 @@ ratelimit { - .include(try=true,priority=1) "${DBDIR}/dynamic/ratelimit.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/ratelimit.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/ratelimit.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/ratelimit.conf" rates { # Limit for all mail per recipient (burst 100, rate 2 per minute) to = [100, 0.033333333]; diff --git a/conf/modules.d/rbl.conf b/conf/modules.d/rbl.conf index bcb47c484..27ecdc229 100644 --- a/conf/modules.d/rbl.conf +++ b/conf/modules.d/rbl.conf @@ -1,5 +1,7 @@ rbl { - + .include(try=true,priority=5) "${DBDIR}/dynamic/rbl.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/rbl.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/rbl.conf" default_from = true; default_received = false; default_exclude_users = true; diff --git a/conf/modules.d/rspamd_update.conf b/conf/modules.d/rspamd_update.conf index df5e8e16a..dde210060 100644 --- a/conf/modules.d/rspamd_update.conf +++ b/conf/modules.d/rspamd_update.conf @@ -1,5 +1,7 @@ rspamd_update { - .include(try=true,priority=1) "${DBDIR}/dynamic/rspamd_update.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/rspamd_update.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/rspamd_update.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/rspamd_update.conf" rules = "sign+http://rspamd.com/update/rspamd-${BRANCH_VERSION}.ucl"; key = "qxuogdh5eghytji1utkkte1dn3n81c3y5twe61uzoddzwqzuxxyb"; } diff --git a/conf/modules.d/spf.conf b/conf/modules.d/spf.conf index 3d9a6939e..d81590205 100644 --- a/conf/modules.d/spf.conf +++ b/conf/modules.d/spf.conf @@ -1,5 +1,7 @@ spf { - .include(try=true,priority=1) "${DBDIR}/dynamic/spf.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/spf.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/spf.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/spf.conf" spf_cache_size = 2k; spf_cache_expire = 1d; -} \ No newline at end of file +} diff --git a/conf/modules.d/surbl.conf b/conf/modules.d/surbl.conf index 69e500d0a..bdcdc8f57 100644 --- a/conf/modules.d/surbl.conf +++ b/conf/modules.d/surbl.conf @@ -1,5 +1,7 @@ surbl { - .include(try=true,priority=1) "${DBDIR}/dynamic/surbl.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/surbl.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/surbl.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/surbl.conf" whitelist = "file://$CONFDIR/surbl-whitelist.inc"; exceptions = "file://$CONFDIR/2tld.inc"; diff --git a/conf/modules.d/whitelist.conf b/conf/modules.d/whitelist.conf index e9961292c..05f18847a 100644 --- a/conf/modules.d/whitelist.conf +++ b/conf/modules.d/whitelist.conf @@ -1,5 +1,7 @@ whitelist { - .include(try=true,priority=1) "${DBDIR}/dynamic/whitelist.conf" + .include(try=true,priority=5) "${DBDIR}/dynamic/whitelist.conf" + .include(try=true,priority=1) "$LOCAL_CONFDIR/local.d/whitelist.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/whitelist.conf" rules { "WHITELIST_SPF" = { valid_spf = true; @@ -29,4 +31,4 @@ whitelist { description = "Mail comes from the whitelisted domain and has valid DMARC and DKIM policies"; } } -} \ No newline at end of file +} diff --git a/conf/rspamd.systemd.conf b/conf/rspamd.systemd.conf index 4ca52afaf..cf60b7c21 100644 --- a/conf/rspamd.systemd.conf +++ b/conf/rspamd.systemd.conf @@ -2,28 +2,28 @@ options { .include "$CONFDIR/options.inc" - .include(try=true; priority=1) "$CONFDIR/local.d/options.inc" - .include(try=true; priority=10) "$CONFDIR/override.d/options.inc" + .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/options.inc" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/options.inc" } logging { type = "console"; systemd = true; .include "$CONFDIR/logging.inc" - .include(try=true; priority=1) "$CONFDIR/local.d/logging.inc" - .include(try=true; priority=10) "$CONFDIR/override.d/logging.inc" + .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/logging.inc" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/logging.inc" } worker { bind_socket = "systemd:0"; .include "$CONFDIR/worker-normal.inc" - .include(try=true; priority=1) "$CONFDIR/local.d/worker-normal.inc" - .include(try=true; priority=10) "$CONFDIR/override.d/worker-normal.inc" + .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/worker-normal.inc" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-normal.inc" } worker { bind_socket = "systemd:1"; .include "$CONFDIR/worker-controller.inc" - .include(try=true; priority=1) "$CONFDIR/local.d/worker-controller.inc" - .include(try=true; priority=10) "$CONFDIR/override.d/worker-controller.inc" + .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/worker-controller.inc" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-controller.inc" } diff --git a/conf/rspamd.sysvinit.conf b/conf/rspamd.sysvinit.conf index 0360b1a17..e24fe8902 100644 --- a/conf/rspamd.sysvinit.conf +++ b/conf/rspamd.sysvinit.conf @@ -3,28 +3,28 @@ options { pidfile = "$RUNDIR/rspamd.pid"; .include "$CONFDIR/options.inc" - .include(try=true; priority=1) "$CONFDIR/local.d/options.inc" - .include(try=true; priority=10) "$CONFDIR/override.d/options.inc" + .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/options.inc" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/options.inc" } logging { type = "file"; filename = "$LOGDIR/rspamd.log"; .include "$CONFDIR/logging.inc" - .include(try=true; priority=1) "$CONFDIR/local.d/logging.inc" - .include(try=true; priority=10) "$CONFDIR/override.d/logging.inc" + .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/logging.inc" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/logging.inc" } worker { bind_socket = "*:11333"; .include "$CONFDIR/worker-normal.inc" - .include(try=true; priority=1) "$CONFDIR/local.d/worker-normal.inc" - .include(try=true; priority=10) "$CONFDIR/override.d/worker-normal.inc" + .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/worker-normal.inc" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-normal.inc" } worker { bind_socket = "localhost:11334"; .include "$CONFDIR/worker-controller.inc" - .include(try=true; priority=1) "$CONFDIR/local.d/worker-controller.inc" - .include(try=true; priority=10) "$CONFDIR/override.d/worker-controller.inc" + .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/worker-controller.inc" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-controller.inc" } diff --git a/conf/statistic.conf b/conf/statistic.conf index 12abd89b0..3cc2bfcda 100644 --- a/conf/statistic.conf +++ b/conf/statistic.conf @@ -25,6 +25,6 @@ classifier { path = "${DBDIR}/bayes.spam.sqlite"; spam = true; } - .include(try=true; priority=1) "$CONFDIR/local.d/statistic.conf" - .include(try=true; priority=10) "$CONFDIR/override.d/statistic.conf" + .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/statistic.conf" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/statistic.conf" } -- 2.39.5