New acquisition files go under /usr/local/etc/crowdsec/acquis.d. See opnsense.yaml for details.
- The option poll_without_inotify: true is required if the acquitision targets are symlinks (which
+ The option poll_without_inotify: true is required if the log sources are symlinks (which
is the case for most opnsense logs).
@@ -91,7 +91,7 @@
At the moment, the CrowdSec package for OPNsense is fully functional on the
command line but its web interface is limited; you can only list the installed objects and revoke
decisions. For anything else
- you need the shell.
+ you need the shell or the CrowdSec Console.
Do not enable/start the agent and bouncer services with sysrc or /etc/rc.conf
diff --git a/security/crowdsec/src/opnsense/mvc/app/views/OPNsense/CrowdSec/overview.volt b/security/crowdsec/src/opnsense/mvc/app/views/OPNsense/CrowdSec/overview.volt
index 87987c30a..a51cbb5bf 100644
--- a/security/crowdsec/src/opnsense/mvc/app/views/OPNsense/CrowdSec/overview.volt
+++ b/security/crowdsec/src/opnsense/mvc/app/views/OPNsense/CrowdSec/overview.volt
@@ -54,7 +54,7 @@ ul.nav>li>a {
-
Name
+
Name
IP Address
Last Update
Validated?
@@ -74,7 +74,7 @@ ul.nav>li>a {
-
Name
+
Name
IP Address
Valid
Last API Pull
@@ -95,10 +95,11 @@ ul.nav>li>a {
-
Name
+
Collection
Status
Version
-
Local Path
+
Path
+
Description
@@ -114,10 +115,10 @@ ul.nav>li>a {
-
Name
+
Scenario
Status
Version
-
Path
+
Path
Description
@@ -134,10 +135,10 @@ ul.nav>li>a {
-
Name
+
Parser
Status
Version
-
Local Path
+
Path
Description
@@ -154,10 +155,10 @@ ul.nav>li>a {
-
Name
+
Postoverflow
Status
Version
-
Local Path
+
Path
Description
@@ -174,7 +175,7 @@ ul.nav>li>a {
-
ID
+
ID
Value
Reason
Country
@@ -198,17 +199,19 @@ ul.nav>li>a {
-
-
ID
-
Source
+
+
ID
+
Source
Scope:Value
Reason
-
Action
+
Action
Country
AS
Events
Expiration
-
Alert ID
+
Alert ID
diff --git a/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/hub-upgrade.sh b/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/hub-upgrade.sh
index 4d2a56808..50b81c744 100755
--- a/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/hub-upgrade.sh
+++ b/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/hub-upgrade.sh
@@ -10,11 +10,11 @@ if [ ! -e "/usr/local/etc/crowdsec/collections/opnsense.yaml" ]; then
/usr/local/bin/cscli --error collections install crowdsecurity/opnsense
fi
-if [ -n "$upgraded" ]; then
- if service crowdsec enabled; then
- if ! service crowdsec status >/dev/null 2>&1; then
- service crowdsec start >/dev/null 2>&1 || :
- else
+if service crowdsec enabled; then
+ if ! service crowdsec status >/dev/null 2>&1; then
+ service crowdsec start >/dev/null 2>&1 || :
+ else
+ if [ -n "$upgraded" ]; then
service crowdsec reload >/dev/null 2>&1 || :
fi
fi
diff --git a/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py b/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py
index 20c572439..84008d625 100755
--- a/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py
+++ b/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py
@@ -45,6 +45,7 @@ def configure_agent(settings):
config['common']['log_dir'] = '/var/log/crowdsec'
config['crowdsec_service']['acquisition_dir'] = '/usr/local/etc/crowdsec/acquis.d/'
+ config['db_config']['use_wal'] = True
if not int(settings.get('lapi_manual_configuration', '0')):
config['api']['server']['listen_uri'] = get_netloc(settings)
diff --git a/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.sh b/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.sh
index 1c339cc01..ce4660c50 100755
--- a/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.sh
+++ b/security/crowdsec/src/opnsense/scripts/OPNsense/CrowdSec/reconfigure.sh
@@ -10,7 +10,6 @@ set -e
# apply configuration options specific to opnsense
/usr/local/opnsense/scripts/OPNsense/CrowdSec/reconfigure.py
-# enable pf anchor here - the tables and rules will be created by the bouncer
/usr/local/sbin/configctl filter reload >/dev/null
# the hub is upgraded by cron too
diff --git a/security/crowdsec/src/opnsense/service/conf/actions.d/actions_crowdsec.conf b/security/crowdsec/src/opnsense/service/conf/actions.d/actions_crowdsec.conf
index de9c3f6fd..371cf485d 100644
--- a/security/crowdsec/src/opnsense/service/conf/actions.d/actions_crowdsec.conf
+++ b/security/crowdsec/src/opnsense/service/conf/actions.d/actions_crowdsec.conf
@@ -19,7 +19,7 @@ message: oscrowdsec status
[restart]
command:/usr/local/etc/rc.d/oscrowdsec restart
type: script
-message: stopping crowdsec services
+message: restarting crowdsec services
[reload]
command:/usr/local/etc/rc.d/oscrowdsec reload
@@ -37,22 +37,17 @@ type:script_output
message: request crowdsec_firewall status
[alerts-list]
-command:/usr/local/bin/cscli alerts list -l 0 -o json | sed 's/^null$/\[\]/'
+command:/usr/local/bin/cscli alerts list -l 0 -o json
type:script_output
message:crowdsec alerts list
[bouncers-list]
-command:/usr/local/bin/cscli bouncers list -o json | sed 's/^null$/\[\]/'
+command:/usr/local/bin/cscli bouncers list -o json
type:script_output
message:crowdsec bouncers list
-[collections-list]
-command:/usr/local/bin/cscli collections list -o json
-type:script_output
-message:crowdsec collections list
-
[decisions-list]
-command:/usr/local/bin/cscli decisions list -l 0 -o json | sed 's/^null$/\[\]/'
+command:/usr/local/bin/cscli decisions list -l 0 -o json
type:script_output
message:crowdsec decisions list
@@ -62,26 +57,16 @@ parameters:--id %s
type:script_output
message:crowdsec decisions delete
+[hub-items]
+command:/usr/local/bin/cscli hub list -o json
+type:script_output
+message:crowdsec hub list
+
[machines-list]
-command:/usr/local/bin/cscli machines list -o json | sed 's/^null$/\[\]/'
+command:/usr/local/bin/cscli machines list -o json
type:script_output
message:crowdsec machines list
-[parsers-list]
-command:/usr/local/bin/cscli parsers list -o json
-type:script_output
-message:crowdsec parsers list
-
-[postoverflows-list]
-command:/usr/local/bin/cscli postoverflows list -o json
-type:script_output
-message:crowdsec postoverflows list
-
-[scenarios-list]
-command:/usr/local/bin/cscli scenarios list -o json
-type:script_output
-message:crowdsec scenarios list
-
[version]
command:/usr/local/bin/cscli version 2>&1
type:script_output
diff --git a/security/crowdsec/src/opnsense/www/js/CrowdSec/crowdsec.js b/security/crowdsec/src/opnsense/www/js/CrowdSec/crowdsec.js
index 93b9ec767..09f16c12e 100644
--- a/security/crowdsec/src/opnsense/www/js/CrowdSec/crowdsec.js
+++ b/security/crowdsec/src/opnsense/www/js/CrowdSec/crowdsec.js
@@ -6,6 +6,7 @@
var CrowdSec = (function () {
'use strict';
+ var crowdsec_path = '/usr/local/etc/crowdsec/';
var _refreshTemplate = '';
var _dataFormatters = {
@@ -87,8 +88,9 @@ var CrowdSec = (function () {
timestamp = $freshness.data('refresh_timestamp');
}
var howlongHuman = '???';
+ var howlongms;
if (timestamp) {
- var howlongms = moment() - moment(timestamp);
+ howlongms = moment() - moment(timestamp);
howlongHuman = moment.duration(howlongms).humanize();
}
$freshness.text(howlongHuman + ' ago');
@@ -129,7 +131,8 @@ var CrowdSec = (function () {
dectypes[decision.type] = dectypes[decision.type] ? (dectypes[decision.type] + 1) : 1;
});
var ret = '';
- for (var type in dectypes) {
+ var type;
+ for (type in dectypes) {
if (ret !== '') {
ret += ' ';
}
@@ -217,7 +220,7 @@ var CrowdSec = (function () {
}
function _initCollections () {
- var url = '/api/crowdsec/collections/get';
+ var url = '/api/crowdsec/hub/get';
var dataCallback = function (data) {
var rows = [];
data.collections.map(function (row) {
@@ -225,7 +228,8 @@ var CrowdSec = (function () {
name: row.name,
status: row.status,
local_version: row.local_version || ' ',
- local_path: row.local_path || ' '
+ local_path: row.local_path ? row.local_path.replace(crowdsec_path, '') : ' ',
+ description: row.description || ' '
});
});
$('#collections table').bootgrid('clear').bootgrid('append', rows);
@@ -234,7 +238,7 @@ var CrowdSec = (function () {
}
function _initScenarios () {
- var url = '/api/crowdsec/scenarios/get';
+ var url = '/api/crowdsec/hub/get';
var dataCallback = function (data) {
var rows = [];
data.scenarios.map(function (row) {
@@ -242,7 +246,7 @@ var CrowdSec = (function () {
name: row.name,
status: row.status,
local_version: row.local_version || ' ',
- local_path: row.local_path || ' ',
+ local_path: row.local_path ? row.local_path.replace(crowdsec_path, '') : ' ',
description: row.description || ' '
});
});
@@ -252,7 +256,7 @@ var CrowdSec = (function () {
}
function _initParsers () {
- var url = '/api/crowdsec/parsers/get';
+ var url = '/api/crowdsec/hub/get';
var dataCallback = function (data) {
var rows = [];
data.parsers.map(function (row) {
@@ -260,7 +264,7 @@ var CrowdSec = (function () {
name: row.name,
status: row.status,
local_version: row.local_version || ' ',
- local_path: row.local_path || ' ',
+ local_path: row.local_path ? row.local_path.replace(crowdsec_path, '') : ' ',
description: row.description || ' '
});
});
@@ -270,7 +274,7 @@ var CrowdSec = (function () {
}
function _initPostoverflows () {
- var url = '/api/crowdsec/postoverflows/get';
+ var url = '/api/crowdsec/hub/get';
var dataCallback = function (data) {
var rows = [];
data.postoverflows.map(function (row) {
@@ -278,7 +282,7 @@ var CrowdSec = (function () {
name: row.name,
status: row.status,
local_version: row.local_version || ' ',
- local_path: row.local_path || ' ',
+ local_path: row.local_path ? row.local_path.replace(crowdsec_path, '') : ' ',
description: row.description || ' '
});
});