Skip to content

Conversation

mickeey2525
Copy link
Contributor

@mickeey2525 mickeey2525 commented Jun 3, 2025

Purpose

To address this issue, I added ssl verification options.

#256

bundle exec bin/td --insecure db:list
Warning: --insecure option disables SSL certificate verification, which is not recommended for production use.
+-------------------------------------------------------------+------------+
| Name                                                        | Count      |
+-------------------------------------------------------------+------------+

About --insecure option

This does not work anymore and does not match with the users' expectations.

td --insecure db:list
Errno::ECONNREFUSED: Connection refused - Connection refused - connect(2) for "api.treasuredata.com" port 80 (api.treasuredata.com:80). Retrying after 5 seconds...
Errno::ECONNREFUSED: Connection refused - Connection refused - connect(2) for "api.treasuredata.com" port 80 (api.treasuredata.com:80). Retrying after 10 seconds...
^C/Users/mikio.tachibana/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/td-client-2.0.0/lib/td/client/api.rb:324:in 'Kernel#sleep': Interrupt

amazon-q-developer bot and others added 4 commits June 3, 2025 08:51
Introduces new CLI options for SSL certificate handling:
- --insecure: Disable SSL verification
- --ssl-ca-file: Specify custom CA certificate file

Options can also be configured via config file or environment variables.
- Improve SSL verification logic and configuration options
- Add proper ssl_ca_file path handling with escaping
- Implement comprehensive SSL options test coverage
- Add warning message for insecure SSL usage
- Fix environment variable parsing for SSL verification
@mickeey2525 mickeey2525 changed the title Mickeey2525/ssl disable option add ssl verification option Jun 3, 2025
@mickeey2525 mickeey2525 marked this pull request as ready for review June 19, 2025 13:11
@mickeey2525 mickeey2525 requested a review from a team as a code owner June 19, 2025 13:11
Copy link
Contributor

@imnutz imnutz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -2,6 +2,7 @@

* Update password symbol for user creation #262
* Add support for td-client-ruby 2.x.x #267
* Add SSL certificate options (--insecure, --ssl-ca-file) for proxy environments
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is for current release, please remove. We will add the changelog during release process

Comment on lines -147 to -149
* Specify an alternative endpoint to use updating the JAR file (default: https://repo1.maven.org):
=== SSL Options

$ TD_TOOLBELT_JARUPDATE_ROOT="https://repo1.maven.org"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to remove these lines?

Comment on lines 44 to 49
# SSL verification options
if Config.ssl_verify == false
opts[:verify] = false
elsif Config.ssl_ca_file
opts[:verify] = Config.ssl_ca_file
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can we unify ssl_verify and ssl_ca_file into a single ssl_verify option similar to td-client-ruby's verify option?

After all, if ssl_verify is false, ssl_ca_file value does not apply anyway.

@@ -104,16 +105,24 @@ def run(argv=ARGV)
import_endpoint = e
}

op.on('--insecure', "Insecure access: disable SSL (enabled by default)") {|b|
op.on('--insecure', "Insecure access: disable SSL certificate verification (enabled by default)") {|b|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's a good idea to reuse --insecure here. As it just means enable/disable ssl, not certification verification. Changing semantic for this --insecure option can cause confusion to both users and maintainers. We can consider deprecate --insecure option and remove it in the near future

IMO, it's better to introduce new --ssl-verify option that handles both ssl-verify and ssl-ca-file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--insecure itself was causing a lot of confusion for our customers in the history.
Some customers try to use insecure option to disable ssl verification and it didn't work as expected as it just change the protocol.
So for me, it is natural to use --insecure for this option. but not that strong desire.
And --insecure is already meaning less as TD enforces https communication in the most case.

it's better to introduce new --ssl-verify option that handles both ssl-verify and ssl-ca-file

I think this would cause some confusion to merge options into one options as they need to understand one option has 2 meanings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants