Documentation
¶
Overview ¶
Package configtls implements the TLS settings to load and configure TLS clients and servers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶ added in v0.96.0
type ClientConfig struct {
// squash ensures fields are correctly decoded in embedded struct.
Config `mapstructure:",squash"`
// In gRPC and HTTP when set to true, this is used to disable the client transport security.
// See https://godoc.org/google.golang.org/grpc#WithInsecure for gRPC.
// Please refer to https://godoc.org/crypto/tls#Config for more information.
// (optional, default false)
Insecure bool `mapstructure:"insecure,omitempty"`
// InsecureSkipVerify will enable TLS but not verify the certificate.
InsecureSkipVerify bool `mapstructure:"insecure_skip_verify,omitempty"`
// ServerName requested by client for virtual hosting.
// This sets the ServerName in the TLSConfig. Please refer to
// https://godoc.org/crypto/tls#Config for more information. (optional)
ServerName string `mapstructure:"server_name_override,omitempty"`
// contains filtered or unexported fields
}
ClientConfig contains TLS configurations that are specific to client connections in addition to the common configurations. This should be used by components configuring TLS client connections.
func NewDefaultClientConfig ¶ added in v0.99.0
func NewDefaultClientConfig() ClientConfig
NewDefaultClientConfig creates a new ClientConfig with any default values set.
func (ClientConfig) LoadTLSConfig ¶ added in v0.96.0
LoadTLSConfig loads the TLS configuration.
type Config ¶ added in v0.96.0
type Config struct {
// Path to the CA cert. For a client this verifies the server certificate.
// For a server this verifies client certificates. If empty uses system root CA.
// (optional)
CAFile string `mapstructure:"ca_file,omitempty"`
// In memory PEM encoded cert. (optional)
CAPem configopaque.String `mapstructure:"ca_pem,omitempty"`
// If true, load system CA certificates pool in addition to the certificates
// configured in this struct.
IncludeSystemCACertsPool bool `mapstructure:"include_system_ca_certs_pool,omitempty"`
// Path to the TLS cert to use for TLS required connections. (optional)
CertFile string `mapstructure:"cert_file,omitempty"`
// In memory PEM encoded TLS cert to use for TLS required connections. (optional)
CertPem configopaque.String `mapstructure:"cert_pem,omitempty"`
// Path to the TLS key to use for TLS required connections. (optional)
KeyFile string `mapstructure:"key_file,omitempty"`
// In memory PEM encoded TLS key to use for TLS required connections. (optional)
KeyPem configopaque.String `mapstructure:"key_pem,omitempty"`
// MinVersion sets the minimum TLS version that is acceptable.
// If not set, TLS 1.2 will be used. (optional)
MinVersion string `mapstructure:"min_version,omitempty"`
// MaxVersion sets the maximum TLS version that is acceptable.
// If not set, refer to crypto/tls for defaults. (optional)
MaxVersion string `mapstructure:"max_version,omitempty"`
// CipherSuites is a list of TLS cipher suites that the TLS transport can use.
// If left blank, a safe default list is used.
// See https://go.dev/src/crypto/tls/cipher_suites.go for a list of supported cipher suites.
CipherSuites []string `mapstructure:"cipher_suites,omitempty"`
// IncludeInsecureCipherSuites enables support for insecure cipher suites.
// When set to true, cipher suites returned by tls.InsecureCipherSuites() will be
// available for selection in addition to the secure ones. This should only be
// used when working with legacy systems that require insecure cipher suites.
// (optional, default false)
IncludeInsecureCipherSuites bool `mapstructure:"include_insecure_cipher_suites,omitempty"`
// ReloadInterval specifies the duration after which the certificate will be reloaded
// If not set, it will never be reloaded (optional)
ReloadInterval time.Duration `mapstructure:"reload_interval,omitempty"`
// contains the elliptic curves that will be used in
// an ECDHE handshake, in preference order
// Defaults to empty list and "crypto/tls" defaults are used, internally.
CurvePreferences []string `mapstructure:"curve_preferences,omitempty"`
// Trusted platform module configuration
TPMConfig TPMConfig `mapstructure:"tpm,omitempty"`
}
Config exposes the common client and server TLS configurations. Note: Since there isn't anything specific to a server connection. Components with server connections should use Config.
func NewDefaultConfig ¶ added in v0.99.0
func NewDefaultConfig() Config
NewDefaultConfig creates a new Config with any default values set.
type ServerConfig ¶ added in v0.96.0
type ServerConfig struct {
// squash ensures fields are correctly decoded in embedded struct.
Config `mapstructure:",squash"`
// Path to the TLS cert to use by the server to verify a client certificate. (optional)
// This sets the ClientCAs and ClientAuth to RequireAndVerifyClientCert in the TLSConfig. Please refer to
// https://godoc.org/crypto/tls#Config for more information. (optional)
ClientCAFile string `mapstructure:"client_ca_file,omitempty"`
// Reload the ClientCAs file when it is modified
// (optional, default false)
ReloadClientCAFile bool `mapstructure:"client_ca_file_reload,omitempty"`
// contains filtered or unexported fields
}
ServerConfig contains TLS configurations that are specific to server connections in addition to the common configurations. This should be used by components configuring TLS server connections.
func NewDefaultServerConfig ¶ added in v0.99.0
func NewDefaultServerConfig() ServerConfig
NewDefaultServerConfig creates a new ServerConfig with any default values set.
func (ServerConfig) LoadTLSConfig ¶ added in v0.96.0
LoadTLSConfig loads the TLS configuration.
func (ServerConfig) Validate ¶ added in v1.42.0
func (c ServerConfig) Validate() error
type TPMConfig ¶ added in v1.32.0
type TPMConfig struct {
Enabled bool `mapstructure:"enabled"`
// The path to the TPM device or Unix domain socket.
// For instance /dev/tpm0 or /dev/tpmrm0.
Path string `mapstructure:"path"`
OwnerAuth string `mapstructure:"owner_auth"`
Auth string `mapstructure:"auth"`
// contains filtered or unexported fields
}
TPMConfig defines trusted platform module configuration for storing TLS keys.