git: d29154698a39 - main - security/crowdsec: update to 1.6.2

From: Fernando Apesteguía <fernape_at_FreeBSD.org>
Date: Fri, 07 Jun 2024 17:54:43 UTC
The branch main has been updated by fernape:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d29154698a39a8bc2227e35fa4b6b2a6ac49973e

commit d29154698a39a8bc2227e35fa4b6b2a6ac49973e
Author:     Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2024-06-07 11:44:45 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2024-06-07 17:54:27 +0000

    security/crowdsec: update to 1.6.2
    
    ChangeLog: https://github.com/crowdsecurity/crowdsec/releases/tag/v1.6.2
    
    PR:             279515
    Reported by:    marco@crowdsec.net (maintainer)
---
 security/crowdsec/Makefile                         | 13 +++++---
 security/crowdsec/distinfo                         | 10 +++---
 security/crowdsec/files/crowdsec.in                |  5 +--
 .../crowdsec/files/patch-pkg_csconfig_database.go  | 36 ----------------------
 .../crowdsec/files/patch-pkg_types_getfstype.go    |  8 -----
 .../files/patch-pkg_types_getfstype__freebsd.go    | 28 -----------------
 security/crowdsec/pkg-plist                        |  4 ++-
 7 files changed, 17 insertions(+), 87 deletions(-)

diff --git a/security/crowdsec/Makefile b/security/crowdsec/Makefile
index b73a2d5e3487..4e3e5e7e7f69 100644
--- a/security/crowdsec/Makefile
+++ b/security/crowdsec/Makefile
@@ -1,7 +1,8 @@
 PORTNAME=	crowdsec
 DISTVERSIONPREFIX=	v
-DISTVERSION=	1.6.1
-PORTREVISION=	2
+DISTVERSION=	1.6.2
+# the remote tag was moved for 1.6.2, so we force another tag to avoid the version on proxy.golang.org
+DISTVERSIONSUFFIX=     -final
 CATEGORIES=	security
 
 MAINTAINER=	marco@crowdsec.net
@@ -14,8 +15,8 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 LIB_DEPENDS=	libabsl_base.so:devel/abseil \
 		libre2.so:devel/re2
 
-USES=		go:1.21,modules pkgconfig
-_COMMIT=	0746e0c0
+USES=		go:1.22,modules pkgconfig
+_COMMIT=	16bfab86
 _BUILD_DATE=	$$(date -u "+%F_%T")
 USE_RC_SUBR=	crowdsec
 
@@ -31,7 +32,7 @@ GO_TARGET=	./cmd/crowdsec \
 GO_BUILDFLAGS=	-v -trimpath -tags netgo,osusergo,sqlite_omit_load_extension,re2_cgo \
 		-ldflags="\
 		-a -s -w \
-		-X github.com/crowdsecurity/go-cs-lib/version.Version=${DISTVERSIONPREFIX}${DISTVERSION}-freebsd \
+		-X github.com/crowdsecurity/go-cs-lib/version.Version=${DISTVERSIONPREFIX}${DISTVERSION} \
 		-X github.com/crowdsecurity/go-cs-lib/version.BuildDate=${_BUILD_DATE} \
 		-X github.com/crowdsecurity/go-cs-lib/version.Tag=${_COMMIT} \
 		-X ${GO_MODULE}/pkg/cwversion.Codename=alphaga \
@@ -138,7 +139,9 @@ do-install:
 	#
 
 	@${MKDIR} ${STAGEDIR}${ETCDIR}/hub
+	@${MKDIR} ${STAGEDIR}${ETCDIR}/acquis.d
 	@${MKDIR} ${STAGEDIR}/var/db/crowdsec/data
+	@${MKDIR} ${STAGEDIR}/var/db/crowdsec/data/trace
 
 	#
 	# Cron
