Only emit FIPS startup log when running a server component

Signed-off-by: Monis Khan <mok@vmware.com>
This commit is contained in:
Monis Khan 2022-04-13 17:38:12 -04:00
parent f5cc2f20f7
commit e0886c6948
No known key found for this signature in database
GPG Key ID: 52C90ADA01B269B8

View File

@ -12,6 +12,8 @@ package ptls
import ( import (
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
"os"
"path/filepath"
"runtime" "runtime"
"C" // explicitly import cgo so that runtime/cgo gets linked into the kube-cert-agent "C" // explicitly import cgo so that runtime/cgo gets linked into the kube-cert-agent
@ -26,6 +28,12 @@ const secureServingOptionsMinTLSVersion = "VersionTLS12"
const SecureTLSConfigMinTLSVersion = tls.VersionTLS12 const SecureTLSConfigMinTLSVersion = tls.VersionTLS12
func init() { func init() {
switch filepath.Base(os.Args[0]) {
case "pinniped-server", "pinniped-supervisor", "pinniped-concierge", "pinniped-concierge-kube-cert-agent":
default:
return // do not print FIPS logs if we cannot confirm that we are running a server binary
}
// this init runs before we have parsed our config to determine our log level // this init runs before we have parsed our config to determine our log level
// thus we must use a log statement that will always print instead of conditionally print // thus we must use a log statement that will always print instead of conditionally print
// for plog, that is only error and warning logs, neither of which seem appropriate here // for plog, that is only error and warning logs, neither of which seem appropriate here