-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tls.verify_hostname seems not working in [OUTPUT] forward #9152
Comments
Yes. tls.verify_hostname is quite tight condition for some of the server certificates. And, input and output slightly differ the verification mechanism for certificates. |
Thanks @cosmo0920 for the reply, per my understanding this behavior (output tls.verify_hostname's not working) is as expected, or do I miss something in the config to make it work correctly? |
Thanks @JSchy65 , that's why I opened this issue after checking that change, but seems not working per my understanding. |
Hi @duj4, In my case (Fluent Bit 3.1.4)
But when This case seems to be serious security regression from what we have with Fluent Bit 3.0.7 (where Here is part of my Fluent Bit 3.1.4 configuration for HA:
and (/fluent-bit/extra/upstream.conf file):
I also tried to put (move, copy) So far, my team decided to stay on 3.0.7 version, because TLS is less meaningful if client (Fluent Bit) doesn't validate CN / SAN of server certificate to match expected hostname. |
Thanks for the report of verify_hostname settings leaks for HA. However, this is just in an early stage. Still not handled for memory managements. |
@mabrarov thanks for jumping into this issue. In you first |
Hi @duj4, Unfortunately, my team doesn't use mTLS b/w Fluent Bit (Forward output plugin) and Fluentd and I do not have example / test of configuration with Sorry, I realize that the case from my previous message doesn't match your case for 100%, but it is still about |
@mabrarov no worry at all and I am not using Fluentd in my case, both |
If the CN of server is not matched for the provided certificates, the TLS handshake will be failed. |
yes, this is for sure, but my issue is when I set the mismatched cert in
The config above is on |
What about Subject Alternative Name (SAN) of the server certificate in your case? Does it also not match value specified in |
It depends on your SAN value in your certificates. $ openssl x509 -noout -ext subjectAltName -in /path/to/your_certificates.pem Then, if there is a SAN extension in your certificates: X509v3 Subject Alternative Name:
DNS:a.super.cool.dns.address |
hi @mabrarov, Do you mean the If this is the case, the initial config as below (on centos8-1) should not work (as centos8-1.crt cannot verify the destination centos8-2) but it does work:
|
For out_forward, it could be verified for the destination of CN: So, the verification of hostname should be used for the destinations on out_forward plugin. |
Hi @duj4,
This part of your configuration:
has no relation with verification (performed by Fluent Bit Forward output plugin at In case of configuration which you provided only following options impact verification (performed by Fluent Bit Forward output plugin running at
|
hi @mabrarov ,
How does server side (centos8-2) verify the client(centos8-1) as there is no such parameter |
Thanks @cosmo0920 for the code lines. |
Hi @duj4, I'm not good in mTLS. As far as I know mTLS and as far as I understand Fluent Bit code, the server (centos8-2), when performing verification of client (centos8-1) certificate (in some cases server can skip that verification ignoring certificate provided by client, not sure if it is the case for Fluent Bit Forward input plugin), checks:
Options 1-3 from this list are defined by following part of centos8-1 configuration:
The set of CAs (CA certificates) which are trusted by server (centos8-2) is defined by following part of centos8-2 configuration (I guess so, I never tried it before):
|
@mabrarov Thanks for the reply. It seems this mTLS is based on the ca.crt here, as long as the source (centos8-1) is signed by the same CA as destination (centos8-2), it will be trusted. Please correct me if there is any misunderstanding on how [INPUT] verifies the [OUTPUT] @cosmo0920 |
Your understanding is correct. Thanks for filing your issue. :) |
thanks @cosmo0920 and @mabrarov for your patience, really gained a lot by this one. |
Bug Report
Describe the bug
In [OUTPUT] forward, when I enabled
tls.verify_hostname
, it seems this flag does not work, but in [INPUT] it does work.Here is the basic config and which is working as expected:
centos8-1:
centos8-2:
If I change the cert and key to centos8-1.crt and centos8-1.key in centos8-2's config (the INPUT side), the connection cannot be set up with error as below, this makes sense as the CN and the hostname does not match, which is as expected:
centos8-1:
centos8-2:
However, if I change the cert and key on centos8-1's config (the OUTPUT side) to centos8-2.crt and centos8-2.key, the connection can still be set up with logs sending to centos8-2, it seems the tls.verify_hostname on OUTPUT forward does not work.
@cosmo0920 I noticed that you've helped added this function in #8934, could you please help check this issue?
To Reproduce
Expected behavior
OUTPUT tls.verify_hostname should also check the CN and hostname.
Your Environment
The text was updated successfully, but these errors were encountered: