Skip to content

Commit

Permalink
Check intermediate certificate protocol version
Browse files Browse the repository at this point in the history
  • Loading branch information
coignetp committed Jan 25, 2022
1 parent b12871b commit a11d3e7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tls/datadog_checks/tls/tls_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ def fetch_intermediate_certs(self):
context.wrap_socket(sock, server_hostname=self.agent_check._server_hostname)
) as secure_sock:
der_cert = secure_sock.getpeercert(binary_form=True)
protocol_version = secure_sock.version()
if protocol_version and protocol_version not in self.agent_check._allowed_versions:
self.log.warning(
'Protocol version not allowed for intermediate certificates: %s', protocol_version
)
except Exception as e:
self.log.error('Error occurred while getting cert to discover intermediate certificates: %s', e)
return
Expand Down

0 comments on commit a11d3e7

Please sign in to comment.