Skip to content

Commit

Permalink
security/crowdsec: update to 1.3.2
Browse files Browse the repository at this point in the history
PR:	262426
Reported by:	marco+freebsd@crowdsec.net (maintainer)
  • Loading branch information
fernape committed Mar 12, 2022
1 parent bdee6b5 commit d6ce96e
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 60 deletions.
55 changes: 30 additions & 25 deletions security/crowdsec/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
PORTNAME= crowdsec
PORTVERSION= 1.2.3 # NOTE: change BUILD_VERSION and BUILD_TAG as well
PORTREVISION= 1
PORTVERSION= 1.3.2 # NOTE: change BUILD_VERSION and BUILD_TAG as well
DISTVERSIONPREFIX= v
CATEGORIES= security

Expand All @@ -15,41 +14,39 @@ BUILD_DEPENDS= git:devel/git@lite \
jq:textproc/jq

USES= gmake
ALL_TARGET= build

USE_GITHUB= yes
GH_ACCOUNT= crowdsecurity
GH_PROJECT= crowdsec
GH_TAGNAME= v1.2.3-freebsd
GH_TAGNAME= v1.3.2-freebsd-wip
#GH_TAGNAME is automatically set from DISTVERSION

OPTIONS_DEFINE= FIREWALL_BOUNCER
OPTIONS_DEFAULT=

FIREWALL_BOUNCER_DESC= Depend on security/crowdsec-firewall-bouncer
FIREWALL_BOUNCER_RUN_DEPENDS= crowdsec-firewall-bouncer>=0.0.23.r2:security/crowdsec-firewall-bouncer

USE_RC_SUBR= crowdsec

SUB_FILES= pkg-message \
pkg-install \
pkg-deinstall
SUB_FILES= pkg-deinstall pkg-install pkg-message

# BUILD_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
# BUILD_TAG=$(git rev-parse HEAD)
MAKE_ENV= BUILD_VERSION="v1.2.3" \
BUILD_TAG="fc4be1e0ffc5888f2824358464cb2426cd4472e1"
MAKE_ENV= BUILD_VERSION="v1.3.2" \
BUILD_TAG="716251323da59f1ce04fb1fc38af0a72629b5d78" \
DEFAULT_CONFIGDIR="${PREFIX}/etc/crowdsec" \
DEFAULT_DATADIR="/var/db/crowdsec/data"

PLUGIN_DIR= ${PREFIX}/lib/crowdsec/plugins
STAGE_PLUGINS= ${STAGEDIR}${PLUGIN_DIR}
STAGE_BIN= ${STAGEDIR}${PREFIX}/bin

post-patch:
@${REINPLACE_CMD} 's,/etc/crowdsec/,${ETCDIR}/,g' \
${WRKSRC}/pkg/csconfig/config.go \
${WRKSRC}/pkg/cstest/hubtest_item.go \
${WRKSRC}/cmd/crowdsec-cli/machines.go \
${WRKSRC}/cmd/crowdsec-cli/main.go \
${WRKSRC}/cmd/crowdsec/main.go \
${WRKSRC}/config/config.yaml \
${WRKSRC}/config/profiles.yaml

@${REINPLACE_CMD} 's,/var/lib/,/var/db/,g' \
${WRKSRC}/pkg/csconfig/config.go \
${WRKSRC}/pkg/metabase/database.go \
${WRKSRC}/config/config.yaml \
${WRKSRC}/config/profiles.yaml

Expand Down Expand Up @@ -81,6 +78,9 @@ do-install:
@${MV} ${STAGEDIR}${ETCDIR}/config.yaml \
${STAGEDIR}${ETCDIR}/config.yaml.sample

@${MV} ${STAGEDIR}${ETCDIR}/console.yaml \
${STAGEDIR}${ETCDIR}/console.yaml.sample

@${MV} ${STAGEDIR}${ETCDIR}/profiles.yaml \
${STAGEDIR}${ETCDIR}/profiles.yaml.sample

Expand All @@ -96,19 +96,19 @@ do-install:

@${MKDIR} ${STAGEDIR}${ETCDIR}/notifications/email
@${MV} ${WRKSRC}/plugins/notifications/email/email.yaml \
${STAGEDIR}${ETCDIR}/notifications/email/email.yaml.sample
${STAGEDIR}${ETCDIR}/notifications/email.yaml.sample

@${MKDIR} ${STAGEDIR}${ETCDIR}/notifications/http
@${MV} ${WRKSRC}/plugins/notifications/http/http.yaml \
${STAGEDIR}${ETCDIR}/notifications/http/http.yaml.sample
${STAGEDIR}${ETCDIR}/notifications/http.yaml.sample

