aboutsummaryrefslogtreecommitdiff
path: root/security/crowdsec/files
diff options
context:
space:
mode:
authorSofian Brabez <sbz@FreeBSD.org>2021-03-24 15:45:18 +0000
committerSofian Brabez <sbz@FreeBSD.org>2021-03-24 15:45:18 +0000
commit158b8c35949a5d507bd35182ad88f577facba8c3 (patch)
treeffad091cd195eeb8a8d23adfe4b10e7ad46d187b /security/crowdsec/files
parent94a732f82f241cb1efea52915f0a3814e3a87212 (diff)
downloadports-158b8c35949a5d507bd35182ad88f577facba8c3.tar.gz
ports-158b8c35949a5d507bd35182ad88f577facba8c3.zip
Notes
Diffstat (limited to 'security/crowdsec/files')
-rw-r--r--security/crowdsec/files/crowdsec.in49
1 files changed, 49 insertions, 0 deletions
diff --git a/security/crowdsec/files/crowdsec.in b/security/crowdsec/files/crowdsec.in
new file mode 100644
index 000000000000..5c2c632de170
--- /dev/null
+++ b/security/crowdsec/files/crowdsec.in
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: crowdsec
+# REQUIRE: LOGIN DAEMON NETWORKING
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# crowdsec_enable (bool): Set it to YES to enable crowdsec agent.
+# Default is "NO".
+# crowdsec_config (str): Set the agent config path.
+# Default is "%%PREFIX%%/etc/crowdsec/config.yaml".
+# crowdsec_flags (str): Set the extra flags to run agent.
+# Default is ""
+
+. /etc/rc.subr
+
+name=crowdsec
+desc="Crowdsec Agent"
+rcvar=crowdsec_enable
+
+load_rc_config $name
+
+: ${crowdsec_enable:="NO"}
+: ${crowdsec_config:="%%PREFIX%%/etc/crowdsec/config.yaml"}
+: ${crowdsec_flags:=""}
+
+pidfile=/var/run/${name}.pid
+command="%%PREFIX%%/bin/${name}"
+start_cmd="${name}_start"
+configtest_cmd="${name}_configtest"
+extra_commands="configtest reload"
+
+crowdsec_start()
+{
+ /usr/sbin/daemon -f -p ${pidfile} -t "${desc}" \
+ ${command} -c ${crowdsec_config} ${crowdsec_flags}
+}
+
+crowdsec_configtest()
+{
+ echo "Performing sanity check on ${name} configuration."
+ eval ${command} -c ${crowdsec_config} -t
+}
+
+run_rc_command "$1"