Skip to content

Commit 6e689d9

Browse files
author
he2ss
committed
add bouncers sub-folder
1 parent e5b7f00 commit 6e689d9

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ custom_binary.sh del 1.2.3.4/32 3600 "test blacklist"
8484
## Configuration
8585

8686
Before starting the `crowdsec-custom-bouncer` service, please edit the configuration to add your API url and key.
87-
The default configuration file is located under : `/etc/crowdsec/crowdsec-custom-bouncer/`
87+
The default configuration file is located under : `/etc/crowdsec/bouncers/`
8888

8989
```sh
90-
$ vim /etc/crowdsec/custom-bouncer/crowdsec-custom-bouncer.yaml
90+
$ vim /etc/crowdsec/bouncers/crowdsec-custom-bouncer.yaml
9191
```
9292

9393
```yaml

debian/postinst

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ fi
2222

2323

2424
TMP=`mktemp -p /tmp/`
25-
cp /etc/crowdsec/crowdsec-custom-bouncer/crowdsec-custom-bouncer.yaml ${TMP}
26-
API_KEY=${API_KEY} envsubst < ${TMP} > /etc/crowdsec/crowdsec-custom-bouncer/crowdsec-custom-bouncer.yaml
25+
cp /etc/crowdsec/bouncers/crowdsec-custom-bouncer.yaml ${TMP}
26+
API_KEY=${API_KEY} envsubst < ${TMP} > /etc/crowdsec/bouncers/crowdsec-custom-bouncer.yaml
2727
rm ${TMP}
2828

2929
if [ ${START} -eq 0 ] ; then
3030
echo "no api key was generated"
3131
fi
3232

33-
echo "please enter the binary path in '/etc/crowdsec/crowdsec-custom-bouncer/crowdsec-custom-bouncer.yaml' and start the bouncer via 'sudo systemctl start crowdsec-custom-bouncer' "
33+
echo "please enter the binary path in '/etc/crowdsec/bouncers/crowdsec-custom-bouncer.yaml' and start the bouncer via 'sudo systemctl start crowdsec-custom-bouncer' "

debian/rules

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ override_dh_auto_install:
1818
mkdir -p debian/crowdsec-custom-bouncer/usr/sbin
1919
cp crowdsec-custom-bouncer debian/crowdsec-custom-bouncer/usr/sbin
2020
mkdir -p debian/crowdsec-custom-bouncer/etc/systemd/system/
21-
mkdir -p debian/crowdsec-custom-bouncer/etc/crowdsec/crowdsec-custom-bouncer/
22-
BIN=/sbin/crowdsec-custom-bouncer CFG=/etc/crowdsec/crowdsec-custom-bouncer envsubst < config/crowdsec-custom-bouncer.service > debian/crowdsec-custom-bouncer/etc/systemd/system/crowdsec-custom-bouncer.service
23-
cp config/crowdsec-custom-bouncer.yaml debian/crowdsec-custom-bouncer/etc/crowdsec/crowdsec-custom-bouncer/
21+
mkdir -p debian/crowdsec-custom-bouncer/etc/crowdsec/bouncers/
22+
BIN=/sbin/crowdsec-custom-bouncer CFG=/etc/crowdsec/bouncers envsubst < config/crowdsec-custom-bouncer.service > debian/crowdsec-custom-bouncer/etc/systemd/system/crowdsec-custom-bouncer.service
23+
cp config/crowdsec-custom-bouncer.yaml debian/crowdsec-custom-bouncer/etc/crowdsec/bouncers/

rpm/SPECS/crowdsec-custom-bouncer.spec

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Summary: Custom bouncer for Crowdsec
55

66
License: MIT
77
URL: https://crowdsec.net
8-
Source: cs-custom-bouncer-%(echo $VERSION).tar.gz
8+
Source: crowdsec-custom-bouncer-%(echo $VERSION).tar.gz
99
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
1010

1111
BuildRequires: git
@@ -24,7 +24,7 @@ BuildRequires: make
2424
%global __mangle_shebangs_exclude_from /usr/bin/env
2525

2626
%prep
27-
%setup -n cs-custom-bouncer-%{version}
27+
%setup -n crowdsec-custom-bouncer-bouncer-%{version}
2828

2929
%build
3030
BUILD_VERSION=%{local_version} make
@@ -37,7 +37,7 @@ rm ${TMP}
3737
rm -rf %{buildroot}
3838
mkdir -p %{buildroot}/usr/sbin
3939
install -m 755 -D %{name} %{buildroot}%{_bindir}/%{name}
40-
install -m 600 -D config/%{name}.yaml %{buildroot}/etc/crowdsec/%{name}/%{name}.yaml
40+
install -m 600 -D config/%{name}.yaml %{buildroot}/etc/crowdsec/bouncers/%{name}.yaml
4141
install -m 644 -D config/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
4242

4343
%clean
@@ -47,7 +47,7 @@ rm -rf %{buildroot}
4747
%defattr(-,root,root,-)
4848
/usr/bin/%{name}
4949
%{_unitdir}/%{name}.service
50-
%config(noreplace) /etc/crowdsec/%{name}/%{name}.yaml
50+
%config(noreplace) /etc/crowdsec/bouncers/%{name}.yaml
5151

5252

5353
%post
@@ -73,15 +73,15 @@ if [ "$?" -eq "0" ] ; then
7373
fi
7474

7575
TMP=`mktemp -p /tmp/`
76-
cp /etc/crowdsec/crowdsec-custom-bouncer/crowdsec-custom-bouncer.yaml ${TMP}
77-
API_KEY=${API_KEY} envsubst < ${TMP} > /etc/crowdsec/crowdsec-custom-bouncer/crowdsec-custom-bouncer.yaml
76+
cp /etc/crowdsec/bouncers/crowdsec-custom-bouncer.yaml ${TMP}
77+
API_KEY=${API_KEY} envsubst < ${TMP} > /etc/crowdsec/bouncers/crowdsec-custom-bouncer.yaml
7878
rm ${TMP}
7979

8080
if [ ${START} -eq 0 ] ; then
8181
echo "no api key was generated, won't start service"
8282
fi
8383

84-
echo "please enter the binary path in '/etc/crowdsec/crowdsec-custom-bouncer/crowdsec-custom-bouncer.yaml' and start the bouncer via 'sudo systemctl start crowdsec-custom-bouncer' "
84+
echo "please enter the binary path in '/etc/crowdsec/bouncers/crowdsec-custom-bouncer.yaml' and start the bouncer via 'sudo systemctl start crowdsec-custom-bouncer' "
8585

8686

8787

scripts/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
BIN_PATH_INSTALLED="/usr/local/bin/crowdsec-custom-bouncer"
33
BIN_PATH="./crowdsec-custom-bouncer"
4-
CONFIG_DIR="/etc/crowdsec/crowdsec-custom-bouncer/"
4+
CONFIG_DIR="/etc/crowdsec/bouncers/"
55
PID_DIR="/var/run/crowdsec/"
66
SYSTEMD_PATH_FILE="/etc/systemd/system/crowdsec-custom-bouncer.service"
77
API_KEY=""

scripts/uninstall.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
SYSTEMD_PATH_FILE="/etc/systemd/system/crowdsec-custom-bouncer.service"
44
LOG_FILE="/var/log/crowdsec-custom-bouncer.log"
5-
CONFIG_DIR="/etc/crowdsec/crowdsec-custom-bouncer/"
5+
CONFIG_DIR="/etc/crowdsec/bouncers"
66
BIN_PATH_INSTALLED="/usr/local/bin/crowdsec-custom-bouncer"
77

88
uninstall() {
99
systemctl stop crowdsec-custom-bouncer
10-
rm -rf "${CONFIG_DIR}"
10+
rm -f "${CONFIG_DIR}/crowdsec-custom-bouncer.yaml"
1111
rm -f "${SYSTEMD_PATH_FILE}"
1212
rm -f "${BIN_PATH_INSTALLED}"
1313
rm -f "${LOG_FILE}"

0 commit comments

Comments
 (0)