Skip to content

Commit

Permalink
transport tls: use SSL_VERIFY_NONE by default
Browse files Browse the repository at this point in the history
VERIFY_NONE should be used when `client_cert_auth false` (default).

Before this fix, we need to set `insecure true` for this.
However, `insecure` option should mainly be for cipher strength.
It would not be intended VERIFY_PEER without VERIFY_FAIL_IF_NO_PEER_CERT
was used even if `client_cert_auth false`.
(When VERIFY_PEER without VERIFY_FAIL_IF_NO_PEER_CERT, server
does certification only when clients send its certificate.
This would be why we overlooked it long time)

Before:

| insecure | client_cert_auth | verify_mode                              |
| false    | fales            | VERIFY_PEER                              |
| false    | true             | VERIFY_PEER, VERIFY_FAIL_IF_NO_PEER_CERT |
| true     | false            | VERIFY_NONE                              |
| true     | true             | VERIFY_PEER, VERIFY_FAIL_IF_NO_PEER_CERT |

After:

| insecure | client_cert_auth | verify_mode                              |
| false    | fales            | VERIFY_NONE                              |
| false    | true             | VERIFY_PEER, VERIFY_FAIL_IF_NO_PEER_CERT |
| true     | false            | VERIFY_NONE                              |
| true     | true             | VERIFY_PEER, VERIFY_FAIL_IF_NO_PEER_CERT |

Signed-off-by: Daijiro Fukuda <[email protected]>
  • Loading branch information
daipom committed Nov 28, 2024
1 parent 2d8c9d4 commit 144eb23
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/fluent/plugin_helper/cert_option.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def cert_option_create_context(version, insecure, ciphers, conf)

if conf.client_cert_auth
ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
else
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
end

ctx.ca_file = conf.ca_path
Expand Down

0 comments on commit 144eb23

Please sign in to comment.