[mTLS] How to redirect to portal if client cert invalid/missing?

How could I handle something like this:

Secure an internal site with mTLS client certs.
But if a cert is invalid/missing, redirect to a portal with username password that generates the cert?

With a mTLS config like this I think it is not possible currently, and I would need something in front of it?

internal.example.com:443 {
tls {
provider manual
cert “/etc/ssl/certs/internal.example.com.crt”
key “/etc/ssl/private/internal.example.com.key”

    min_version TLSv1.3
    max_version TLSv1.3

    client_auth true
    client_auth_ca "/etc/ssl/internal-ca-bundle.pem"
}

proxy http://127.0.0.1:9000

}

If client-provided TLS certificate was missing, TLS handshake would just fail, so I don’t think this is currently possible in internal.example.com directly…

However I can implement support for allowing unauthenticated (when it comes to mTLS) clients to connect for the next version of Ferron 3.

I just implemented support for client_auth_required subdirective in tls block, it will be available in the next version of Ferron 3.

It will be able to be also used with mtls.cn variable with conditionals (see Configuration: conditionals and variables - Ferron 3 (RC) documentation)

Wow that was quick, thanks will try!

1 Like