Skip to content

Commit

Permalink
Validate ssl peers
Browse files Browse the repository at this point in the history
Before this patch, ssl peers where not validated unless custom
certificate were provided. This led to less strict security and annoying
warnings from em-http library. See igrigorik/em-http-request#339.

Now we properly take tls_verify_peer option (defaults to true) in
consideration. This should increase security.

Change-Id: I3620aa3de63e20976a204be45bce013d816acc52
  • Loading branch information
kamaradclimber authored and pierrecdn committed May 27, 2024
1 parent dfd6a76 commit 2db4f1e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ AllCops:
Layout/LineLength:
Max: 175

# those metrics should be disabled
Metrics/AbcSize:
Max: 90
Max: 92

Metrics/BlockLength:
Max: 188
Expand Down
3 changes: 2 additions & 1 deletion lib/consul/async/consul_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ def _handle_error(http, consul_index)
def fetch
options = {
connect_timeout: 5, # default connection setup timeout
inactivity_timeout: conf.wait_duration + 1 + (conf.wait_duration / 16) # default connection inactivity (post-setup) timeout
inactivity_timeout: conf.wait_duration + 1 + (conf.wait_duration / 16), # default connection inactivity (post-setup) timeout
tls: { verify_peer: conf.tls_verify_peer }
}
unless conf.tls_cert_chain.nil?
options[:tls] = {
Expand Down
1 change: 1 addition & 0 deletions lib/consul/async/json_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def _handle_error(http)

def fetch
options = {
tls: { verify_peer: conf.tls_verify_peer },
connect_timeout: 5, # default connection setup timeout
inactivity_timeout: 60 # default connection inactivity (post-setup) timeout
}
Expand Down
1 change: 1 addition & 0 deletions lib/consul/async/vault_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def _handle_error(http)

def fetch
options = {
tls: { verify_peer: conf.tls_verify_peer },
connect_timeout: 5, # default connection setup timeout
inactivity_timeout: 1 # default connection inactivity (post-setup) timeout
}
Expand Down

0 comments on commit 2db4f1e

Please sign in to comment.