Skip to content
Open
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
4485c47
WIP support new Go fips140 module
wadey Mar 31, 2025
3da3d41
log if fips140 in use
wadey Jul 24, 2025
6da314a
WIP
wadey Jul 24, 2025
31cc3a4
Merge remote-tracking branch 'origin/master' into fips140
wadey Jul 24, 2025
f6b206d
cleanup
wadey Jul 25, 2025
0eb92dc
WIP
wadey Jul 25, 2025
fd3fa57
comments
wadey Jul 25, 2025
b418a08
cleanup
wadey Jul 25, 2025
6fa1ecd
Merge remote-tracking branch 'origin/master' into fips140
wadey Jan 30, 2026
2d5d86f
Merge remote-tracking branch 'origin/master' into fips140
wadey Apr 27, 2026
08ee2ab
cleanup
wadey Apr 27, 2026
243cf4a
Revert "cleanup"
wadey Apr 27, 2026
ef8b700
fix mismerge
wadey Apr 27, 2026
e6eeb37
fix smoke tests
wadey Apr 27, 2026
fcfbec4
log the fips140 mode and version
wadey Apr 27, 2026
f9532f4
requires go1.26
wadey Apr 27, 2026
65450f9
need go1.26
wadey Apr 27, 2026
ae58085
cleanup, no GODEBUG needed
wadey Apr 28, 2026
1403473
bump linter to support go1.26
wadey Apr 28, 2026
bdbd483
Revert "bump linter to support go1.26"
wadey Apr 28, 2026
4ff9e97
Revert "need go1.26"
wadey Apr 28, 2026
d4d747f
no longer need go1.26 with this fix
wadey Apr 28, 2026
b79fdc2
better default
wadey Apr 28, 2026
5dd566e
also support fips140v1.26
wadey Apr 30, 2026
7f6976b
Merge remote-tracking branch 'origin/master' into fips140
wadey May 1, 2026
441a67f
fix missing space
wadey May 1, 2026
a1b8954
update Makefile
wadey May 1, 2026
b5ad62a
Merge remote-tracking branch 'origin/master' into fips140
wadey Jun 1, 2026
8671a4e
cleanup
wadey Jun 1, 2026
0897f49
default GODEBUG=fips140=only
wadey Jun 1, 2026
c3e2a2b
better smoke
wadey Jun 1, 2026
cfcdcb0
use go1.26
wadey Jun 1, 2026
dd081ff
cleanup
wadey Jun 1, 2026
f1a8054
latest golanglint-ci
wadey Jun 1, 2026
c73245c
fix missing import
wadey Jun 1, 2026
7c8a70b
fix smoke boringcrypto and fips140
wadey Jun 1, 2026
1d17c78
fixup tests
wadey Jun 1, 2026
56a09b7
fix
wadey Jun 1, 2026
cf5d73d
better check
wadey Jun 1, 2026
adb01f6
make the test match the code
wadey Jun 1, 2026
c7e0354
enforce GODEBUG=fips140=only
wadey Jun 2, 2026
37b752b
WIP
wadey Jun 8, 2026
90ea634
WIP
wadey Jun 8, 2026
7cd3875
fix expected for fips140
wadey Jun 8, 2026
06fb503
WIP
wadey Jun 9, 2026
d725e53
makefile cleanup
wadey Jun 9, 2026
f437c7d
more cleanup
wadey Jun 9, 2026
32db819
cleanup
wadey Jun 9, 2026
9709893
use testing log
wadey Jun 9, 2026
69a6db7
cleanup unused test
wadey Jun 9, 2026
cb9547b
remove commented out code
wadey Jun 9, 2026
3b30526
boringcrypto cleanup
wadey Jun 9, 2026
a383937
make the build tag clearer
wadey Jun 9, 2026
69c6132
fix the tag
wadey Jun 9, 2026
060b46f
better names
wadey Jun 9, 2026
67da623
cleanup enforcement
wadey Jun 9, 2026
7d087a6
add all fips140 platforms
wadey Jun 9, 2026
92bd785
no mips64le
wadey Jun 9, 2026
2efdcb0
fips140-all
wadey Jun 10, 2026
ac5a18e
use fips140-all in CI tests
wadey Jun 10, 2026
d42407c
dont need race detector on these extra smoke runs
wadey Jun 10, 2026
81afed4
Merge remote-tracking branch 'origin/master' into fips140
wadey Jun 18, 2026
90c7630
extract the internal FIPS GCM implementation
wadey Jul 8, 2026
14c9288
Ensure Curve25519 and ChaChaPoly are not used in fips140 enforced mode
wadey Jul 8, 2026
6675f5a
use go:debug to enable fips140=only
wadey Jul 8, 2026
4e8733c
run all smoke tests with -race
wadey Jul 8, 2026
3c1dd52
update README
wadey Jul 8, 2026
3264ebf
cleanup
wadey Jul 8, 2026
048fa3f
Merge remote-tracking branch 'origin/master' into fips140
wadey Jul 20, 2026
6be3d22
cleanup nonce
wadey Jul 20, 2026
e16a31f
return err instead of panic
wadey Jul 23, 2026
8d8cc4f
note that boringcrypto is deprecated
wadey Jul 23, 2026
009d42b
Merge remote-tracking branch 'origin/master' into fips140
wadey Jul 23, 2026
e832250
fix fips140-all
wadey Jul 24, 2026
0d91e3e
update PHONY
wadey Jul 24, 2026
fc950cf
one var for default fips version
wadey Jul 24, 2026
69e5e8e
cleanup
wadey Jul 24, 2026
00b498f
self-test the reflect code at init
wadey Jul 24, 2026
0e1f534
test fips140.Enforced mode
wadey Jul 24, 2026
738b4fa
cleanup
wadey Jul 24, 2026
7c00c74
complain earlier if in FIPS-140 enforced mode
wadey Jul 29, 2026
bf2f26b
clean up empty line
wadey Jul 29, 2026
a5cb635
use P256 as the default curve for fips140 mode
wadey Jul 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-version: '1.26'
check-latest: true

