summaryrefslogtreecommitdiff
path: root/lib/chef/knife
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2015-12-03 13:50:29 -0700
committertyler-ball <tyleraball@gmail.com>2015-12-09 14:23:53 -0700
commit200c3e5b71ec269efffbfb97e94f1a7aada951af (patch)
tree3eabfe9d693eb83cafa42cd43260bf962e99f10c /lib/chef/knife
parent010392858c2a3a036578b681085704ed1971ab21 (diff)
downloadchef-200c3e5b71ec269efffbfb97e94f1a7aada951af.tar.gz
Adding proxifier dependency and leveraging its ability to make TCPSocket.new respect ENV['http_proxy']
Diffstat (limited to 'lib/chef/knife')
-rw-r--r--lib/chef/knife/ssl_check.rb8
-rw-r--r--lib/chef/knife/ssl_fetch.rb5
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/chef/knife/ssl_check.rb b/lib/chef/knife/ssl_check.rb
index d71eacfc7e..7b0a808bbb 100644
--- a/lib/chef/knife/ssl_check.rb
+++ b/lib/chef/knife/ssl_check.rb
@@ -29,6 +29,8 @@ class Chef
require 'uri'
require 'chef/http/ssl_policies'
require 'openssl'
+ require 'chef/mixin/proxified_socket'
+ include Chef::Mixin::ProxifiedSocket
end
banner "knife ssl check [URL] (options)"
@@ -75,7 +77,7 @@ class Chef
def verify_peer_socket
@verify_peer_socket ||= begin
- tcp_connection = TCPSocket.new(host, port)
+ tcp_connection = proxified_socket(host, port)
ssl_client = OpenSSL::SSL::SSLSocket.new(tcp_connection, verify_peer_ssl_context)
ssl_client.hostname = host
ssl_client
@@ -93,7 +95,7 @@ class Chef
def noverify_socket
@noverify_socket ||= begin
- tcp_connection = TCPSocket.new(host, port)
+ tcp_connection = proxified_socket(host, port)
OpenSSL::SSL::SSLSocket.new(tcp_connection, noverify_peer_ssl_context)
end
end
@@ -125,7 +127,9 @@ class Chef
def verify_cert
ui.msg("Connecting to host #{host}:#{port}")
+ ui.msg("TYLER DEBUGGING INFO1")
verify_peer_socket.connect
+ ui.msg("TYLER DEBUGGING INFO2")
true
rescue OpenSSL::SSL::SSLError => e
ui.error "The SSL certificate of #{host} could not be verified"
diff --git a/lib/chef/knife/ssl_fetch.rb b/lib/chef/knife/ssl_fetch.rb
index fd7d101fd8..0c1ab7ea7b 100644
--- a/lib/chef/knife/ssl_fetch.rb
+++ b/lib/chef/knife/ssl_fetch.rb
@@ -28,6 +28,8 @@ class Chef
require 'socket'
require 'uri'
require 'openssl'
+ require 'chef/mixin/proxified_socket'
+ include Chef::Mixin::ProxifiedSocket
end
banner "knife ssl fetch [URL] (options)"
@@ -71,7 +73,7 @@ class Chef
end
def remote_cert_chain
- tcp_connection = TCPSocket.new(host, port)
+ tcp_connection = proxified_socket(host, port)
shady_ssl_connection = OpenSSL::SSL::SSLSocket.new(tcp_connection, noverify_peer_ssl_context)
shady_ssl_connection.connect
shady_ssl_connection.peer_cert_chain
@@ -155,4 +157,3 @@ TRUST_TRUST
end
end
end
-