tgir icon indicating copy to clipboard operation
tgir copied to clipboard

Enforce security to prevent churn and connection exhausting

Open stefano-vardanega opened this issue 4 years ago • 13 comments

HAProxy, load balancer, socket tuning ?

stefano-vardanega avatar Oct 20 '20 11:10 stefano-vardanega

This is a good one! 2 questions:

  1. Can we agree on K8S as the baseline? Ingress makes this much easier to capture, follow along & keep it relevant for longer-term.

  2. Any specific K8S that you would consider using for RabbitMQ? Apparently there are 168+ to choose from 🤯 We have covered GKE & DKE already, but LKE & SKE are equally easy.

gerhard avatar Oct 26 '20 16:10 gerhard

Yeah, great. Go for k8s. I personally use Digital Ocean k8s to publish an MQTTS on 8883, but without ingress. So I'm greatly interested in DO ;).

stefano-vardanega avatar Oct 26 '20 17:10 stefano-vardanega

Perfect, Digital Ocean Kubernetes Engine it is.

I feel that this Twitter thread with @evoxmusic is also related. Do those problems resonate with you @stefano-vardanega?

gerhard avatar Oct 26 '20 18:10 gerhard

Good 👍 That's exactly my current concerns!

stefano-vardanega avatar Oct 26 '20 19:10 stefano-vardanega

Feel free to share your thoughts on the above @Gsantomaggio 😉

gerhard avatar Oct 26 '20 19:10 gerhard

Oh ! that's an interesting topic.

There is also Istio Traffic Management, here an example with RabbitMQ.

The same with HA-Proxy, we can also play with the TCP Backlog queues and TIME_WAIT.

Gsantomaggio avatar Oct 26 '20 21:10 Gsantomaggio

Istio will be a good one to start with, but I expect performance to become an issue soon. Let's measure and see if HAproxy is as good as it claims.

gerhard avatar Oct 26 '20 22:10 gerhard

Just a thought ... Would be interesting to try to implement an XDP_DROP

It would drop / avoid ddos attach or not valid connections

interesting post to read

Gsantomaggio avatar Oct 27 '20 16:10 Gsantomaggio

That sounds like a great R&D project, I'm thinking longer-term. I bet @essen would be interested in eBPF too.

Short-term, we should definitely lean on Envoy/Istio & maybe HAproxy as a first step, then iterate towards eBPF.

gerhard avatar Oct 27 '20 17:10 gerhard

Can we agree on K8S as the baseline? Ingress makes this much easier to capture, follow along & keep it relevant for longer-term.

I'd like to add that the standard k8s ingress supports only HTTP(s) so it is ok for management UI and not for the amqp.

It should be possible to use the SNI TLS extension to manage the traffic.

HAProxy, Traefik etc support TLS with SNI and also the strict sni policy

Here an example of amqps with SNI: Screenshot 2020-11-09 at 22 10 56

This is still work in progress btw!

Gsantomaggio avatar Nov 09 '20 21:11 Gsantomaggio

Looking great Gabriele, this will be a great TGIR 👍🏻

Would you find it useful to fork and start preparing the setup? I would recommend starting from the S01E07 branch (soon to be merged & deleted) so that we can hit the ground running 😉

gerhard avatar Nov 09 '20 22:11 gerhard

Ok, I did some test with Traefik using SNI and strict sni configuration, using a configuration like this:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
  name: rabbitmq-big-ingress
spec:
  routes:
  - match: HostSNI(`rabbit.bigcluster`)
    services:
    - name: big-cluster
      port: 5671
  tls:
     passthrough: true
     secretName: tls-big-secret
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
  name: rabbitmq-ingress
spec:
  routes:
  - match: HostSNI(`rabbit.cluster`)
    services:
    - name: cluster
      port: 5671
  tls:
     passthrough: true
     secretName: tls-secret

we can use the same IP address and handle different rabbitmq clusters.

We have to finish it and test it, for the moment the configuration it seems to work correctly

Gsantomaggio avatar Nov 11 '20 11:11 Gsantomaggio

image

gerhard avatar Dec 31 '20 16:12 gerhard