diff --git a/security/crowdsec/distinfo b/security/crowdsec/distinfo
index 9cb7e50d131c..fc31557d4e7f 100644
--- a/security/crowdsec/distinfo
+++ b/security/crowdsec/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1713296982
-SHA256 (go/security_crowdsec/crowdsec-v1.6.1/v1.6.1.mod) = b7957886889cef4dd7166ae8996a93d0f2f5071a8b2155c16c190388f71baeee
-SIZE (go/security_crowdsec/crowdsec-v1.6.1/v1.6.1.mod) = 10066
-SHA256 (go/security_crowdsec/crowdsec-v1.6.1/v1.6.1.zip) = fbcee972b1c5b24b4b3a278381f2bd8837ca122e302defc747a76123a8c079c9
-SIZE (go/security_crowdsec/crowdsec-v1.6.1/v1.6.1.zip) = 1483959
+TIMESTAMP = 1717420493
+SHA256 (go/security_crowdsec/crowdsec-v1.6.2-final/v1.6.2-final.mod) = 0cd8f4a237f0901164c8d80fa76c6bc7354054e867c7719c9691f4e5ae4b4a31
+SIZE (go/security_crowdsec/crowdsec-v1.6.2-final/v1.6.2-final.mod) = 10156
+SHA256 (go/security_crowdsec/crowdsec-v1.6.2-final/v1.6.2-final.zip) = e07898b78bd6ff09a1913b7cb8f69b6c3dd3c2add5b4554cc5b8084c91eb96ff
+SIZE (go/security_crowdsec/crowdsec-v1.6.2-final/v1.6.2-final.zip) = 1505724
diff --git a/security/crowdsec/files/crowdsec.in b/security/crowdsec/files/crowdsec.in
index 703a3045657d..ba0a40a19250 100644
--- a/security/crowdsec/files/crowdsec.in
+++ b/security/crowdsec/files/crowdsec.in
@@ -14,8 +14,6 @@
 #				Default is "%%PREFIX%%/etc/crowdsec/config.yaml".
 # crowdsec_machine_name (str):	Name for the crowdsec instance when it's running its own lapi.
 #				Default is "localhost".
-# crowdsec_flags (str):	Set the extra flags to run the agent.
-#				Default is ""
 
 . /etc/rc.subr
 
@@ -27,7 +25,6 @@ load_rc_config "$name"
 : "${crowdsec_enable:=NO}"
 : "${crowdsec_config:=%%PREFIX%%/etc/crowdsec/config.yaml}"
 : "${crowdsec_machine_name:=localhost}"
-: "${crowdsec_flags:=}"
 
 pidfile=/var/run/${name}_daemon.pid
 pidfile_crowdsec=/var/run/${name}.pid
@@ -35,7 +32,7 @@ required_files="$crowdsec_config"
 command="/usr/sbin/daemon"
 command_crowdsec="%%PREFIX%%/bin/crowdsec"
 command_cscli="%%PREFIX%%/bin/cscli"
-command_args="-f -P ${pidfile} -p ${pidfile_crowdsec} -r -R 10 -t \"${name}\" -- ${command_crowdsec} -c ${crowdsec_config} ${crowdsec_flags}"
+command_args="-f -P ${pidfile} -p ${pidfile_crowdsec} -r -R 10 -t \"${name}\" -- ${command_crowdsec} -c ${crowdsec_config}"
 reload_cmd="${name}_reload"
 start_precmd="${name}_precmd"
 configtest_cmd="${name}_configtest"
