diff --git a/mail/rspamd/Makefile b/mail/rspamd/Makefile
index 5b17dff14..aab3cefd0 100644
--- a/mail/rspamd/Makefile
+++ b/mail/rspamd/Makefile
@@ -1,6 +1,5 @@
PLUGIN_NAME= rspamd
-PLUGIN_VERSION= 1.3
-PLUGIN_REVISION= 1
+PLUGIN_VERSION= 1.4
PLUGIN_COMMENT= Protect your network from spam
PLUGIN_DEPENDS= rspamd
PLUGIN_MAINTAINER= franz.fabian.94@gmail.com
diff --git a/mail/rspamd/src/opnsense/mvc/app/controllers/OPNsense/Rspamd/forms/settings.xml b/mail/rspamd/src/opnsense/mvc/app/controllers/OPNsense/Rspamd/forms/settings.xml
index 23ef414e7..6ad435645 100644
--- a/mail/rspamd/src/opnsense/mvc/app/controllers/OPNsense/Rspamd/forms/settings.xml
+++ b/mail/rspamd/src/opnsense/mvc/app/controllers/OPNsense/Rspamd/forms/settings.xml
@@ -13,6 +13,41 @@
checkboxIf you check this box, the local Redis server will be available to the modules (some do not work without it).
+
+ rspamd.general.rejectscore
+
+ text
+ true
+ Set the value at which an e-mail is rejected. The value has to be higher than header, subject and greylist score.
+
+
+ rspamd.general.headerscore
+
+ text
+ true
+ Set the value at which an e-mail is marked as spam in header. The value has to be higher than greylist score.
+
+
+ rspamd.general.subjectscore
+
+ text
+ true
+ Set the value at which an e-mail is marked as spam in subject. The value has to be higher than header and greylist score.
+
+
+ rspamd.general.greylistscore
+
+ text
+ true
+ Set the value at which an e-mail is greylisted. The value has to be lower than all other scores.
+
+
+ rspamd.general.rewritesubject
+
+ text
+ true
+ Enter a prefix added to the subject when Subject Score is reached.
+
diff --git a/mail/rspamd/src/opnsense/mvc/app/models/OPNsense/Rspamd/RSpamd.xml b/mail/rspamd/src/opnsense/mvc/app/models/OPNsense/Rspamd/RSpamd.xml
index 5f3f6ec9a..d034e2d10 100644
--- a/mail/rspamd/src/opnsense/mvc/app/models/OPNsense/Rspamd/RSpamd.xml
+++ b/mail/rspamd/src/opnsense/mvc/app/models/OPNsense/Rspamd/RSpamd.xml
@@ -11,6 +11,59 @@
0Y
+
+ N
+ 1
+ 999
+
+
+ This field must be bigger than the header score.
+ ComparedToFieldConstraint
+ headerscore
+ gt
+
+
+ This field must be lower than the reject score.
+ ComparedToFieldConstraint
+ rejectscore
+ lt
+
+
+ This field must be bigger than the greylist score.
+ ComparedToFieldConstraint
+ greylistscore
+ gt
+
+
+
+
+ N
+ 1
+ 999
+
+
+ This field must be lower than the header score.
+ ComparedToFieldConstraint
+ headerscore
+ lt
+
+
+ This field must be lower than the reject score.
+ ComparedToFieldConstraint
+ rejectscore
+ lt
+
+
+ This field must be lower than the subject score.
+ ComparedToFieldConstraint
+ subjectscore
+ lt
+
+
+
+
+ N
+
diff --git a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/+TARGETS b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/+TARGETS
index 20ea9843e..f12b747a4 100644
--- a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/+TARGETS
+++ b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/+TARGETS
@@ -1,4 +1,5 @@
rspamd:/etc/rc.conf.d/rspamd
+actions.conf:/usr/local/etc/rspamd/local.d/actions.conf
antivirus.wl:/usr/local/etc/rspamd/local.d/antivirus.wl
antivirus.conf:/usr/local/etc/rspamd/local.d/antivirus.conf
bad_file_extensions-map:/usr/local/etc/rspamd/local.d/bad_file_extensions.map
diff --git a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/2tld.inc.local b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/2tld.inc.local
index 7784d1b17..235241086 100644
--- a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/2tld.inc.local
+++ b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/2tld.inc.local
@@ -1,5 +1,5 @@
{% if helpers.exists('OPNsense.Rspamd.general.enabled') and OPNsense.Rspamd.general.enabled == '1' and helpers.exists('OPNsense.Rspamd.surbl.exceptions') and OPNsense.Rspamd.surbl.exceptions != '' %}
-{% for host in OPNsense.Rspamd.surbl.exceptions.split(',') %}
+{% for host in OPNsense.Rspamd.surbl.exceptions.split(',') %}
{{ host }}
-{% endfor %}
+{% endfor %}
{% endif %}
diff --git a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/actions.conf b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/actions.conf
new file mode 100644
index 000000000..e353a6000
--- /dev/null
+++ b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/actions.conf
@@ -0,0 +1,21 @@
+#
+# Please don't modify this file as your changes might be overwritten with
+# the next update.
+#
+{% if helpers.exists('OPNsense.Rspamd.general.enabled') and OPNsense.Rspamd.general.enabled == '1' %}
+{% if helpers.exists('OPNsense.Rspamd.general.rejectscore') and OPNsense.Rspamd.general.rejectscore != '' %}
+ reject = {{ OPNsense.Rspamd.general.rejectscore }};
+{% endif %}
+{% if helpers.exists('OPNsense.Rspamd.general.subjectscore') and OPNsense.Rspamd.general.subjectscore != '' %}
+ add_header = {{ OPNsense.Rspamd.general.headerscore }};
+{% endif %}
+{% if helpers.exists('OPNsense.Rspamd.general.subjectscore') and OPNsense.Rspamd.general.subjectscore != '' %}
+ rewrite_subject = {{ OPNsense.Rspamd.general.subjectscore }};
+{% endif %}
+{% if helpers.exists('OPNsense.Rspamd.general.greylistscore') and OPNsense.Rspamd.general.greylistscore != '' %}
+ greylist = {{ OPNsense.Rspamd.general.greylistscore }};
+{% endif %}
+{% if helpers.exists('OPNsense.Rspamd.general.rewritesubject') and OPNsense.Rspamd.general.rewritesubject != '' %}
+ subject = "{{ OPNsense.Rspamd.general.rewritesubject }} %s"
+{% endif %}
+{% endif %}
diff --git a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/antivirus.conf b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/antivirus.conf
index 403ade205..4728a3339 100644
--- a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/antivirus.conf
+++ b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/antivirus.conf
@@ -5,25 +5,27 @@
{% if helpers.exists('OPNsense.Rspamd.general.enabled') and OPNsense.Rspamd.general.enabled == '1' and helpers.exists('OPNsense.Rspamd.av') %}
clamav {
-{% if helpers.exists('OPNsense.Rspamd.av.force-reject') and OPNsense.Rspamd.av['force-reject'] == '1' %}
+{% if helpers.exists('OPNsense.Rspamd.av.force-reject') and OPNsense.Rspamd.av['force-reject'] == '1' %}
action = "reject";
-{% endif %}
-{% if helpers.exists('OPNsense.Rspamd.av.attachments-only') and OPNsense.Rspamd.av['attachments-only'] == '1' %}
+{% endif %}
+{% if helpers.exists('OPNsense.Rspamd.av.attachments-only') and OPNsense.Rspamd.av['attachments-only'] == '1' %}
scan_mime_parts = true;
-{% else %}
+{% else %}
scan_mime_parts = false;
-{% endif %}
-{% if helpers.exists('OPNsense.Rspamd.av.max-size') and OPNsense.Rspamd.av['max-size'] != '' %}
+{% endif %}
+{% if helpers.exists('OPNsense.Rspamd.av.max-size') and OPNsense.Rspamd.av['max-size'] != '' %}
# If `max_size` is set, messages > n bytes in size are not scanned
max_size = {{ OPNsense.Rspamd.av['max-size'] }};
-{% endif %}
+{% endif %}
symbol = "CLAM_VIRUS";
type = "clamav";
#log_clean = true;
-{% if helpers.exists('OPNsense.clamav.general') and OPNsense.clamav.general.enabled == '1' %}
+{% if helpers.exists('OPNsense.clamav.general') and OPNsense.clamav.general.enabled == '1' %}
servers = "/var/run/clamav/clamd.sock";
-{% endif %}
+{% endif %}
+
+ whitelist = "/usr/local/etc/rspamd/local.d/antivirus.wl";
}
{% endif %}
diff --git a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/antivirus.wl b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/antivirus.wl
index 234b45174..6bc0640ed 100644
--- a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/antivirus.wl
+++ b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/antivirus.wl
@@ -1,5 +1,5 @@
{% if helpers.exists('OPNsense.Rspamd.general.enabled') and OPNsense.Rspamd.general.enabled == '1' and helpers.exists('OPNsense.Rspamd.av.whitelist') and OPNsense.Rspamd.av.whitelist != '' %}
-{% for host in OPNsense.Rspamd.av.whitelist.split(',') %}
+{% for host in OPNsense.Rspamd.av.whitelist.split(',') %}
{{ host }}
-{% endfor %}
+{% endfor %}
{% endif %}
diff --git a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/bad_file_extensions-map b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/bad_file_extensions-map
index 1b27e3ec5..a1a5bd988 100644
--- a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/bad_file_extensions-map
+++ b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/bad_file_extensions-map
@@ -1,5 +1,5 @@
{% if helpers.exists('OPNsense.Rspamd.general.enabled') and OPNsense.Rspamd.general.enabled == '1' and helpers.exists('OPNsense.Rspamd.multimap.badfileextension') and OPNsense.Rspamd.multimap.badfileextension != '' %}
-{% for extension in OPNsense.Rspamd.multimap.badfileextension.split(',') %}
+{% for extension in OPNsense.Rspamd.multimap.badfileextension.split(',') %}
{{ extension }}
-{% endfor %}
+{% endfor %}
{% endif %}
diff --git a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/spamtrap-map b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/spamtrap-map
index f2cfd0041..b66c23e91 100644
--- a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/spamtrap-map
+++ b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/spamtrap-map
@@ -1,5 +1,5 @@
{% if helpers.exists('OPNsense.Rspamd.general.enabled') and OPNsense.Rspamd.general.enabled == '1' and helpers.exists('OPNsense.Rspamd.spamtrap.spam_recipients') %}
-{% for recipient in OPNsense.Rspamd.spamtrap.spam_recipients.split(',') %}
+{% for recipient in OPNsense.Rspamd.spamtrap.spam_recipients.split(',') %}
/{{ recipient }}/i
-{% endfor %}
+{% endfor %}
{% endif %}
diff --git a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/spamtrap.conf b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/spamtrap.conf
index 14edad5b6..5afd82b87 100644
--- a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/spamtrap.conf
+++ b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/spamtrap.conf
@@ -2,7 +2,6 @@
# the next update.
#
-
{% if helpers.exists('OPNsense.Rspamd.general.enabled') and OPNsense.Rspamd.general.enabled == '1' and helpers.exists('OPNsense.Rspamd.spamtrap') %}
# Optionally set an action
#action = "no action";
diff --git a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/surbl-whitelist.inc.local b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/surbl-whitelist.inc.local
index 2098ba554..3209a4cb9 100644
--- a/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/surbl-whitelist.inc.local
+++ b/mail/rspamd/src/opnsense/service/templates/OPNsense/Rspamd/surbl-whitelist.inc.local
@@ -1,5 +1,5 @@
{% if helpers.exists('OPNsense.Rspamd.general.enabled') and OPNsense.Rspamd.general.enabled == '1' and helpers.exists('OPNsense.Rspamd.surbl.whitelist') and OPNsense.Rspamd.surbl.whitelist != '' %}
-{% for host in OPNsense.Rspamd.surbl.whitelist.split(',') %}
+{% for host in OPNsense.Rspamd.surbl.whitelist.split(',') %}
{{ host }}
-{% endfor %}
+{% endfor %}
{% endif %}