Skip to content

Commit

Permalink
Explicitly set defaultServing ciphers in FIPS mode
Browse files Browse the repository at this point in the history
This is a no-op today, but could change in the future when we add
support for FIPS in non-strict mode.

Signed-off-by: Monis Khan <mok@vmware.com>
  • Loading branch information
enj committed Mar 31, 2022
1 parent d97efcb commit 0390c22
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions internal/crypto/ptls/fips_strict.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"C" // explicitly import cgo so that runtime/cgo gets linked into the kube-cert-agent
_ "crypto/tls/fipsonly" // restricts all TLS configuration to FIPS-approved settings.

"k8s.io/apiserver/pkg/server/options"

"go.pinniped.dev/internal/plog"
)

Expand Down Expand Up @@ -63,3 +65,7 @@ func Secure(rootCAs *x509.CertPool) *tls.Config {
func DefaultLDAP(rootCAs *x509.CertPool) *tls.Config {
return Default(rootCAs)
}

func secureServing(opts *options.SecureServingOptionsWithLoopback) {
return defaultServing(opts)
}
5 changes: 0 additions & 5 deletions internal/crypto/ptls/ptls.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ func defaultServing(opts *options.SecureServingOptionsWithLoopback) {
opts.MinTLSVersion = defaultServingOptionsMinTLSVersion
}

func secureServing(opts *options.SecureServingOptionsWithLoopback) {
opts.MinTLSVersion = secureServingOptionsMinTLSVersion
opts.CipherSuites = nil
}

func secureClient(opts *options.RecommendedOptions, f RestConfigFunc) error {
inClusterClient, inClusterConfig, err := f(nil)
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions internal/crypto/ptls/secure.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ package ptls
import (
"crypto/tls"
"crypto/x509"

"k8s.io/apiserver/pkg/server/options"
)

// secureServingOptionsMinTLSVersion is the minimum tls version in the format
Expand Down Expand Up @@ -42,3 +44,8 @@ func Secure(rootCAs *x509.CertPool) *tls.Config {
}
return c
}

func secureServing(opts *options.SecureServingOptionsWithLoopback) {
opts.MinTLSVersion = secureServingOptionsMinTLSVersion
opts.CipherSuites = nil
}

0 comments on commit 0390c22

Please sign in to comment.