Skip to content
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

Sy/beta tls #19270

Draft
wants to merge 5 commits into
base: 7.59.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .in-toto/tag.ec45eb9d.link

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion requirements-agent-release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ datadog-temporal==3.1.0
datadog-tenable==3.0.0
datadog-teradata==4.0.0; sys_platform != 'darwin'
datadog-tibco-ems==2.1.0; sys_platform != 'win32'
datadog-tls==4.0.0
datadog-tls==4.1.0-beta.1
datadog-tokumx==3.2.0
datadog-tomcat==4.0.0
datadog-torchserve==3.1.0
Expand Down
6 changes: 6 additions & 0 deletions tls/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

<!-- towncrier release notes start -->

## 4.1.0-beta.1 / 2024-12-16

***Added***:

* Allow for different TLS Ciphers to be included or excluded. ([#19270](https://github.com/DataDog/integrations-core/pull/19270))

## 4.0.0 / 2024-10-04

***Removed***:
Expand Down
45 changes: 45 additions & 0 deletions tls/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,51 @@ files:
example:
- 'TLSv1.2'
- 'TLSv1.3'
- name: tls_ciphers
description: |
The list of ciphers to use when connecting to `server`. If not specified, the default
list of ciphers is used. The list of ciphers is a colon-separated list of cipher names.
See: https://www.openssl.org/docs/man1.0.2/man1/ciphers.html
Defaults are:
"TLS_AES_256_GCM_SHA384",
"TLS_CHACHA20_POLY1305_SHA256",
"TLS_AES_128_GCM_SHA256",
"ECDHE-ECDSA-AES256-GCM-SHA384",
"ECDHE-RSA-AES256-GCM-SHA384",
"ECDHE-ECDSA-AES128-GCM-SHA256",
"ECDHE-RSA-AES128-GCM-SHA256",
"ECDHE-ECDSA-CHACHA20-POLY1305",
"ECDHE-RSA-CHACHA20-POLY1305",
"ECDHE-ECDSA-AES256-SHA384",
"ECDHE-RSA-AES256-SHA384",
"ECDHE-ECDSA-AES128-SHA256",
"ECDHE-RSA-AES128-SHA256",
"DHE-RSA-AES256-GCM-SHA384",
"DHE-RSA-AES128-GCM-SHA256",
"DHE-RSA-AES256-SHA256",
"DHE-RSA-AES128-SHA256"
value:
type: array
items:
type: string
example:
- 'TLS_AES_256_GCM_SHA384'
- 'TLS_CHACHA20_POLY1305_SHA256'
- 'TLS_AES_128_GCM_SHA256'
- 'ECDHE-ECDSA-AES256-GCM-SHA384'
- 'ECDHE-RSA-AES256-GCM-SHA384'
- 'ECDHE-ECDSA-AES128-GCM-SHA256'
- 'ECDHE-RSA-AES128-GCM-SHA256'
- 'ECDHE-ECDSA-CHACHA20-POLY1305'
- 'ECDHE-RSA-CHACHA20-POLY1305'
- 'ECDHE-ECDSA-AES256-SHA384'
- 'ECDHE-RSA-AES256-SHA384'
- 'ECDHE-ECDSA-AES128-SHA256'
- 'ECDHE-RSA-AES128-SHA256'
- 'DHE-RSA-AES256-GCM-SHA384'
- 'DHE-RSA-AES128-GCM-SHA256'
- 'DHE-RSA-AES256-SHA256'
- 'DHE-RSA-AES128-SHA256'
- name: fetch_intermediate_certs
description: |
Whether or not to perform AIA chasing in order to load the full certificate chain.
Expand Down
2 changes: 1 addition & 1 deletion tls/datadog_checks/tls/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__version__ = '4.0.0'
__version__ = '4.1.0-beta.1'
42 changes: 42 additions & 0 deletions tls/datadog_checks/tls/data/conf.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,48 @@ instances:
# - TLSv1.2
# - TLSv1.3

## @param tls_ciphers - list of strings - optional
## The list of ciphers to use when connecting to `server`. If not specified, the default
## list of ciphers is used. The list of ciphers is a colon-separated list of cipher names.
## See: https://www.openssl.org/docs/man1.0.2/man1/ciphers.html
## Defaults are:
## "TLS_AES_256_GCM_SHA384",
## "TLS_CHACHA20_POLY1305_SHA256",
## "TLS_AES_128_GCM_SHA256",
## "ECDHE-ECDSA-AES256-GCM-SHA384",
## "ECDHE-RSA-AES256-GCM-SHA384",
## "ECDHE-ECDSA-AES128-GCM-SHA256",
## "ECDHE-RSA-AES128-GCM-SHA256",
## "ECDHE-ECDSA-CHACHA20-POLY1305",
## "ECDHE-RSA-CHACHA20-POLY1305",
## "ECDHE-ECDSA-AES256-SHA384",
## "ECDHE-RSA-AES256-SHA384",
## "ECDHE-ECDSA-AES128-SHA256",
## "ECDHE-RSA-AES128-SHA256",
## "DHE-RSA-AES256-GCM-SHA384",
## "DHE-RSA-AES128-GCM-SHA256",
## "DHE-RSA-AES256-SHA256",
## "DHE-RSA-AES128-SHA256"
#
# tls_ciphers:
# - TLS_AES_256_GCM_SHA384
# - TLS_CHACHA20_POLY1305_SHA256
# - TLS_AES_128_GCM_SHA256
# - ECDHE-ECDSA-AES256-GCM-SHA384
# - ECDHE-RSA-AES256-GCM-SHA384
# - ECDHE-ECDSA-AES128-GCM-SHA256
# - ECDHE-RSA-AES128-GCM-SHA256
# - ECDHE-ECDSA-CHACHA20-POLY1305
# - ECDHE-RSA-CHACHA20-POLY1305
# - ECDHE-ECDSA-AES256-SHA384
# - ECDHE-RSA-AES256-SHA384
# - ECDHE-ECDSA-AES128-SHA256
# - ECDHE-RSA-AES128-SHA256
# - DHE-RSA-AES256-GCM-SHA384
# - DHE-RSA-AES128-GCM-SHA256
# - DHE-RSA-AES256-SHA256
# - DHE-RSA-AES128-SHA256

## @param fetch_intermediate_certs - boolean - optional - default: false
## Whether or not to perform AIA chasing in order to load the full certificate chain.
##
Expand Down
19 changes: 19 additions & 0 deletions tls/datadog_checks/tls/tls_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,25 @@ def _get_cert_and_protocol_version(self, sock):
with sock:
self.log.debug('Getting cert and TLS protocol version')
try:
context = self.agent_check.get_tls_context()
ciphers = self.agent_check.instance.get('tls_ciphers', None)
if ciphers:
if 'ALL' in ciphers:
updated_ciphers = "ALL"
else:
current_ciphers = ":".join(cipher['name'] for cipher in context.get_ciphers())
new_cipher = self.agent_check.instance.get('tls_ciphers')
new_ciphers = ":".join(new_cipher)
updated_ciphers = f"{current_ciphers}:{new_ciphers}"

self.log.debug('Updated ciphers to %s', updated_ciphers)
context.set_ciphers(updated_ciphers)
self.log.debug('Set ciphers to %s', context.get_ciphers())
self.log.debug('Context options %s', context.options)
self.log.debug('Context verify mode %s', context.verify_mode.name)
self.log.debug('Context check hostname %s', context.check_hostname)
self.log.debug('Context minimum version %s', context.minimum_version.name)
self.log.debug('Context maximum version %s', context.maximum_version.name)
with self.agent_check.get_tls_context().wrap_socket(
sock, server_hostname=self.agent_check._server_hostname
) as secure_sock:
Expand Down
Loading