From bb53017521b0d5b5f6fe99b55c057ef3bdcef05c Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Sun, 19 May 2024 14:38:24 +0200 Subject: [PATCH] crowdsec: 1.0.9 (fix service start when lapi is disabled) (#3986) * crowdsec: 1.0.9 (fix service start when lapi is disabled) * 1.0.9 -> 1.0.8-1 --- security/crowdsec/Makefile | 1 + security/crowdsec/pkg-descr | 4 ++++ .../opnsense/scripts/OPNsense/CrowdSec/reconfigure.py | 11 +++++++++++ .../templates/OPNsense/CrowdSec/crowdsec.rc.conf.d | 5 ----- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/security/crowdsec/Makefile b/security/crowdsec/Makefile index ebf2924bb..dad0bf60c 100644 --- a/security/crowdsec/Makefile +++ b/security/crowdsec/Makefile @@ -1,5 +1,6 @@ PLUGIN_NAME= crowdsec PLUGIN_VERSION= 1.0.8 +PLUGIN_REVISION= 1 PLUGIN_DEPENDS= crowdsec PLUGIN_COMMENT= Lightweight and collaborative security engine PLUGIN_MAINTAINER= marco@crowdsec.net diff --git a/security/crowdsec/pkg-descr b/security/crowdsec/pkg-descr index ef22794a4..abb274e56 100644 --- a/security/crowdsec/pkg-descr +++ b/security/crowdsec/pkg-descr @@ -8,6 +8,10 @@ WWW: https://crowdsec.net/ Plugin Changelog ================ +1.0.8-1 + +* Fix service start when lapi is disabled + 1.0.8 * Enable use_wal, remove warning diff --git a/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py b/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py index 84008d625..31fb26643 100755 --- a/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py +++ b/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py @@ -53,6 +53,16 @@ def configure_agent(settings): save_config(config_path, config) +def configure_lapi(settings): + config_path = '/usr/local/etc/crowdsec/config.yaml' + config = load_config(config_path) + + enable = int(settings.get('lapi_enabled', '0')) + config['api']['server']['enable'] = bool(enable) + + save_config(config_path, config) + + def configure_lapi_credentials(settings): config_path = '/usr/local/etc/crowdsec/local_api_credentials.yaml' config = load_config(config_path) @@ -88,6 +98,7 @@ def main(): return configure_agent(settings) + configure_lapi(settings) configure_lapi_credentials(settings) configure_bouncer(settings) diff --git a/security/crowdsec/src/opnsense/service/templates/OPNsense/CrowdSec/crowdsec.rc.conf.d b/security/crowdsec/src/opnsense/service/templates/OPNsense/CrowdSec/crowdsec.rc.conf.d index 77eebf92f..6c0f4e941 100644 --- a/security/crowdsec/src/opnsense/service/templates/OPNsense/CrowdSec/crowdsec.rc.conf.d +++ b/security/crowdsec/src/opnsense/service/templates/OPNsense/CrowdSec/crowdsec.rc.conf.d @@ -4,8 +4,3 @@ crowdsec_enable="YES" {% else %} crowdsec_enable="NO" {% endif %} -{% if helpers.exists('OPNsense.crowdsec.general.lapi_enabled') and OPNsense.crowdsec.general.lapi_enabled|default("1") == "1" %} -crowdsec_flags="" -{% else %} -crowdsec_flags="-no-api" -{% endif %}