Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fips): add fips compliant packages #155

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/on_prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ jobs:
with:
tag: ${{ github.event.release.tag_name }}
integration: "mongodb"
upload_fips_packages: true
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ jobs:
with:
integration: mongodb
tag: ${{ github.event.release.tag_name }}
upload_fips_packages: true
secrets: inherit
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Unreleased section should follow [Release Toolkit](https://github.com/newrelic/r

## Unreleased

### enhancements
- Add FIPS compliant packages

## v2.9.2 - 2025-01-21

### ⛓️ Dependencies
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ BINARY_NAME = nri-$(INTEGRATION)
GO_PKGS := $(shell go list ./... | grep -v "/vendor/")
GO_FILES := ./src/
GOFLAGS = -mod=readonly
GO_VERSION ?= $(shell grep '^go ' go.mod | awk '{print $$2}')
BUILDER_IMAGE ?= "ghcr.io/newrelic/coreint-automation:latest-go$(GO_VERSION)-ubuntu16.04"


all: build
Expand Down
94 changes: 90 additions & 4 deletions build/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
version: 2
project_name: nri-mongodb
builds:
- id: nri-nix
main: ./src
Expand All @@ -17,6 +20,26 @@ builds:
ignore:
- goos: darwin
goarch: 386

- id: nri-nix-fips
main: ./src
binary: nri-mongodb
ldflags:
- -s -w -X main.integrationVersion={{.Version}} -X main.gitCommit={{.Commit}} -X main.buildDate={{.Date}}
env:
- CGO_ENABLED=1
- GOEXPERIMENT=boringcrypto
- >-
{{- if eq .Arch "arm64" -}}
CC=aarch64-linux-gnu-gcc
{{- end }}
goos:
- linux
goarch:
- amd64
- arm64
tags:
- fips

- id: nri-win
main: ./src
Expand All @@ -35,7 +58,8 @@ builds:

nfpms:
- id: linux
file_name_template: "{{ .ProjectName }}_{{ .Version }}-1_{{ .Arch }}"
package_name: nri-mongodb
file_name_template: "{{ .PackageName }}_{{ .Version }}-1_{{ .Arch }}"
vendor: "New Relic, Inc."
homepage: "https://www.newrelic.com/infrastructure"
maintainer: "New Relic Infrastructure Team <[email protected]>"
Expand Down Expand Up @@ -67,9 +91,60 @@ nfpms:

overrides:
rpm:
file_name_template: "{{ .ProjectName }}-{{ .Version }}-1.{{ .Arch }}"
replacements:
amd64: x86_64
file_name_template: >-
{{- .ProjectName }}-
{{- .Version }}-1.
{{- if eq .Arch "amd64" -}}x86_64
{{- else -}}
{{ .Arch }}
{{- end }}

# Formats to be generated.
formats:
- deb
- rpm

- id: linux-fips
package_name: nri-mongodb-fips
file_name_template: "{{ .PackageName }}_{{ .Version }}-1_{{ .Arch }}"
vendor: "New Relic, Inc."
homepage: "https://www.newrelic.com/infrastructure"
maintainer: "New Relic Infrastructure Team <[email protected]>"
description: "New Relic Infrastructure mongodb Integration extend the core New Relic\nInfrastructure agent's capabilities to allow you to collect metric and\nlive state data from mongodb components."
license: "https://newrelic.com/terms (also see LICENSE installed with this package)"

builds:
- nri-nix-fips

dependencies:
- newrelic-infra-fips (>= 1.20.0)

bindir: "/var/db/newrelic-infra/newrelic-integrations/bin"

contents:
- src: "mongodb-config.yml.sample"
dst: "/etc/newrelic-infra/integrations.d/mongodb-config.yml.sample"
- src: "mongodb-log.yml.example"
dst: "/etc/newrelic-infra/logging.d/mongodb-log.yml.example"
- src: "CHANGELOG.md"
dst: "/usr/share/doc/nri-mongodb/CHANGELOG.md"
- src: "README.md"
dst: "/usr/share/doc/nri-mongodb/README.md"
- src: "LICENSE"
dst: "/usr/share/doc/nri-mongodb/LICENSE"
- src: "legacy/mongodb-definition.yml"
dst: "/var/db/newrelic-infra/newrelic-integrations/mongodb-definition.yml"
type: config

overrides:
rpm:
file_name_template: >-
{{- .ProjectName }}-fips-
{{- .Version }}-1.
{{- if eq .Arch "amd64" -}}x86_64
{{- else -}}
{{ .Arch }}
{{- end }}

# Formats to be generated.
formats:
Expand All @@ -87,6 +162,17 @@ archives:
dst: .
strip_parent: true
format: tar.gz

- id: nri-nix-fips
builds:
- nri-nix-fips
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Version }}_{{ .Arch }}_dirty"
files:
- mongodb-config.yml.sample
- src: 'legacy/mongodb-definition.yml'
dst: .
strip_parent: true
format: tar.gz

