-
Notifications
You must be signed in to change notification settings - Fork 21
add ssl verification option #269
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
5c77dc4
4366209
a4bb9cc
a2290ec
c63600f
6ffb439
e1d58d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,10 +144,32 @@ These are the available hooks: | |
|
|
||
| $ TD_TOOLBELT_UPDATE_ROOT="http://toolbelt.treasuredata.com" | ||
|
|
||
| * 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" | ||
|
Comment on lines
-147
to
-149
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason to remove these lines? |
||
| The CLI supports SSL certificate verification options to help with proxy environments: | ||
|
|
||
| * Disable SSL certificate verification: | ||
|
|
||
| $ td --insecure ... | ||
|
|
||
| * Use a custom CA certificate file: | ||
|
|
||
| $ td --ssl-ca-file /path/to/ca.crt ... | ||
|
|
||
| * Configure in ~/.td/td.conf: | ||
|
|
||
| [ssl] | ||
| verify = false | ||
| ca_file = /path/to/ca.crt | ||
|
|
||
| * Set environment variables: | ||
|
|
||
| $ TD_SSL_VERIFY=false td ... | ||
| $ TD_SSL_CA_FILE=/path/to/ca.crt td ... | ||
|
|
||
| The priority order is: CLI options > environment variables > config file > default. | ||
|
|
||
| Note: These options do not apply to the 'td workflow' command, which uses its own HTTP client. | ||
|
|
||
| = Copyright | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,13 @@ def get_client(opts={}) | |
| opts[:retry_post_requests] = Config.retry_post_requests | ||
| end | ||
|
|
||
| # SSL verification options | ||
| if Config.ssl_verify == false | ||
| opts[:verify] = false | ||
| elsif Config.ssl_ca_file | ||
| opts[:verify] = Config.ssl_ca_file | ||
| end | ||
|
Comment on lines
+44
to
+50
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can we unify After all, if |
||
|
|
||
| # apikey is mandatory | ||
| apikey = Config.apikey | ||
| raise ConfigError, "Account is not configured." unless apikey | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,7 @@ def run(argv=ARGV) | |
| endpoint = @endpoint | ||
| import_endpoint = @import_endpoint || @endpoint | ||
| insecure = nil | ||
| ssl_ca_file = nil | ||
| $verbose = false | ||
| #$debug = false | ||
| retry_post_requests = false | ||
|
|
@@ -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| | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure it's a good idea to reuse IMO, it's better to introduce new
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think this would cause some confusion to merge options into one options as they need to understand one option has 2 meanings. |
||
| insecure = true | ||
| } | ||
|
|
||
| op.on('--ssl-ca-file PATH', "Path to the CA certification file for SSL") {|s| | ||
| require 'td/command/common' | ||
| unless File.exist?(s) | ||
| raise ParameterConfigurationError, "CA certification file not found: #{s}" | ||
| end | ||
| ssl_ca_file = s | ||
| } | ||
|
|
||
| op.on('-v', '--verbose', "verbose mode", TrueClass) {|b| | ||
| $verbose = b | ||
| } | ||
|
|
||
| #op.on('-d', '--debug', "debug mode", TrueClass) {|b| | ||
| # $debug = b | ||
| # $debug = b | ||
| #} | ||
|
|
||
| op.on('-h', '--help', "show help") { | ||
|
|
@@ -155,7 +164,13 @@ def run(argv=ARGV) | |
| Config.cl_import_endpoint = true | ||
| end | ||
| if insecure | ||
| Config.secure = false | ||
| Config.ssl_verify = false | ||
| Config.cl_ssl_verify = true | ||
| $stderr.puts "Warning: --insecure option disables SSL certificate verification, which is not recommended for production use." | ||
| end | ||
| if ssl_ca_file | ||
| Config.ssl_ca_file = ssl_ca_file | ||
| Config.cl_ssl_ca_file = true | ||
| end | ||
| if retry_post_requests | ||
| Config.retry_post_requests = true | ||
|
|
||
There was a problem hiding this comment.
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