Skip to content

Commit c29e60c

Browse files
committed
chore: build fips compliant binaries
On-behalf-of: SAP <[email protected]> Signed-off-by: Simon Bein <[email protected]>
1 parent 2032a87 commit c29e60c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cmd/main.go

Lines changed: 9 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,14 @@ 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("Running in FIPS 140-3 compliant mode")
136+
} else {
137+
setupLog.Error(nil, "Running in non-compliant FIPS mode. Exiting now")
138+
os.Exit(1)
139+
}
140+
132141
setupContext := context.Background()
133142

134143
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)