Skip to content

Commit ecacaf3

Browse files
imevulcursoragent
andcommitted
fix(crowdsec): fetch bouncer binary from GitHub releases in Docker build.
Avoids flaky packagecloud/apt installs and systemd postinst failures during image build. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 7f5df91 commit ecacaf3

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

contrib/crowdsec/Dockerfile.bouncer

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
11
# EvuProxy CrowdSec nftables bouncer — host network + NET_ADMIN updates inet evuproxy.
2-
# Built locally by install.sh / docker compose (no official CrowdSec bouncer image on Docker Hub).
2+
# Binary from official GitHub releases (no packagecloud/apt during image build).
33

44
FROM debian:bookworm-slim
55

6+
ARG BOUNCER_VERSION=0.0.34
7+
ARG TARGETARCH
8+
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
611
RUN apt-get update \
7-
&& apt-get install -y --no-install-recommends curl ca-certificates gettext-base \
8-
&& curl -fsSL https://packagecloud.io/install/repositories/crowdsec/crowdsec/script.deb.sh | bash \
9-
&& apt-get install -y --no-install-recommends crowdsec-firewall-bouncer-nftables \
12+
&& apt-get install -y --no-install-recommends ca-certificates curl gettext-base \
1013
&& rm -rf /var/lib/apt/lists/*
1114

15+
RUN set -e; \
16+
raw_arch="${TARGETARCH:-$(dpkg --print-architecture)}"; \
17+
case "$raw_arch" in \
18+
amd64) bouncer_arch=amd64 ;; \
19+
arm64) bouncer_arch=arm64 ;; \
20+
arm|armhf|armv7) bouncer_arch=armv7 ;; \
21+
386|i386) bouncer_arch=386 ;; \
22+
ppc64le) bouncer_arch=ppc64le ;; \
23+
riscv64) bouncer_arch=riscv64 ;; \
24+
s390x) bouncer_arch=s390x ;; \
25+
*) echo "unsupported architecture for cs-firewall-bouncer: ${raw_arch}" >&2; exit 1 ;; \
26+
esac; \
27+
curl -fsSL "https://github.com/crowdsecurity/cs-firewall-bouncer/releases/download/v${BOUNCER_VERSION}/crowdsec-firewall-bouncer-linux-${bouncer_arch}.tgz" \
28+
| tar -xzf - -C /tmp; \
29+
install -m 0755 "/tmp/crowdsec-firewall-bouncer-v${BOUNCER_VERSION}/crowdsec-firewall-bouncer" /usr/local/bin/crowdsec-firewall-bouncer; \
30+
rm -rf "/tmp/crowdsec-firewall-bouncer-v${BOUNCER_VERSION}"
31+
1232
COPY docker-bouncer-entrypoint.sh /entrypoint.sh
1333
RUN chmod +x /entrypoint.sh
1434

contrib/crowdsec/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ CROWDSEC_INSTALL_YES=1 CROWDSEC_INSTALL_MODE=docker make crowdsec-install
6262
| [`acquis.yaml.example`](acquis.yaml.example) | Log sources (copied to `acquis.yaml` by install) |
6363
| [`docker-compose.example.yaml`](docker-compose.example.yaml) | Docker: CrowdSec + locally built nft bouncer (`Dockerfile.bouncer`) |
6464
| [`docker-bouncer.yaml.example`](docker-bouncer.yaml.example) | Docker bouncer config (copied to `docker-bouncer.yaml` by install) |
65-
| [`Dockerfile.bouncer`](Dockerfile.bouncer) | Builds `evuproxy-crowdsec-firewall-bouncer:local` from CrowdSec packages |
65+
| [`Dockerfile.bouncer`](Dockerfile.bouncer) | Builds `evuproxy-crowdsec-firewall-bouncer:local` (GitHub release binary + config) |
6666
| [`native-bouncer.yaml.example`](native-bouncer.yaml.example) | Native nft bouncer config template (table/set for EvuProxy) |
6767
| [`.env.example`](.env.example) | Docker: bouncer API key template (install writes `.env`) |
6868
| [`.install-mode`](.install-mode) | Legacy copy beside this directory (gitignored) |
@@ -232,6 +232,7 @@ Store the API key in `/etc/evuproxy/crowdsec-bouncer.key` when merging manually.
232232
| Symptom | Things to check |
233233
|---------|------------------|
234234
| Install fails: missing key | Run `install.sh bouncer-key` or delete bouncer and re-run install (see script message) |
235+
| Bouncer image build fails | Ensure GitHub releases are reachable from the host; re-run `docker compose -f docker-compose.example.yaml build crowdsec-firewall-bouncer`. Or use native: `CROWDSEC_INSTALL_MODE=native make crowdsec-install` |
235236
| Bouncer auth errors | `.env` key matches `cscli bouncers list`; LAPI at `http://127.0.0.1:8080` |
236237
| No decisions | Hub collection installed; logs acquired (`cscli metrics show acquisition`) |
237238
| Set always empty | Bouncer running with `NET_ADMIN`, `network_mode: host`; EvuProxy `crowdsec.enabled` + reload |

0 commit comments

Comments
 (0)