- name: Build
Expand All @@ -40,7 +40,7 @@ jobs:

- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-version: '1.26'
check-latest: true

- name: Build
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:

- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-version: '1.26'
check-latest: true

- name: Import certificates
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/smoke-extra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-version: '1.26'
check-latest: true

- name: add hashicorp source
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:

- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-version: '1.26'
check-latest: true

- name: add hashicorp source
Expand All @@ -92,7 +92,7 @@ jobs:

- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-version: '1.26'
check-latest: true

# WSL2 + Ubuntu so the smoke can run a real linux peer with its own
Expand Down
42 changes: 11 additions & 31 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,22 @@ jobs:

- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-version: '1.26'
check-latest: true

- name: build
run: make bin-docker CGO_ENABLED=1 BUILD_ARGS=-race
- name: Smoke Docker
run: make smoke-docker-race

- name: setup docker image
working-directory: ./.github/workflows/smoke
run: ./build.sh
- name: Smoke Docker IPv6 overlay
run: make smoke-docker-ipv6

- name: run smoke
working-directory: ./.github/workflows/smoke
run: ./smoke.sh
- name: Smoke Relay Docker
run: make smoke-relay-docker

- name: setup docker image ipv6
working-directory: ./.github/workflows/smoke
run: SMOKE_OVERLAY_IPV6=1 ./build.sh
- name: Smoke Docker boringcrypto
run: make boringcrypto smoke-docker

- name: run smoke ipv6
working-directory: ./.github/workflows/smoke
run: SMOKE_OVERLAY_IPV6=1 ./smoke.sh

- name: setup relay docker image
working-directory: ./.github/workflows/smoke
run: ./build-relay.sh

- name: run smoke relay
working-directory: ./.github/workflows/smoke
run: ./smoke-relay.sh

- name: setup docker image for P256
working-directory: ./.github/workflows/smoke
run: NAME="smoke-p256" CURVE=P256 ./build.sh

- name: run smoke-p256
working-directory: ./.github/workflows/smoke
run: NAME="smoke-p256" ./smoke.sh
- name: Smoke Docker fips140
run: make fips140-all smoke-docker

timeout-minutes: 10
19 changes: 12 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-version: '1.26'
check-latest: true

- name: Install goimports
Expand All @@ -42,7 +42,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.5
version: v2.12

test:
name: Test ${{ matrix.name }}
Expand All @@ -58,9 +58,14 @@ jobs:
e2e-cmd: make e2evv
- name: linux-boringcrypto
os: ubuntu-latest
build-cmd: make bin-boringcrypto
test-cmd: make test-boringcrypto
e2e-cmd: make e2e GOEXPERIMENT=boringcrypto CGO_ENABLED=1 TEST_ENV="TEST_LOGS=1" TEST_FLAGS="-v -ldflags -checklinkname=0"
build-cmd: make boringcrypto
test-cmd: make boringcrypto test
e2e-cmd: make boringcrypto e2evv
- name: linux-fips140
os: ubuntu-latest
build-cmd: make fips140-all
test-cmd: make fips140-all test
e2e-cmd: make fips140-all e2evv
- name: linux-pkcs11
os: ubuntu-latest
build-cmd: make bin-pkcs11
Expand All @@ -82,7 +87,7 @@ jobs:

- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-version: '1.26'
check-latest: true

- name: Build
Expand Down Expand Up @@ -127,7 +132,7 @@ jobs:

- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-version: '1.26'
check-latest: true

- name: Build ${{ matrix.name }}
Expand Down
98 changes: 79 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ ALL_CROSS_LINUX_ARM = linux-arm-5 linux-arm-6 linux-arm-7 linux-arm64
ALL_CROSS_LINUX_MIPS = linux-mips linux-mipsle linux-mips64 linux-mips64le linux-mips-softfloat
ALL_CROSS_LINUX_OTHER = linux-386 linux-ppc64le linux-riscv64 linux-loong64

# Based on section 2.2 of the Go Cryptographic Module CVMP Security Policy #5247
ALL_FIPS140 = linux-amd64-fips140 \
linux-arm64-fips140 \
windows-amd64-fips140 \
windows-arm64-fips140 \
darwin-arm64-fips140 \
freebsd-amd64-fips140 \
linux-arm-7-fips140 \
linux-mips64-fips140 \
linux-ppc64le-fips140

e2e:
$(TEST_ENV) go test -tags=e2e_testing -count=1 $(TEST_FLAGS) ./e2e

Expand Down Expand Up @@ -137,6 +148,8 @@ release-netbsd: $(ALL_NETBSD:%=build/nebula-%.tar.gz)

release-boringcrypto: build/nebula-linux-$(shell go env GOARCH)-boringcrypto.tar.gz

release-fips140: $(ALL_FIPS140:%=build/nebula-%.tar.gz)

BUILD_ARGS += -trimpath

bin-windows: build/windows-amd64/nebula.exe build/windows-amd64/nebula-cert.exe
Expand All @@ -157,17 +170,20 @@ bin-freebsd-arm64: build/freebsd-arm64/nebula build/freebsd-arm64/nebula-cert
bin-boringcrypto: build/linux-$(shell go env GOARCH)-boringcrypto/nebula build/linux-$(shell go env GOARCH)-boringcrypto/nebula-cert
mv $? .

bin-fips140: build/linux-$(shell go env GOARCH)-fips140/nebula build/linux-$(shell go env GOARCH)-fips140/nebula-cert
mv $? .

bin-pkcs11: BUILD_ARGS += -tags pkcs11
bin-pkcs11: CGO_ENABLED = 1
bin-pkcs11: bin

bin:
go build $(BUILD_ARGS) -ldflags "$(LDFLAGS)" -o ./nebula${NEBULA_CMD_SUFFIX} ${NEBULA_CMD_PATH}
go build $(BUILD_ARGS) -ldflags "$(LDFLAGS)" -o ./nebula-cert${NEBULA_CMD_SUFFIX} ./cmd/nebula-cert
$(GOENV) go build $(BUILD_ARGS) -ldflags "$(LDFLAGS)" -o ./nebula${NEBULA_CMD_SUFFIX} ${NEBULA_CMD_PATH}
$(GOENV) go build $(BUILD_ARGS) -ldflags "$(LDFLAGS)" -o ./nebula-cert${NEBULA_CMD_SUFFIX} ./cmd/nebula-cert

install:
go install $(BUILD_ARGS) -ldflags "$(LDFLAGS)" ${NEBULA_CMD_PATH}
go install $(BUILD_ARGS) -ldflags "$(LDFLAGS)" ./cmd/nebula-cert
$(GOENV) go install $(BUILD_ARGS) -ldflags "$(LDFLAGS)" ${NEBULA_CMD_PATH}
$(GOENV) go install $(BUILD_ARGS) -ldflags "$(LDFLAGS)" ./cmd/nebula-cert

