Repository navigation
2.4.0-beta.4: gRPC streams with AppSec on
Pre-release2.4.0-beta.4: gRPC streams pass a listener that has AppSec on
A beta of 2.4.0, one fix on top of beta.3, from the second report in #37. It only matters to an installation that has CrowdSec's AppSec on and publishes a gRPC service.
Getting the beta
- Updates page: tick Also offer beta versions, then update.
- Docker:
ghcr.io/avandeputte/haproxy-manager:2.4.0-beta.4 install.sh: the usual command with--ref beta.
What was wrong
To let AppSec read a request body, the listener held each request until its body was in. A gRPC stream is a request whose body never ends, so a bidirectional gRPC call never reached its server: it waited until the client gave up, and HAProxy logged it with <NOSRV> and CR--. NetBird clients connected and never saw their peers.
What changed
A service with HTTP/2 to the servers ticked is taken to speak gRPC. Its requests with a Content-Type of application/grpc are now let through without waiting, and CrowdSec is asked about them by address, path and headers, without their body.
- Only those requests. On any other service a request that claims to be gRPC still waits and is inspected, so a visitor cannot switch the inspection off by saying so.
- Every other request waits for its whole body exactly as before, however slowly it arrives.
- A listener with no gRPC service is written as it always was. One that carries such a service gets the waiting per request (
http-request wait-for-body) instead ofoption http-buffer-request.
So for a gRPC service behind AppSec: tick HTTP/2 to the servers (in the Service section, or use the gRPC service recipe), and Apply. The guide has it under gRPC beside AppSec.
Tested
On the container image (HAProxy 3.4) with a real CrowdSec AppSec and a real gRPC server: with AppSec on, a bidirectional stream delivered nothing before the change and stayed open with its messages after it. AppSec still refused a body attack on another service, on the gRPC service's own host as a form post, and on another service when the request claimed to be gRPC. A request whose body stalls is still answered 408 after the client timeout, and one that trickles is still held.
HAProxy 2.4, 2.6 and 3.0 accept the new lines in a configuration check; the behaviour itself was only run on 3.4.
Not tried: NetBird itself.