Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCustomProfileNil is returned when a custom TLS profile is specified but the Custom field is nil. ErrCustomProfileNil = errors.New("custom TLS profile specified but Custom field is nil") // ErrUnknownProfileType is returned when the profile type is not recognized. ErrUnknownProfileType = errors.New("unknown TLS profile type") // ErrNoSupportedCiphers is returned when none of the profile ciphers is supported. ErrNoSupportedCiphers = errors.New("TLS profile specifies ciphers but none are supported") // ErrNoSupportedCurves is returned when none of the profile curves is supported. ErrNoSupportedCurves = errors.New("TLS profile specifies curves but none are supported") )
var TLSProfiles = map[TLSProfileType]*TLSProfileSpec{ TLSProfileOldType: { Ciphers: []string{ "TLS_AES_128_GCM_SHA256", "TLS_AES_256_GCM_SHA384", "TLS_CHACHA20_POLY1305_SHA256", "ECDHE-ECDSA-AES128-GCM-SHA256", "ECDHE-RSA-AES128-GCM-SHA256", "ECDHE-ECDSA-AES256-GCM-SHA384", "ECDHE-RSA-AES256-GCM-SHA384", "ECDHE-ECDSA-CHACHA20-POLY1305", "ECDHE-RSA-CHACHA20-POLY1305", "ECDHE-ECDSA-AES128-SHA256", "ECDHE-RSA-AES128-SHA256", "ECDHE-ECDSA-AES128-SHA", "ECDHE-RSA-AES128-SHA", "ECDHE-ECDSA-AES256-SHA", "ECDHE-RSA-AES256-SHA", "AES128-GCM-SHA256", "AES256-GCM-SHA384", "AES128-SHA256", "AES128-SHA", "AES256-SHA", "DES-CBC3-SHA", }, MinTLSVersion: VersionTLS10, }, TLSProfileIntermediateType: { Ciphers: []string{ "TLS_AES_128_GCM_SHA256", "TLS_AES_256_GCM_SHA384", "TLS_CHACHA20_POLY1305_SHA256", "ECDHE-ECDSA-AES128-GCM-SHA256", "ECDHE-RSA-AES128-GCM-SHA256", "ECDHE-ECDSA-AES256-GCM-SHA384", "ECDHE-RSA-AES256-GCM-SHA384", "ECDHE-ECDSA-CHACHA20-POLY1305", "ECDHE-RSA-CHACHA20-POLY1305", }, MinTLSVersion: VersionTLS12, }, TLSProfileModernType: { Ciphers: []string{ "TLS_AES_128_GCM_SHA256", "TLS_AES_256_GCM_SHA384", "TLS_CHACHA20_POLY1305_SHA256", }, MinTLSVersion: VersionTLS13, }, }
TLSProfiles contains the predefined TLS profile specifications. Based on version 5.7 of the Mozilla Server Side TLS configuration guidelines. See: https://ssl-config.mozilla.org/guidelines/5.7.json
Functions ¶
This section is empty.
Types ¶
type SecurityProfileWatcher ¶
type SecurityProfileWatcher struct {
client.Client
// InitialTLSProfileSpec is the TLS profile spec that was configured when the operator started.
InitialTLSProfileSpec TLSProfileSpec
// OnProfileChange is called when the TLS profile changes.
OnProfileChange func(ctx context.Context, oldTLSProfileSpec, newTLSProfileSpec TLSProfileSpec)
}
SecurityProfileWatcher watches the APIServer object for TLS profile changes and triggers a callback when the profile changes.
func (*SecurityProfileWatcher) Reconcile ¶
func (r *SecurityProfileWatcher) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile watches for changes to the APIServer TLS profile.
func (*SecurityProfileWatcher) SetupWithManager ¶
func (r *SecurityProfileWatcher) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type TLSProfileSpec ¶
type TLSProfileSpec struct {
Ciphers []string `json:"ciphers"`
MinTLSVersion TLSProtocolVersion `json:"minTLSVersion"`
// Curves lists the allowed TLS key exchange groups; empty means Go
// defaults (post-quantum X25519MLKEM768 included).
Curves []string `json:"curves,omitempty"`
}
TLSProfileSpec is the desired behavior of a TLSSecurityProfile.
func FetchAPIServerTLSProfile ¶
FetchAPIServerTLSProfile fetches the TLS profile spec from the cluster's APIServer resource.
func GetTLSProfileSpec ¶
func GetTLSProfileSpec(profile *tlsSecurityProfile) (TLSProfileSpec, error)
GetTLSProfileSpec returns a TLSProfileSpec for the given profile. If no profile is configured, the default Intermediate profile is returned; unknown profile types are an error.
type TLSProfileType ¶
type TLSProfileType string
TLSProfileType defines a TLS security profile type.
const ( TLSProfileOldType TLSProfileType = "Old" TLSProfileIntermediateType TLSProfileType = "Intermediate" TLSProfileModernType TLSProfileType = "Modern" TLSProfileCustomType TLSProfileType = "Custom" )
type TLSProtocolVersion ¶
type TLSProtocolVersion string
TLSProtocolVersion is a way to specify the protocol version used for TLS connections.
const ( VersionTLS10 TLSProtocolVersion = "VersionTLS10" VersionTLS11 TLSProtocolVersion = "VersionTLS11" VersionTLS12 TLSProtocolVersion = "VersionTLS12" VersionTLS13 TLSProtocolVersion = "VersionTLS13" )
type UnsupportedEntries ¶
type UnsupportedEntries struct {
Ciphers []string
Curves []string
// UnenforceableCiphers lists TLS 1.3 cipher suites that Go always
// offers even though the profile excludes them.
UnenforceableCiphers []string
}
UnsupportedEntries lists profile entries that were dropped because Go does not support them, and restrictions that Go cannot enforce.
func NewTLSConfigFromProfile ¶
func NewTLSConfigFromProfile(profile TLSProfileSpec) (func(*tls.Config), UnsupportedEntries, error)
NewTLSConfigFromProfile returns a function that configures a tls.Config based on the provided TLSProfileSpec, along with any profile entries that could not be honored. It returns an error when the profile cannot be honored at all, instead of falling back to Go defaults that may exceed it.
func (UnsupportedEntries) IsEmpty ¶
func (u UnsupportedEntries) IsEmpty() bool
IsEmpty returns true when every profile entry is supported and enforceable.
func (UnsupportedEntries) Message ¶
func (u UnsupportedEntries) Message() string
Message returns a human-readable description of the entries.