build/linux-arm-%: GOENV += GOARM=$(word 3, $(subst -, ,$*))
build/linux-mips-%: GOENV += GOMIPS=$(word 3, $(subst -, ,$*))
Expand All @@ -178,8 +194,11 @@ build/linux-mips-softfloat/%: LDFLAGS += -s -w
# boringcrypto
build/linux-amd64-boringcrypto/%: GOENV += GOEXPERIMENT=boringcrypto CGO_ENABLED=1
build/linux-arm64-boringcrypto/%: GOENV += GOEXPERIMENT=boringcrypto CGO_ENABLED=1
build/linux-amd64-boringcrypto/%: LDFLAGS += -checklinkname=0
build/linux-arm64-boringcrypto/%: LDFLAGS += -checklinkname=0

# fips140
$(foreach _rule, $(ALL_FIPS140), build/$(_rule)/%): GOENV += GOFIPS140=v1.0.0
$(foreach _rule, $(ALL_FIPS140), build/$(_rule)/%): LDFLAGS += -X runtime.godebugDefault=fips140=only
$(foreach _rule, $(ALL_FIPS140), build/$(_rule)/%): BUILD_ARGS += -tags fips140enforce

build/%/nebula: .FORCE
GOOS=$(firstword $(subst -, , $*)) \
Expand Down Expand Up @@ -210,10 +229,7 @@ vet:
go vet $(VET_FLAGS) -v ./...

test:
go test -v ./...

test-boringcrypto:
GOEXPERIMENT=boringcrypto CGO_ENABLED=1 go test -ldflags "-checklinkname=0" -v ./...
$(TEST_ENV) go test $(TEST_FLAGS) -v ./...

test-pkcs11:
CGO_ENABLED=1 go test -v -tags pkcs11 ./...
Expand Down Expand Up @@ -256,29 +272,73 @@ ifeq ($(words $(MAKECMDGOALS)),1)
@$(MAKE) service ${.DEFAULT_GOAL} --no-print-directory
endif

# Useful to chain together, like:
# - make fips140 e2evv
# - make fips140 smoke-docker
# Use `release-fips140` or `bin-fips140` to build release binaries
fips140:

@nbrownus nbrownus Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boringcrypto outputs with a suffix on the folder like: build/linux-amd64-boringcrypto/nebula

fips140 outputs to a colliding path with non fips140: build/linux-amd64/nebula, seems like a good idea to push this into build/linux-amd64-fips140/nebula.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! let me rework this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added release-fips140 and bin-fips140 for this

@echo > $(NULL_FILE)
ifeq ($(strip $(GOFIPS140)),)
$(eval GOFIPS140 = v1.0.0)
endif
$(eval GOENV += GOFIPS140=$(GOFIPS140))
$(eval LDFLAGS += -X runtime.godebugDefault=fips140=only)
$(eval BUILD_ARGS += -tags fips140enforce)
$(eval TEST_ENV += $(GOENV))
$(eval CURVE = P256)
ifeq ($(words $(MAKECMDGOALS)),1)
@$(MAKE) fips140 GOFIPS140=$(GOFIPS140) ${.DEFAULT_GOAL} --no-print-directory
endif

# To test the future pending module, use like `make fips140-latest test`
ALL_GOFIPS140 = v1.0.0 v1.26.0 latest
define FIPS140_rule
fips140-$(1): GOFIPS140 = $(1)
fips140-$(1): fips140
endef
$(foreach _rule, $(ALL_GOFIPS140), $(eval $(call FIPS140_rule,$(_rule))))

# Iterate and tun the goals for all fips versions, like `make fips140-all test`
fips140-all:
@$(foreach _v,$(ALL_GOFIPS140),$(MAKE) fips140-$(_v) $(filter-out fips140-all,$(MAKECMDGOALS)) &&) true

# Useful to chain together, like:
# - make boringcrypto e2evv
# - make boringcrypto smoke-docker
# Use `release-boringcrypto` or `bin-boringcrypto` to build release binaries
boringcrypto:
@echo > $(NULL_FILE)
$(eval GOENV += GOEXPERIMENT=boringcrypto CGO_ENABLED=1)
$(eval TEST_ENV += $(GOENV))
$(eval CURVE = P256)
ifeq ($(words $(MAKECMDGOALS)),1)
@$(MAKE) boringcrypto ${.DEFAULT_GOAL} --no-print-directory
endif

bin-docker: bin build/linux-amd64/nebula build/linux-amd64/nebula-cert

smoke-docker: bin-docker
cd .github/workflows/smoke/ && ./build.sh
cd .github/workflows/smoke/ && ./smoke.sh
cd .github/workflows/smoke/ && NAME="smoke-p256" CURVE="P256" ./build.sh
cd .github/workflows/smoke/ && NAME="smoke-p256" ./smoke.sh
# This is so we can limit `fips140` smoke test to just P256 curve.
if [ "$(CURVE)" != "P256" ]; then cd .github/workflows/smoke/ && $(GOENV) ./build.sh; fi
if [ "$(CURVE)" != "P256" ]; then cd .github/workflows/smoke/ && $(GOENV) ./smoke.sh; fi
cd .github/workflows/smoke/ && $(GOENV) NAME="smoke-p256" CURVE="P256" ./build.sh
cd .github/workflows/smoke/ && $(GOENV) NAME="smoke-p256" ./smoke.sh

smoke-relay-docker: bin-docker
cd .github/workflows/smoke/ && ./build-relay.sh
cd .github/workflows/smoke/ && ./smoke-relay.sh
cd .github/workflows/smoke/ && $(GOENV) ./build-relay.sh
cd .github/workflows/smoke/ && $(GOENV) ./smoke-relay.sh

smoke-docker-ipv6: export SMOKE_OVERLAY_IPV6 = 1
smoke-docker-ipv6: smoke-docker

smoke-docker-race: BUILD_ARGS = -race
smoke-docker-race: CGO_ENABLED = 1
smoke-docker-race: BUILD_ARGS += -race
smoke-docker-race: GOENV += CGO_ENABLED=1
smoke-docker-race: smoke-docker

smoke-vagrant/%: bin-docker build/%/nebula
cd .github/workflows/smoke/ && ./build.sh $*
cd .github/workflows/smoke/ && ./smoke-vagrant.sh $*

.FORCE:
.PHONY: all all-linux all-freebsd all-openbsd all-netbsd all-darwin all-windows all-cross-linux all-cross-linux-arm all-cross-linux-mips all-cross-linux-other all-cross-darwin all-cross-windows bench bench-cpu bench-cpu-long bin build-test-mobile e2e e2ev e2evv e2evvv e2evvvv proto release service smoke-docker smoke-docker-race test test-cov-html smoke-vagrant/%
.PHONY: all all-linux all-freebsd all-openbsd all-netbsd all-darwin all-windows all-cross-linux all-cross-linux-arm all-cross-linux-mips all-cross-linux-other all-cross-darwin all-cross-windows bench bench-cpu bench-cpu-long bin build-test-mobile e2e e2ev e2evv e2evvv e2evvvv fips140 proto release service smoke-docker smoke-docker-race test test-cov-html smoke-vagrant/%
.DEFAULT_GOAL := bin
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,25 @@ To build nebula for a specific platform (ex, Windows):

See the [Makefile](Makefile) for more details on build targets

## Curve P256 and BoringCrypto
## Curve P256, BoringCrypto and FIPS 140-3 mode

The default curve used for cryptographic handshakes and signatures is Curve25519. This is the recommended setting for most users. If your deployment has certain compliance requirements, you have the option of creating your CA using `nebula-cert ca -curve P256` to use NIST Curve P256. The CA will then sign certificates using ECDSA P256, and any hosts using these certificates will use P256 for ECDH handshakes.

In addition, Nebula can be built using the [BoringCrypto GOEXPERIMENT](https://github.com/golang/go/blob/go1.20/src/crypto/internal/boring/README.md) by running either of the following make targets:
Nebula can be built using the [BoringCrypto GOEXPERIMENT](https://github.com/golang/go/blob/go1.20/src/crypto/internal/boring/README.md) by running either of the following make targets:

```sh
make bin-boringcrypto
make release-boringcrypto
```

Nebula can also be built to support the [FIPS 140-3](https://go.dev/doc/security/fips140) mode of Go by running either of the following make targets. (This sets GOFIPS140=v1.0.0,
which must be done at compile time so that the correct AES-GCM can be used for FIPS 140-3 enforcement mode).

```sh
make fips140
make fips140 release
```

This is not the recommended default deployment, but may be useful based on your compliance requirements.

## Credits
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/slackhq/nebula

go 1.25.0
go 1.26

require (
dario.cat/mergo v1.0.2
Expand Down
4 changes: 4 additions & 0 deletions interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package nebula

import (
"context"
"crypto/fips140"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -235,6 +236,9 @@ func (f *Interface) activate() error {
"build", f.version,
"udpAddr", addr,
"boringcrypto", boringEnabled(),
"fips140Version", fips140.Version(),
"fips140Enabled", fips140.Enabled(),
"fips140Enforced", fips140.Enforced(),
)

if f.routines > 1 {
Expand Down
Loading