- id: nri-win
builds:
Expand Down
17 changes: 0 additions & 17 deletions build/Dockerfile

This file was deleted.

15 changes: 8 additions & 7 deletions build/ci.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
BUILDER_TAG ?= nri-$(INTEGRATION)-builder
.PHONY : ci/pull-builder-image
ci/pull-builder-image:
@docker pull $(BUILDER_IMAGE)

.PHONY : ci/deps
ci/deps:
@docker build -t $(BUILDER_TAG) -f $(CURDIR)/build/Dockerfile $(CURDIR)
ci/deps: ci/pull-builder-image

.PHONY : ci/debug-container
ci/debug-container: ci/deps
Expand All @@ -17,15 +18,15 @@ ci/debug-container: ci/deps
-e GPG_MAIL \
-e GPG_PASSPHRASE \
-e GPG_PRIVATE_KEY_BASE64 \
$(BUILDER_TAG) bash
$(BUILDER_IMAGE) bash

.PHONY : ci/test
ci/test: ci/deps
@docker run --rm -t \
--name "nri-$(INTEGRATION)-test" \
-v $(CURDIR):/go/src/github.com/newrelic/nri-$(INTEGRATION) \
-w /go/src/github.com/newrelic/nri-$(INTEGRATION) \
$(BUILDER_TAG) make test
$(BUILDER_IMAGE) make test

.PHONY : ci/snyk-test
ci/snyk-test:
Expand All @@ -46,7 +47,7 @@ ifdef TAG
-w /go/src/github.com/newrelic/nri-$(INTEGRATION) \
-e INTEGRATION \
-e TAG \
$(BUILDER_TAG) make release/build
$(BUILDER_IMAGE) make release/build
else
@echo "===> $(INTEGRATION) === [ci/build] TAG env variable expected to be set"
exit 1
Expand All @@ -67,7 +68,7 @@ ifdef TAG
-e GPG_MAIL \
-e GPG_PASSPHRASE \
-e GPG_PRIVATE_KEY_BASE64 \
$(BUILDER_TAG) make release
$(BUILDER_IMAGE) make release
else
@echo "===> $(INTEGRATION) === [ci/prerelease] TAG env variable expected to be set"
exit 1
Expand Down
47 changes: 0 additions & 47 deletions build/nix/sign.sh

This file was deleted.

8 changes: 4 additions & 4 deletions build/release.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BUILD_DIR := ./bin/
GORELEASER_VERSION := v0.174.1
GORELEASER_VERSION := v2.4.4
GORELEASER_BIN ?= bin/goreleaser

bin:
Expand Down Expand Up @@ -27,10 +27,10 @@ release/deps: $(GORELEASER_BIN)
release/build: release/deps release/clean
ifeq ($(PRERELEASE), true)
@echo "===> $(INTEGRATION) === [release/build] PRE-RELEASE compiling all binaries, creating packages, archives"
@$(GORELEASER_BIN) release --config $(CURDIR)/build/.goreleaser.yml --rm-dist
@$(GORELEASER_BIN) release --config $(CURDIR)/build/.goreleaser.yml --clean
else
@echo "===> $(INTEGRATION) === [release/build] build compiling all binaries"
@$(GORELEASER_BIN) build --config $(CURDIR)/build/.goreleaser.yml --snapshot --rm-dist
@$(GORELEASER_BIN) build --config $(CURDIR)/build/.goreleaser.yml --snapshot --clean
endif

.PHONY : release/fix-archive
Expand All @@ -43,7 +43,7 @@ release/fix-archive:
.PHONY : release/sign/nix
release/sign/nix:
@echo "===> $(INTEGRATION) === [release/sign] signing packages"
@bash $(CURDIR)/build/nix/sign.sh
@bash sign.sh


.PHONY : release/publish
Expand Down
11 changes: 11 additions & 0 deletions src/fips.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2025 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build fips
// +build fips

package main

import (
_ "crypto/tls/fipsonly"
)
Loading