@${MKDIR} ${STAGEDIR}${ETCDIR}/notifications/slack
@${MV} ${WRKSRC}/plugins/notifications/slack/slack.yaml \
${STAGEDIR}${ETCDIR}/notifications/slack/slack.yaml.sample
${STAGEDIR}${ETCDIR}/notifications/slack.yaml.sample

@${MKDIR} ${STAGEDIR}${ETCDIR}/notifications/splunk
@${MV} ${WRKSRC}/plugins/notifications/splunk/splunk.yaml \
${STAGEDIR}${ETCDIR}/notifications/splunk/splunk.yaml.sample
${STAGEDIR}${ETCDIR}/notifications/splunk.yaml.sample

# updated by "cscli machines" at first service start
@${MV} ${STAGEDIR}${ETCDIR}/local_api_credentials.yaml \
Expand All @@ -126,10 +126,15 @@ do-install:
@${MKDIR} ${STAGEDIR}/var/db/crowdsec/data

#
# Log rotation
# Cleanup
#

@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
${INSTALL_DATA} ${FILESDIR}/crowdsec.conf-newsyslog ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d/crowdsec.conf.sample

@${RM} ${STAGEDIR}${ETCDIR}/crowdsec.service
@${RM} ${STAGEDIR}${ETCDIR}/dev.yaml
@${RM} ${STAGEDIR}${ETCDIR}/user.yaml
@${RMDIR} ${STAGEDIR}${ETCDIR}/notifications/email
@${RMDIR} ${STAGEDIR}${ETCDIR}/notifications/http
@${RMDIR} ${STAGEDIR}${ETCDIR}/notifications/slack
@${RMDIR} ${STAGEDIR}${ETCDIR}/notifications/splunk

.include <bsd.port.mk>
6 changes: 3 additions & 3 deletions security/crowdsec/distinfo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
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
TIMESTAMP = 1646686224
SHA256 (crowdsecurity-crowdsec-v1.3.2-v1.3.2-freebsd-wip_GH0.tar.gz) = e805f8e60213fd49fa2e0fa182d6d91591dc26f378733139bd5609b5b914d5b3
SIZE (crowdsecurity-crowdsec-v1.3.2-v1.3.2-freebsd-wip_GH0.tar.gz) = 20005916
3 changes: 0 additions & 3 deletions security/crowdsec/files/crowdsec.conf-newsyslog

This file was deleted.

1 change: 1 addition & 0 deletions security/crowdsec/files/crowdsec.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

# PROVIDE: crowdsec
# BEFORE: crowdsec_firewall
# REQUIRE: LOGIN DAEMON NETWORKING
# KEYWORD: shutdown
#
Expand Down
32 changes: 9 additions & 23 deletions security/crowdsec/files/patch-Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
--- Makefile.orig 2021-12-21 21:18:22 UTC
--- Makefile.orig 2022-02-10 09:11:04 UTC
+++ Makefile
@@ -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)"
@@ -58,8 +58,8 @@ LD_OPTS_VARS= \
-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=$(DEFAULT_CONFIGDIR) \
-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=$(DEFAULT_DATADIR)

-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=-ldflags "-s -w $(LD_OPTS_VARS)"
-export LD_OPTS_STATIC=-ldflags "-s -w $(LD_OPTS_VARS) -extldflags '-static'"
+export LD_OPTS=-mod vendor -modcacherw -ldflags "-s -w $(LD_OPTS_VARS)"
+export LD_OPTS_STATIC=-mod vendor -modcacherw -ldflags "-s -w $(LD_OPTS_VARS) -extldflags '-static'"

-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
RELDIR = crowdsec-$(BUILD_VERSION)
11 changes: 5 additions & 6 deletions security/crowdsec/pkg-plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ bin/crowdsec-cli
@mode 0644
@sample %%ETCDIR%%/acquis.yaml.sample
@sample %%ETCDIR%%/config.yaml.sample
@sample %%ETCDIR%%/console.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
@sample %%ETCDIR%%/notifications/email.yaml.sample
@sample %%ETCDIR%%/notifications/http.yaml.sample
@sample %%ETCDIR%%/notifications/slack.yaml.sample
@sample %%ETCDIR%%/notifications/splunk.yaml.sample
%%ETCDIR%%/patterns/aws
%%ETCDIR%%/patterns/bacula
%%ETCDIR%%/patterns/bro
Expand All @@ -38,7 +39,6 @@ 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
Expand All @@ -47,4 +47,3 @@ lib/crowdsec/plugins/notification-splunk
@dir %%ETCDIR%%/hub
@dir /var/db/crowdsec/data
@dir /var/db/crowdsec
@dir etc/newsyslog.conf.d

0 comments on commit d6ce96e

Please sign in to comment.