diff --git a/security/crowdsec/files/patch-pkg_csconfig_database.go b/security/crowdsec/files/patch-pkg_csconfig_database.go
deleted file mode 100644
index c34546376722..000000000000
--- a/security/crowdsec/files/patch-pkg_csconfig_database.go
+++ /dev/null
@@ -1,36 +0,0 @@
---- pkg/csconfig/database.go.orig	2024-04-24 21:31:39 UTC
-+++ pkg/csconfig/database.go
-@@ -76,26 +76,24 @@ func (c *Config) LoadDBConfig(inCli bool) error {
- 		if c.DbConfig.UseWal == nil {
- 			dbDir := filepath.Dir(c.DbConfig.DbPath)
- 			isNetwork, fsType, err := types.IsNetworkFS(dbDir)
--			if err != nil {
-+			switch {
-+			case err != nil:
- 				log.Warnf("unable to determine if database is on network filesystem: %s", err)
- 				log.Warning("You are using sqlite without WAL, this can have a performance impact. If you do not store the database in a network share, set db_config.use_wal to true. Set explicitly to false to disable this warning.")
--				return nil
--			}
--			if isNetwork {
-+			case isNetwork:
- 				log.Debugf("database is on network filesystem (%s), setting useWal to false", fsType)
- 				c.DbConfig.UseWal = ptr.Of(false)
--			} else {
-+			default:
- 				log.Debugf("database is on local filesystem (%s), setting useWal to true", fsType)
- 				c.DbConfig.UseWal = ptr.Of(true)
- 			}
- 		} else if *c.DbConfig.UseWal {
- 			dbDir := filepath.Dir(c.DbConfig.DbPath)
- 			isNetwork, fsType, err := types.IsNetworkFS(dbDir)
--			if err != nil {
-+			switch {
-+			case err != nil:
- 				log.Warnf("unable to determine if database is on network filesystem: %s", err)
--				return nil
--			}
--			if isNetwork {
-+			case isNetwork:
- 				log.Warnf("database seems to be stored on a network share (%s), but useWal is set to true. Proceed at your own risk.", fsType)
- 			}
- 		}
diff --git a/security/crowdsec/files/patch-pkg_types_getfstype.go b/security/crowdsec/files/patch-pkg_types_getfstype.go
deleted file mode 100644
index 9b9775265421..000000000000
--- a/security/crowdsec/files/patch-pkg_types_getfstype.go
+++ /dev/null
@@ -1,8 +0,0 @@
---- pkg/types/getfstype.go.orig	2024-04-24 21:23:59 UTC
-+++ pkg/types/getfstype.go
-@@ -1,4 +1,4 @@
--//go:build !windows
-+//go:build !windows && !freebsd
- 
- package types
- 
diff --git a/security/crowdsec/files/patch-pkg_types_getfstype__freebsd.go b/security/crowdsec/files/patch-pkg_types_getfstype__freebsd.go
deleted file mode 100644
index 0fe3a5157120..000000000000
--- a/security/crowdsec/files/patch-pkg_types_getfstype__freebsd.go
+++ /dev/null
@@ -1,28 +0,0 @@
---- pkg/types/getfstype_freebsd.go.orig	2024-04-24 21:25:32 UTC
-+++ pkg/types/getfstype_freebsd.go
-@@ -0,0 +1,25 @@
-+//go:build freebsd
-+
-+package types
-+
-+import (
-+    "fmt"
-+    "syscall"
-+)
-+
-+func GetFSType(path string) (string, error) {
-+	var fsStat syscall.Statfs_t
-+
-+	if err := syscall.Statfs(path, &fsStat); err != nil {
-+		return "", fmt.Errorf("failed to get filesystem type: %w", err)
-+	}
-+
-+	bs := fsStat.Fstypename
-+
-+	b := make([]byte, len(bs))
-+	for i, v := range bs {
-+		b[i] = byte(v)
-+	}
-+
-+	return string(b), nil
-+}
diff --git a/security/crowdsec/pkg-plist b/security/crowdsec/pkg-plist
index dd1afd08742f..d96c9de762dd 100644
--- a/security/crowdsec/pkg-plist
+++ b/security/crowdsec/pkg-plist
@@ -49,5 +49,7 @@ lib/crowdsec/plugins/notification-sentinel
 lib/crowdsec/plugins/notification-slack
 lib/crowdsec/plugins/notification-splunk
 @dir %%ETCDIR%%/hub
-@dir /var/db/crowdsec/data
+@dir %%ETCDIR%%/acquis.d
 @dir /var/db/crowdsec
+@dir /var/db/crowdsec/data
+@dir /var/db/crowdsec/data/trace