Skip to content
Merged
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
24 changes: 24 additions & 0 deletions conf/input.http_response/http_response.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,27 @@ targets = [
# tls_key = "/etc/categraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
# tls_min_version = "1.2"
# tls_max_version = "1.3"
# tls_cipher_suites = [
# "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
# "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
# "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
# "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
# "TLS_AES_128_GCM_SHA256",
# "TLS_AES_256_GCM_SHA384",
# "TLS_CHACHA20_POLY1305_SHA256",
# "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
# "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
# "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
# "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
# "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
# "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
# "TLS_RSA_WITH_AES_128_GCM_SHA256",
# "TLS_RSA_WITH_AES_256_GCM_SHA384",
# "TLS_RSA_WITH_AES_128_CBC_SHA",
# "TLS_RSA_WITH_AES_256_CBC_SHA",
# "TLS_RSA_WITH_AES_128_CBC_SHA256",
# "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
# "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256"
# ]
28 changes: 19 additions & 9 deletions pkg/tls/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ import (

// ClientConfig represents the standard client TLS config.
type ClientConfig struct {
UseTLS bool `toml:"use_tls"`
TLSCA string `toml:"tls_ca"`
TLSCert string `toml:"tls_cert"`
TLSKey string `toml:"tls_key"`
TLSKeyPwd string `toml:"tls_key_pwd"`
InsecureSkipVerify bool `toml:"insecure_skip_verify"`
ServerName string `toml:"tls_server_name"`
TLSMinVersion string `toml:"tls_min_version"`
TLSMaxVersion string `toml:"tls_max_version"`
UseTLS bool `toml:"use_tls"`
TLSCA string `toml:"tls_ca"`
TLSCert string `toml:"tls_cert"`
TLSKey string `toml:"tls_key"`
TLSKeyPwd string `toml:"tls_key_pwd"`
InsecureSkipVerify bool `toml:"insecure_skip_verify" json:"insecure_skip_verify"`
ServerName string `toml:"tls_server_name" json:"tls_server_name"`
Comment on lines +20 to +21

Copilot AI Dec 25, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON tags have been added to InsecureSkipVerify and ServerName fields but not to other fields in the ClientConfig struct. This creates an inconsistent serialization interface. Either add JSON tags to all fields that should be serializable, or remove them from these two fields to maintain consistency with the rest of the struct which only uses TOML tags.

Suggested change
InsecureSkipVerify bool `toml:"insecure_skip_verify" json:"insecure_skip_verify"`
ServerName string `toml:"tls_server_name" json:"tls_server_name"`
InsecureSkipVerify bool `toml:"insecure_skip_verify"`
ServerName string `toml:"tls_server_name"`

Copilot uses AI. Check for mistakes.
TLSMinVersion string `toml:"tls_min_version"`
TLSMaxVersion string `toml:"tls_max_version"`
TLSCipherSuites []string `toml:"tls_cipher_suites"`
}

// ServerConfig represents the standard server TLS config.
Expand Down Expand Up @@ -62,6 +63,15 @@ func (c *ClientConfig) TLSConfig() (*tls.Config, error) {
}
}

if len(c.TLSCipherSuites) != 0 {
cipherSuites, err := ParseCiphers(c.TLSCipherSuites)
if err != nil {
return nil, fmt.Errorf(
"could not parse client cipher suites %s: %v", strings.Join(c.TLSCipherSuites, ","), err)
}
tlsConfig.CipherSuites = cipherSuites
}

if c.ServerName != "" {
tlsConfig.ServerName = c.ServerName
}
Expand Down
Loading