mail/rspamd: allow to set marking values and subject (#1114)

* Update Makefile
* Update settings.xml
* Update RSpamd.xml
* Update +TARGETS
* Create actions.conf
* Update 2tld.inc.local
* Update antivirus.conf
* Update antivirus.wl

* Update bad_file_extensions-map

* Update spamtrap-map

* Update spamtrap.conf

* Update surbl-whitelist.inc.local

* Update settings.xml

* Update RSpamd.xml

* Update actions.conf

* Update settings.xml

* Update settings.xml

* Update RSpamd.xml

* whitelist file not included
This commit is contained in:
Michael
2019-01-06 19:23:32 +01:00
committed by Fabian Franz BSc
parent 825f751caa
commit 34ae7c8b46
12 changed files with 132 additions and 22 deletions
+1 -2
View File
@@ -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
@@ -13,6 +13,41 @@
<type>checkbox</type>
<help>If you check this box, the local Redis server will be available to the modules (some do not work without it).</help>
</field>
<field>
<id>rspamd.general.rejectscore</id>
<label>Reject Score</label>
<type>text</type>
<advanced>true</advanced>
<help>Set the value at which an e-mail is rejected. The value has to be higher than header, subject and greylist score.</help>
</field>
<field>
<id>rspamd.general.headerscore</id>
<label>Header Score</label>
<type>text</type>
<advanced>true</advanced>
<help>Set the value at which an e-mail is marked as spam in header. The value has to be higher than greylist score.</help>
</field>
<field>
<id>rspamd.general.subjectscore</id>
<label>Subject Score</label>
<type>text</type>
<advanced>true</advanced>
<help>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.</help>
</field>
<field>
<id>rspamd.general.greylistscore</id>
<label>Greylist Score</label>
<type>text</type>
<advanced>true</advanced>
<help>Set the value at which an e-mail is greylisted. The value has to be lower than all other scores.</help>
</field>
<field>
<id>rspamd.general.rewritesubject</id>
<label>Rewrite Subject</label>
<type>text</type>
<advanced>true</advanced>
<help>Enter a prefix added to the subject when Subject Score is reached.</help>
</field>
</subtab>
<subtab id="rspamd-general-multimap" description="Multimap Settings">
<field>
@@ -11,6 +11,59 @@
<default>0</default>
<Required>Y</Required>
</enable_redis_plugin>
<rejectscore type="IntegerField">
<Required>N</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>999</MaximumValue>
<Constraints>
<check001>
<ValidationMessage>This field must be bigger than the header score.</ValidationMessage>
<type>ComparedToFieldConstraint</type>
<field>headerscore</field>
<operator>gt</operator>
</check001>
<check002>
<ValidationMessage>This field must be lower than the reject score.</ValidationMessage>
<type>ComparedToFieldConstraint</type>
<field>rejectscore</field>
<operator>lt</operator>
</check002>
<check003>
<ValidationMessage>This field must be bigger than the greylist score.</ValidationMessage>
<type>ComparedToFieldConstraint</type>
<field>greylistscore</field>
<operator>gt</operator>
</check003>
</Constraints>
</subjectscore>
<greylistscore type="IntegerField">
<Required>N</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>999</MaximumValue>
<Constraints>
<check001>
<ValidationMessage>This field must be lower than the header score.</ValidationMessage>
<type>ComparedToFieldConstraint</type>
<field>headerscore</field>
<operator>lt</operator>
</check001>
<check002>
<ValidationMessage>This field must be lower than the reject score.</ValidationMessage>
<type>ComparedToFieldConstraint</type>
<field>rejectscore</field>
<operator>lt</operator>
</check002>
<check003>
<ValidationMessage>This field must be lower than the subject score.</ValidationMessage>
<type>ComparedToFieldConstraint</type>
<field>subjectscore</field>
<operator>lt</operator>
</check003>
</Constraints>
</greylistscore>
<rewritesubject type="TextField">
<Required>N</Required>
</rewritesubject>
</general>
<milter_headers>
@@ -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
@@ -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 %}
@@ -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 %}
@@ -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 %}
@@ -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 %}
@@ -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 %}
@@ -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 %}
@@ -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";
@@ -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 %}