Skip to content

Commit c5d97ad

Browse files
committed
fips: log a line when fips is enabled
This helps to determine whether FIPS is enabled. It is not necssary to build the Operator in FIPS mode. The env variable GODEBUG allows to enable FIPS in Go 1.24+, like so: `GODEBUG=fips140=on`
1 parent 30b2b20 commit c5d97ad

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ ARG TARGETOS
2020
ARG TARGETARCH
2121
ENV GOOS=$TARGETOS
2222
ENV GOARCH=$TARGETARCH
23+
24+
# FIPS
25+
ARG FIPS_MODE=off
26+
ENV GOFIPS140=$FIPS_MODE
27+
2328
RUN CGO_ENABLED=0 GO111MODULE=on go build -a -tags timetzdata -o manager main.go
2429

2530
# ---------------------------------------

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ $(KUBEBUILDER_ASSETS):
4949

5050
.PHONY: kubebuilder-assets
5151
kubebuilder-assets: $(KUBEBUILDER_ASSETS)
52+
@echo "export KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS)"
5253

5354
.PHONY: kubebuilder-assets-rm
5455
kubebuilder-assets-rm:

main.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
package main
1010

1111
import (
12+
"crypto/fips140"
1213
"flag"
1314
"fmt"
1415
"os"
@@ -192,7 +193,7 @@ func main() {
192193

193194
clusterConfig := config.GetConfigOrDie()
194195

195-
err = (&controllers.RabbitmqClusterReconciler{
196+
if err = (&controllers.RabbitmqClusterReconciler{
196197
Client: mgr.GetClient(),
197198
APIReader: mgr.GetAPIReader(),
198199
Scheme: mgr.GetScheme(),
@@ -205,14 +206,16 @@ func main() {
205206
DefaultUserUpdaterImage: defaultUserUpdaterImage,
206207
DefaultImagePullSecrets: defaultImagePullSecrets,
207208
ControlRabbitmqImage: controlRabbitmqImage,
208-
}).SetupWithManager(mgr)
209-
if err != nil {
209+
}).SetupWithManager(mgr); err != nil {
210210
log.Error(err, "unable to create controller", controllerName)
211211
os.Exit(1)
212212
}
213-
log.Info("started controller")
214213
// +kubebuilder:scaffold:builder
215214

215+
if fips140.Enabled() {
216+
log.Info("FIPS 140-3 mode enabled")
217+
}
218+
216219
log.Info("starting manager")
217220
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
218221
log.Error(err, "problem running manager")

0 commit comments

Comments
 (0)