How do you write a custom bouncer script fed from stdin ?
I'm trying to update my custom bouncer to use stdin but it looks like it is never called, and something crash without a proper error msg.
This is my script for testing purposes :
it never get called (output file doesn't exists)
23 Replies
Important Information
This post has been marked as resolved. If this is a mistake please press the red button below or type
/unresolve
© Created By WhyAydan for CrowdSec ❤️
Sample from my dockerfile (to see how I'm building the custom bouncer bin)
Do you have an entrypoint or is that being defined when you run or via the compose args?
No entrypoint. Just the CMD
and the
crowdsec-custom-bouncer.yaml
is trying to use $BINARY_PATH
?yes
Gitea
crowdsec-legacy-firewall-bouncer
Crowdsec firewall bouncer for systems that does not support ipset. Base on crowdsec-custom-bouncer
it's the default file and it does
afaik the custom bouncer doesnt read env keys, it only runs the local patcher
yeah if you set in the yaml the path to the binary does it work?
https://github.com/crowdsecurity/cs-custom-bouncer/blob/dc188f560ad1a428b6aead8aaf44ffb300b29956/pkg/cfg/config.go#L41-L48
GitHub
cs-custom-bouncer/pkg/cfg/config.go at dc188f560ad1a428b6aead8aaf44...
CrowdSec bouncer to use custom scripts. Contribute to crowdsecurity/cs-custom-bouncer development by creating an account on GitHub.
It does. I just fixed this issue. The env value was incorrect and it showd in the log. Also it work in non stdin mode
ahh okay, my lack of using the custom bouncer
fair
crowdsec-custom-bouncer.yaml.local
and you dont even see test?
nop
the file doesn't exist
And since you are probably asking yourself the question : iptables-nft and ipset don't work on my server (as for why idk) so I need to use iptables-legacy which the official firewall bouncer doesn't support
nah I remember your thread from december, I know the reason for making it 👍 I am going to play around with it to see what might be happening
Anything new ? I couldn't find a way to make it work yet
apologies, it slipped my mind, I added a todo for tomorrow morning to work on replicating it
Just so I can ask what is this image
FROM iptables-${IPTABLES_MODE} AS crowdsec-custom-bouncer
?the
iptables-${IPTABLES_MODE}
image ?
It's either iptables-legacy
or iptables-nft
depending on the build arg IPTABLES_MODE
They are declared in the same dockerfile
https://docs.docker.com/build/building/multi-stage/ It's a multi-stage build so I can have both a legacy and nft images
https://docs.docker.com/build/building/variables/#arg-usage-example which is use is defined with ARG
docker build --build-arg IPTABLES_MODE=legacy
I pushed a commented version of the DockerfileMy bad I forgot you linked your repo! will check it out soon i can see it ubuntu based that was the main thing I was missing
@AR2000 managed to debug the issue and its kinda stupid, we should also issue a fix to the binary a workaround for you right now is set this property in the yaml
This needs to be set basically > 0
as the code is checking if 0 > 1 and the check always fails
GitHub
fix: Feedviastdin total retires by LaurenceJJones · Pull Request #1...
If total retries is not set then it will never execute the binary because we start the for loop at 1, changing to 0 means it at least tries to execute the binary once before attempting the total re...
Merci beacoup. Mon script fonctionne desormais
Resolving How do you write a custom bouncer script fed from stdin ?
This has now been resolved. If you think this is a mistake please run
/unresolve