0

I was able to achieve ssl offloading with Haproxy. So great product and appreciate that capability!

With that said, I need to doing mutual TLS but am a little confused on how that will work with the ingress controller configmap.

Going through this reference i've created a client cert, intermediate cert and root cert.

To note, I am terminating the ssl cert (which is from letsencrpt) on the load balancer currently.

However, the client cert and org CA are different than the lesencrypt tls/ssl cert that I have assigned as the SSL now; does that matter?

So, the first question I would have is does the ssl-certificate have to be set to the CA that will sign the client and server certs or can I just use the new ones I created in the instruction.

Setting up the configmap.

This is the part i'm confused on.

You can setup server-ca and server-crt but I don't think that applys here because after the ssl offloading there is nothing meant to be checked. However, I do want mTLS via the ssl termination.

So there is an configuration client-ca

Sets the client certificate authority enabling HAProxy to check clients certificate (TLS authentication), thus enabling client mTLS. NB, ssl-offloading should be enabled for TLS authentication to work.

The client in this case being the actual client I want which is the device/frontend. Not the loadbalancer acting as a client to the backend server.

When I look at how this is setup:

frontend mysite
 bind 192.168.56.20:80
 bind 192.168.56.20:443  ssl crt /etc/haproxy/certs/ssl.crt verify required ca-file /etc/haproxy/certs/intermediate-ca.crt ca-verify-file /etc/haproxy/certs/root-ca.crt
 http-request redirect scheme https unless { ssl_fc }
 default_backend apiservers

Is it possible to do the same with the controller configmap as what is listed here below? There's a lot more going on that what I am seeing as flags / configurations that are in this methodology of applying client mTLS. Is there a way to achieve this in kubernetes without configmap?

The ssl parameter enables SSL termination for this listener. The crt parameter identifies the location of the PEM-formatted SSL certificate. This certificate should contain both the public certificate and private key.

You can restrict who can access your application by giving trusted clients a certificate that they must present when connecting. HAProxy will check for this if you add a verify required parameter to the bind line, as shown:

  • the ssl argument enables HTTPS
  • the crt argument specifies the server SSL certificate, which you will typically obtain from a certificate provider like Let’s Encrypt
  • the verify required argument requires clients to send a client certificate
  • the ca-file argument specifies the intermediate certificate with which we will verify that the client’s certificate has been signed with our organization’s CA
  • the ca-verify-file argument (introduced in HAProxy 2.2) includes the root CA certificate, allowing HAProxy to send a shorter list of CAs to the client in the SERVER HELLO message that will be used for verification, but keeping upper level CAs, such as the root, out of that list. HAProxy requires the root CA to be set with this argument or else included in the intermediate-ca.crt file (compatibility with older versions of HAProxy).

Also, my reasoning for now wanting to use letsencrypt and rather a private CA is because I can't renew device certificates every 60 - 90 days. That would not be efficient. In this case, and please let me know otherwise, I think it better to use either a real key/cert provider or in development testing utilize the openssl certs like in the HAProxy instruction.

It's odd but you really have to think about what a "client" is with these abstractions because I would never use this for a normal web page login but rather the server to server communication and in that sense this server is a client to this server. Or in my case this device is a client to this loadbalancer.

1 Answer 1

0

Client certificate verification happens as part of the TLS handshake so you can't have the TLS termination happening at the load balancer and then the client certificate check happening somewhere further downstream.

That would basically be a Man-In-The-Middle attack :-)

In this case your options are to either handle the SSL termination at the HAProxy level or do the client cert check at the load balancer level (if possible).

If you decide to go the HAProxy route, I found this article very helpful when I was getting started with mTLS. It's an older article but still very useful.

https://www.loadbalancer.org/blog/client-certificate-authentication-with-haproxy/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .