mirror of
https://github.com/opnsense/plugins.git
synced 2026-06-03 22:08:11 -04:00
add redis plugin to rspamd plugin (#372)
* add redis plugin to rspamd plugin * add redis missing warning
This commit is contained in:
parent
b8ca2c76d1
commit
f9740debb2
6 changed files with 53 additions and 2 deletions
|
|
@ -32,6 +32,7 @@
|
|||
namespace OPNsense\Rspamd;
|
||||
|
||||
use \OPNsense\Core\Backend;
|
||||
use \OPNsense\Rspamd\RSpamd;
|
||||
|
||||
/**
|
||||
* Class IndexController
|
||||
|
|
@ -43,6 +44,8 @@ class IndexController extends \OPNsense\Base\IndexController
|
|||
{
|
||||
$backend = new Backend();
|
||||
$this->view->clamav_installed = (trim($backend->configdRun('firmware plugin clamav')) == '1');
|
||||
$this->view->redis_installed = (trim($backend->configdRun('firmware plugin redis')) == '1');
|
||||
$this->view->redis_plugin_enabled = ((string)((new RSpamd())->general->enable_redis_plugin)) == '1';
|
||||
$this->view->title = gettext("Rspamd Mail Protection");
|
||||
$this->view->settings = $this->getForm("settings");
|
||||
$this->view->pick('OPNsense/Rspamd/index');
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
<form>
|
||||
<tab id="rspamd-general" description="General Settings">
|
||||
<subtab id="rspamd-general-settings" description="General rSpamd Settings">
|
||||
<subtab id="rspamd-general-settings" description="General Rspamd Settings">
|
||||
<field>
|
||||
<id>rspamd.general.enabled</id>
|
||||
<label>Enable rspamd</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable or disable the rspamd service.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>rspamd.general.enable_redis_plugin</id>
|
||||
<label>Enable Redis Plugin</label>
|
||||
<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>
|
||||
</subtab>
|
||||
</tab>
|
||||
<tab id="rspamd-anti-spam" description="Spam Protection">
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<enable_redis_plugin type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</enable_redis_plugin>
|
||||
</general>
|
||||
|
||||
<graylist>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
window.redis_installed = {{ redis_installed ? 'true' : 'false' }};
|
||||
$( document ).ready(function() {
|
||||
|
||||
var data_get_map = {'frm_rspamd':'/api/rspamd/settings/get'};
|
||||
|
|
@ -51,6 +51,12 @@
|
|||
$('.nav-tabs a').on('shown.bs.tab', function (e) {
|
||||
history.pushState(null, null, e.target.hash);
|
||||
});
|
||||
$('#rspamd\\.general\\.enable_redis_plugin').change(function (evt) {
|
||||
$('#missing_redis_plugin').hide();
|
||||
if (!window.redis_installed && $(this).is(':checked')) {
|
||||
$('#missing_redis_plugin').show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
@ -99,6 +105,9 @@
|
|||
<div style="margin-top: 8px;">{{ lang._('No ClamAV plugin found, please install via %sSystem > Firmware > Plugins%s. If the plugin is not installed and enabled, mails cannot be scanned for malware.')|format('<a href="/ui/core/firmware/#plugins">','</a>')}}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="alert alert-danger" role="alert" id="missing_redis_plugin" style="min-height:65px;{% if !redis_plugin_enabled or redis_installed %} display:none;{% endif %}">
|
||||
<div style="margin-top: 8px;">{{ lang._('The Redis plugin is configured to use but it is not installed. Please install it via %sSystem > Firmware > Plugins%s.')|format('<a href="/ui/core/firmware/#plugins">','</a>')}}</div>
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist" id="maintabs">
|
||||
{% for tab in settings['tabs']|default([]) %}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ greylist.conf:/usr/local/etc/rspamd/local.d/greylist.conf
|
|||
phishing.conf:/usr/local/etc/rspamd/local.d/phishing.conf
|
||||
mx_check.conf:/usr/local/etc/rspamd/local.d/mx_check.conf
|
||||
ratelimit.conf:/usr/local/etc/rspamd/local.d/ratelimit.conf
|
||||
redis.conf:/usr/local/etc/rspamd/local.d/redis.conf
|
||||
spamtrap.map:/usr/local/etc/rspamd/maps.d/spamtrap.map
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
# Please don't modify this file as your changes might be overwritten with
|
||||
# the next update.
|
||||
#
|
||||
# You can modify '$LOCAL_CONFDIR/rspamd.conf.local.override' to redefine
|
||||
# parameters defined on the top level
|
||||
#
|
||||
# You can modify '$LOCAL_CONFDIR/rspamd.conf.local' to add
|
||||
# parameters defined on the top level
|
||||
#
|
||||
# For specific modules or configuration you can also modify
|
||||
# '$LOCAL_CONFDIR/local.d/file.conf' - to add your options or rewrite defaults
|
||||
# '$LOCAL_CONFDIR/override.d/file.conf' - to override the defaults
|
||||
#
|
||||
# See https://rspamd.com/doc/configuration/redis.html
|
||||
|
||||
{% if helpers.exists('OPNsense.Rspamd.general.enable_redis_plugin') and OPNsense.Rspamd.general.enable_redis_plugin == '1' %}
|
||||
{% if helpers.exists('OPNsense.redis.general.enabled') and OPNsense.redis.general.enabled == '1' %}
|
||||
|
||||
servers = "::1";
|
||||
write_servers = "::1";
|
||||
timeout = 10s;
|
||||
#db = "0";
|
||||
{% if helpers.exists('OPNsense.redis.security.password') and OPNsense.redis.security.password != '' %}
|
||||
password = "{{ OPNsense.redis.security.password.replace('"',"\\\"") }}";
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
Loading…
Reference in a new issue