aboutsummaryrefslogtreecommitdiff
path: root/security/crowdsec
diff options
context:
space:
mode:
authorRene Ladan <rene@FreeBSD.org>2022-01-15 13:15:52 +0000
committerRene Ladan <rene@FreeBSD.org>2022-01-15 13:15:52 +0000
commit18a4c3574d8faad5936830be46ca5c14faaa7cc3 (patch)
treecdff8cd30be83e85618910062bf169f4d1383b94 /security/crowdsec
parentb5e5323a99359716c9cf94ba241a481aace80dec (diff)
downloadports-18a4c3574d8faad5936830be46ca5c14faaa7cc3.tar.gz
ports-18a4c3574d8faad5936830be46ca5c14faaa7cc3.zip
security/crowdsec*: update to their latest releases
security/crowdsec: - update to version 1.2.3 security/crowdsec-firewall-bouncer: - update to version 0.0.20 - update pkg-message Add log rotation to both ports, and other small improvements. PR: 260262
Diffstat (limited to 'security/crowdsec')
-rw-r--r--security/crowdsec/Makefile21
-rw-r--r--security/crowdsec/distinfo6
-rw-r--r--security/crowdsec/files/crowdsec.conf-newsyslog3
-rw-r--r--security/crowdsec/files/crowdsec.in15
-rw-r--r--security/crowdsec/files/patch-Makefile29
-rw-r--r--security/crowdsec/files/patch-config_acquis.yaml12
-rw-r--r--security/crowdsec/pkg-plist7
7 files changed, 71 insertions, 22 deletions
diff --git a/security/crowdsec/Makefile b/security/crowdsec/Makefile
index f3683aee9c30..dbc74172642a 100644
--- a/security/crowdsec/Makefile
+++ b/security/crowdsec/Makefile
@@ -1,5 +1,5 @@
PORTNAME= crowdsec
-PORTVERSION= 1.2.1 # NOTE: change BUILD_VERSION and BUILD_TAG as well
+PORTVERSION= 1.2.3 # NOTE: change BUILD_VERSION and BUILD_TAG as well
DISTVERSIONPREFIX= v
CATEGORIES= security
@@ -18,19 +18,18 @@ USES= gmake
USE_GITHUB= yes
GH_ACCOUNT= crowdsecurity
GH_PROJECT= crowdsec
+GH_TAGNAME= v1.2.3-freebsd
#GH_TAGNAME is automatically set from DISTVERSION
USE_RC_SUBR= crowdsec
-USE_RC_SUBR= crowdsec
-
SUB_FILES= pkg-message \
pkg-deinstall
# BUILD_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
# BUILD_TAG=$(git rev-parse HEAD)
-MAKE_ENV= BUILD_VERSION="v1.2.1" \
- BUILD_TAG="dd03d073558e380c283afe66942f537c3da647ff"
+MAKE_ENV= BUILD_VERSION="v1.2.3" \
+ BUILD_TAG="fc4be1e0ffc5888f2824358464cb2426cd4472e1"
PLUGIN_DIR= ${PREFIX}/lib/crowdsec/plugins
STAGE_PLUGINS= ${STAGEDIR}${PLUGIN_DIR}
@@ -62,6 +61,7 @@ do-install:
${LN} -s cscli ${STAGE_BIN}/crowdsec-cli
@${MKDIR} ${STAGE_PLUGINS}
+ ${INSTALL_PROGRAM} ${WRKSRC}/plugins/notifications/email/notification-email ${STAGE_PLUGINS}/
${INSTALL_PROGRAM} ${WRKSRC}/plugins/notifications/http/notification-http ${STAGE_PLUGINS}/
${INSTALL_PROGRAM} ${WRKSRC}/plugins/notifications/slack/notification-slack ${STAGE_PLUGINS}/
${INSTALL_PROGRAM} ${WRKSRC}/plugins/notifications/splunk/notification-splunk ${STAGE_PLUGINS}/
@@ -92,6 +92,10 @@ do-install:
@${MKDIR} ${STAGEDIR}${ETCDIR}/notifications
+ @${MKDIR} ${STAGEDIR}${ETCDIR}/notifications/email
+ @${MV} ${WRKSRC}/plugins/notifications/email/email.yaml \
+ ${STAGEDIR}${ETCDIR}/notifications/email/email.yaml.sample
+
@${MKDIR} ${STAGEDIR}${ETCDIR}/notifications/http
@${MV} ${WRKSRC}/plugins/notifications/http/http.yaml \
${STAGEDIR}${ETCDIR}/notifications/http/http.yaml.sample
@@ -119,4 +123,11 @@ do-install:
@${MKDIR} ${STAGEDIR}${ETCDIR}/hub
@${MKDIR} ${STAGEDIR}/var/db/crowdsec/data
+ #
+ # Log rotation
+ #
+
+ @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+ ${INSTALL_DATA} ${FILESDIR}/crowdsec.conf-newsyslog ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d/crowdsec.conf.sample
+
.include <bsd.port.mk>
diff --git a/security/crowdsec/distinfo b/security/crowdsec/distinfo
index 1eecdf198266..a87959633114 100644
--- a/security/crowdsec/distinfo
+++ b/security/crowdsec/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1637702390
-SHA256 (crowdsecurity-crowdsec-v1.2.1_GH0.tar.gz) = e3a9bbb70b1995a83c5001d06dbbcb5f59d43e4d7c18b60548f305a62d2dd6a3
-SIZE (crowdsecurity-crowdsec-v1.2.1_GH0.tar.gz) = 659398
+TIMESTAMP = 1642022158
+SHA256 (crowdsecurity-crowdsec-v1.2.3-v1.2.3-freebsd_GH0.tar.gz) = 9b3dd5fcc7b67cf89a1a661009a215b9a7f7a0efeb598456480e57fbd6e9bb4b
+SIZE (crowdsecurity-crowdsec-v1.2.3-v1.2.3-freebsd_GH0.tar.gz) = 19122216
diff --git a/security/crowdsec/files/crowdsec.conf-newsyslog b/security/crowdsec/files/crowdsec.conf-newsyslog
new file mode 100644
index 000000000000..a32cf4d567d7
--- /dev/null
+++ b/security/crowdsec/files/crowdsec.conf-newsyslog
@@ -0,0 +1,3 @@
+# logfilename [owner:group] mode count size(kb) when flags [/pid_file] [sig_num]
+/var/log/crowdsec.log root:wheel 644 10 5120 * JC /var/run/crowdsec.pid
+/var/log/crowdsec_api.log root:wheel 644 10 5120 * JC /var/run/crowdsec.pid
diff --git a/security/crowdsec/files/crowdsec.in b/security/crowdsec/files/crowdsec.in
index 04b7c02130f9..ac0f384a9572 100644
--- a/security/crowdsec/files/crowdsec.in
+++ b/security/crowdsec/files/crowdsec.in
@@ -43,12 +43,12 @@ crowdsec_precmd() {
}
HUB_DIR=$(Config ConfigPaths.HubDir)
- if ! ls -1qA "$HUB_DIR/*" >/dev/null 2>&1; then
+ if ! ls -1qA "$HUB_DIR"/* >/dev/null 2>&1; then
echo "Fetching hub inventory"
cs_cli hub update || :
fi
- if [ -z "$(cs_cli machines list -o raw)" ]; then
+ if [ "$(cs_cli machines list -o json)" = "[]" ]; then
echo "Registering LAPI"
cs_cli machines add --auto || :
fi
@@ -59,12 +59,13 @@ crowdsec_precmd() {
cs_cli capi register || :
fi
- cs_cli collections inspect crowdsecurity/linux >/dev/null || cs_cli collections install crowdsecurity/linux || :
+ # This would work but takes 30secs to timeout while reading the metrics, because crowdsec is not running yet.
+ # cs_cli collections inspect crowdsecurity/freebsd 2>/dev/null | grep ^installed | grep -q true || \
+ # cs_cli collections install crowdsecurity/freebsd || :
- DATA_DIR=$(Config ConfigPaths.DataDir)
- if [ ! -f "${DATA_DIR}/GeoLite2-City.mmdb" ]; then
- echo "Installing GeoIP enricher"
- cs_cli parsers install crowdsecurity/geoip-enrich || :
+ # So we just check for the file
+ if [ ! -e "${CONFIG_DIR}/collections/freebsd.yaml" ]; then
+ cs_cli collections install crowdsecurity/freebsd || :
fi
}
diff --git a/security/crowdsec/files/patch-Makefile b/security/crowdsec/files/patch-Makefile
index 909dceada263..840e31a44477 100644
--- a/security/crowdsec/files/patch-Makefile
+++ b/security/crowdsec/files/patch-Makefile
@@ -1,11 +1,26 @@
---- Makefile.orig 2021-11-17 09:15:38 UTC
+--- Makefile.orig 2021-12-21 21:18:22 UTC
+++ Makefile
-@@ -42,7 +42,7 @@ BUILD_VERSION?="$(shell git describe --tags `git rev-l
- BUILD_GOVERSION="$(shell go version | cut -d " " -f3 | sed -E 's/[go]+//g')"
- BUILD_CODENAME=$(shell cat RELEASE.json | jq -r .CodeName)
+@@ -44,14 +44,14 @@ BUILD_CODENAME=$(shell cat RELEASE.json | jq -r .CodeN
BUILD_TIMESTAMP=$(shell date +%F"_"%T)
--BUILD_TAG="$(shell git rev-parse HEAD)"
-+BUILD_TAG?="$(shell git rev-parse HEAD)"
+ BUILD_TAG?="$(shell git rev-parse HEAD)"
- export LD_OPTS=-ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \
+-export LD_OPTS=-ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \
++export LD_OPTS=-mod vendor -modcacherw -ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.System=$(SYSTEM) \
+ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.BuildDate=$(BUILD_TIMESTAMP) \
+ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=$(BUILD_CODENAME) \
+ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Tag=$(BUILD_TAG) \
+ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.GoVersion=$(BUILD_GOVERSION)"
+
+-export LD_OPTS_STATIC=-ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \
++export LD_OPTS_STATIC=-mod vendor -modcacherw -ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \
+ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.BuildDate=$(BUILD_TIMESTAMP) \
+ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=$(BUILD_CODENAME) \
+ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Tag=$(BUILD_TAG) \
+@@ -176,4 +176,4 @@ check_release:
+ release: check_release build package
+
+ .PHONY:
+-release_static: check_release static package_static
+\ No newline at end of file
++release_static: check_release static package_static
diff --git a/security/crowdsec/files/patch-config_acquis.yaml b/security/crowdsec/files/patch-config_acquis.yaml
new file mode 100644
index 000000000000..67b4ef3c693b
--- /dev/null
+++ b/security/crowdsec/files/patch-config_acquis.yaml
@@ -0,0 +1,12 @@
+--- config/acquis.yaml.orig 2021-12-15 10:39:37 UTC
++++ config/acquis.yaml
+@@ -11,6 +11,8 @@ filenames:
+ labels:
+ type: syslog
+ ---
+-filename: /var/log/apache2/*.log
++filenames:
++ - /var/log/httpd-access.log
++ - /var/log/httpd-error.log
+ labels:
+ type: apache2
diff --git a/security/crowdsec/pkg-plist b/security/crowdsec/pkg-plist
index 5a02566e9cf2..a8e54a73df13 100644
--- a/security/crowdsec/pkg-plist
+++ b/security/crowdsec/pkg-plist
@@ -10,9 +10,13 @@ bin/crowdsec-cli
@sample %%ETCDIR%%/config.yaml.sample
@sample %%ETCDIR%%/profiles.yaml.sample
@sample %%ETCDIR%%/simulation.yaml.sample
+@sample %%ETCDIR%%/notifications/email/email.yaml.sample
@sample %%ETCDIR%%/notifications/http/http.yaml.sample
@sample %%ETCDIR%%/notifications/slack/slack.yaml.sample
@sample %%ETCDIR%%/notifications/splunk/splunk.yaml.sample
+%%ETCDIR%%/dev.yaml
+%%ETCDIR%%/user.yaml
+%%ETCDIR%%/crowdsec.service
%%ETCDIR%%/patterns/aws
%%ETCDIR%%/patterns/bacula
%%ETCDIR%%/patterns/bro
@@ -37,10 +41,13 @@ bin/crowdsec-cli
%%ETCDIR%%/patterns/smb
%%ETCDIR%%/patterns/ssh
%%ETCDIR%%/patterns/tcpdump
+@sample etc/newsyslog.conf.d/crowdsec.conf.sample
@mode 0755
+lib/crowdsec/plugins/notification-email
lib/crowdsec/plugins/notification-http
lib/crowdsec/plugins/notification-slack
lib/crowdsec/plugins/notification-splunk
@dir %%ETCDIR%%/hub
@dir /var/db/crowdsec/data
@dir /var/db/crowdsec
+@dir etc/newsyslog.conf.d