diff --git a/Dockerfile b/Dockerfile index 6958aba..330f2a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,18 @@ # Dockerfile ARG BASE_REG=edencore.azurecr.io/ + +# FIPS and non-FIPS build FROM ${BASE_REG}cg_fips/go:1.22 as build WORKDIR /app COPY . . RUN go mod download RUN go build -o outsystemscc +# TODO: Import the FIPS module when it is required only +# - main.go: import _ "crypto/tls/fipsonly" +RUN go build -tags=requirefips -o outsystemscc-fips + +# Package the final image FROM ${BASE_REG}cg_fips/chainguard_base-fips:latest COPY --from=build /app/outsystemscc /app/ -ENTRYPOINT ["/app/outsystemscc"] \ No newline at end of file +COPY --from=build /app/outsystemscc-fips /app/ +ENTRYPOINT ["/app/outsystemscc-fips"] \ No newline at end of file diff --git a/main.go b/main.go index 3ccb67e..4fc20bb 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,13 @@ package main +// FIPS mode is enabled by importing the fipsonly package. import ( + _ "crypto/tls/fipsonly" "flag" "fmt" "io/ioutil" "log" + "math/rand" "net/http" "os" "runtime" @@ -12,8 +15,6 @@ import ( "strings" "time" - "math/rand" - chclient "github.com/jpillora/chisel/client" "github.com/jpillora/chisel/share/cos" "github.com/jpillora/chisel/share/settings"