From bee8ce935708e5f78a08d1cebdf30122a26d59c0 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Fri, 5 May 2023 19:50:49 +0200 Subject: [PATCH] Fix2805 --- core/rspamd/conf/composites.conf | 2 +- core/rspamd/conf/external_services.conf | 2 +- core/rspamd/conf/external_services_group.conf | 3 +-- core/rspamd/start.py | 6 +++--- towncrier/newsfragments/2805.bugfix | 1 + 5 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 towncrier/newsfragments/2805.bugfix diff --git a/core/rspamd/conf/composites.conf b/core/rspamd/conf/composites.conf index d438c90e..60c8181a 100644 --- a/core/rspamd/conf/composites.conf +++ b/core/rspamd/conf/composites.conf @@ -1,4 +1,4 @@ -{% if SCAN_MACROS == 'True' %} +{% if SCAN_MACROS %} OLETOOLS_MACRO_MRAPTOR { expression = "(OLETOOLS_A & OLETOOLS_W) | (OLETOOLS_A & OLETOOLS_X) | (OLETOOLS_W & OLETOOLS_X)"; message = "Rejected (malicious macro - mraptor)"; diff --git a/core/rspamd/conf/external_services.conf b/core/rspamd/conf/external_services.conf index bcc6012d..609f341b 100644 --- a/core/rspamd/conf/external_services.conf +++ b/core/rspamd/conf/external_services.conf @@ -1,4 +1,4 @@ -{% if SCAN_MACROS == 'True' %} +{% if SCAN_MACROS %} oletools { # default olefy settings servers = "{{ OLETOOLS_ADDRESS }}:11343" diff --git a/core/rspamd/conf/external_services_group.conf b/core/rspamd/conf/external_services_group.conf index 3b7f2d96..70fa2c3c 100644 --- a/core/rspamd/conf/external_services_group.conf +++ b/core/rspamd/conf/external_services_group.conf @@ -1,5 +1,4 @@ - -{% if SCAN_MACROS == 'True' %} +{% if SCAN_MACROS %} # local.d/external_services_group.conf description = "Oletools content rules"; diff --git a/core/rspamd/start.py b/core/rspamd/start.py index 37bb819b..eb11452a 100755 --- a/core/rspamd/start.py +++ b/core/rspamd/start.py @@ -9,13 +9,13 @@ import sys import time from socrate import system,conf -system.set_env() +env = system.set_env() # Actual startup script config_files = [] for rspamd_file in glob.glob("/conf/*"): - conf.jinja(rspamd_file, os.environ, os.path.join("/etc/rspamd/local.d", os.path.basename(rspamd_file))) + conf.jinja(rspamd_file, env, os.path.join("/etc/rspamd/local.d", os.path.basename(rspamd_file))) config_files.append(os.path.basename(rspamd_file)) for override_file in glob.glob("/overrides/*"): @@ -23,7 +23,7 @@ for override_file in glob.glob("/overrides/*"): shutil.copyfile(override_file, os.path.join("/etc/rspamd/local.d", os.path.basename(override_file))) # Admin may not be up just yet -healthcheck = f'http://{os.environ["ADMIN_ADDRESS"]}/internal/rspamd/local_domains' +healthcheck = f'http://{env["ADMIN_ADDRESS"]}/internal/rspamd/local_domains' while True: time.sleep(1) try: diff --git a/towncrier/newsfragments/2805.bugfix b/towncrier/newsfragments/2805.bugfix new file mode 100644 index 00000000..312a9aa6 --- /dev/null +++ b/towncrier/newsfragments/2805.bugfix @@ -0,0 +1 @@ +Fix SCAN_MACROS: OLETOOLS wasn't always enabled/disabled like it should have been