Skip to content

Commit 9d1f32c

Browse files
committed
chore: build fips compliant binaries
1 parent 2032a87 commit 9d1f32c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cmd/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package main
1818

1919
import (
20+
"crypto/fips140"
2021
"embed"
2122
"flag"
2223
"os"
@@ -129,6 +130,15 @@ func main() {
129130

130131
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
131132

133+
// needs to be run after ctrl.Logger has been called, so we can log
134+
if fips140.Enabled() {
135+
setupLog.Info("FIPS 140-3 check completed")
136+
} else {
137+
// normally this should never happen, still it is good to print out an error and exit
138+
setupLog.Error(nil, "Running in non-compliant FIPS mode. Exiting now")
139+
os.Exit(1)
140+
}
141+
132142
setupContext := context.Background()
133143

134144
setupClient, err := client.New(ctrl.GetConfigOrDie(), client.Options{Scheme: schemes.Local})

hack/common/build-binary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ echo "> Building binaries ..."
1212
echo "> Building binary for component '$comp' ($pf) ..." | indent 1
1313
os=${pf%/*}
1414
arch=${pf#*/}
15-
CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -a -o bin/${comp}-${os}.${arch} cmd/main.go | indent 2
15+
CGO_ENABLED=0 GODEBUG=fips140=only GOOS=$os GOARCH=$arch go build -a -o bin/${comp}-${os}.${arch} cmd/main.go | indent 2
1616
done
1717
done
1818
)

0 commit comments

Comments
 (0)