diff --git a/security/crowdsec/Makefile b/security/crowdsec/Makefile index 1d6d54f333..9dc2734e7f 100644 --- a/security/crowdsec/Makefile +++ b/security/crowdsec/Makefile @@ -1,8 +1,8 @@ PLUGIN_NAME= crowdsec -PLUGIN_VERSION= 1.0.12 +PLUGIN_VERSION= 1.0.13 PLUGIN_DEPENDS= crowdsec PLUGIN_COMMENT= Lightweight and collaborative security engine -PLUGIN_MAINTAINER= marco@crowdsec.net +PLUGIN_MAINTAINER= manuel@crowdsec.net PLUGIN_WWW= https://crowdsec.net/ .include "../../Mk/plugins.mk" diff --git a/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py b/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py index 6d4869c5b9..a90264a9b0 100755 --- a/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py +++ b/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py @@ -36,9 +36,19 @@ def get_netloc(settings: dict[str, str]): return '{}:{}'.format(listen_address, listen_port) +def get_client_netloc(settings: dict[str, str]): + settings = settings.copy() + listen_address = settings.get('lapi_listen_address', '127.0.0.1') + if listen_address == '0.0.0.0': + settings['lapi_listen_address'] = '127.0.0.1' + elif listen_address == '::': + settings['lapi_listen_address'] = '::1' + return get_netloc(settings) + + def get_new_url(old_url: str, settings: dict[str, str]): old_tuple = urllib.parse.urlsplit(old_url) - new_tuple = old_tuple._replace(netloc=get_netloc(settings)) + new_tuple = old_tuple._replace(netloc=get_client_netloc(settings)) new_url = urllib.parse.urlunsplit(new_tuple) # client lapi requires a trailing slash for the path part # and no, query and fragment don't make much sense