Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 libbeat/beat/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type Info struct {
FirstStart time.Time // The time of the first start of the Beat.
StartTime time.Time // The time of last start of the Beat. Updated when the Beat is started or restarted.
UserAgent string // A string of the user-agent that can be passed to any outputs or network connections
FIPS bool // If the beat is a FIPS variant.

// Monitoring-related fields
Monitoring Monitoring
Expand Down
3 changes: 2 additions & 1 deletion libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
FirstStart: time.Now(),
StartTime: time.Now(),
EphemeralID: metricreport.EphemeralID(),
FIPS: version.FIPSEnabled,
},
Fields: fields,
Registry: reload.NewRegistry(),
Expand Down Expand Up @@ -466,7 +467,7 @@
}
}

namespaceReg := b.Beat.Info.Monitoring.Namespace.GetRegistry()

Check failure on line 470 in libbeat/cmd/instance/beat.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

QF1008: could remove embedded field "Beat" from selector (staticcheck)
reg := b.Info.Monitoring.StatsRegistry.GetRegistry("libbeat")
if reg == nil {
reg = b.Info.Monitoring.StatsRegistry.NewRegistry("libbeat")
Expand Down Expand Up @@ -553,7 +554,7 @@
}

log := b.Info.Logger.Named("beat")
log.Infof("Setup Beat: %s; Version: %s", b.Info.Beat, b.Info.Version)
log.Infof("Setup Beat: %s; Version: %s (FIPS: %v)", b.Info.Beat, b.Info.Version, b.Info.FIPS)
b.logSystemInfo(log)

err = b.registerESVersionCheckCallback()
Expand Down
4 changes: 2 additions & 2 deletions libbeat/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@
func(_ *cobra.Command, args []string) error {
beat, err := instance.NewBeat(settings.Name, settings.IndexPrefix, settings.Version, settings.ElasticLicensed, settings.Initialize)
if err != nil {
return fmt.Errorf("error initializing beat: %s", err)

Check failure on line 40 in libbeat/cmd/version.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
}

buildTime := "unknown"
if bt := version.BuildTime(); !bt.IsZero() {
buildTime = bt.String()
}
fmt.Printf("%s version %s (%s), libbeat %s [%s built %s]\n",
fmt.Printf("%s version %s (%s), libbeat %s [%s built %s] (FIPS: %v)\n",

Check failure on line 47 in libbeat/cmd/version.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

use of `fmt.Printf` forbidden by pattern `fmt.Print.*` (forbidigo)
beat.Info.Beat, beat.Info.Version, runtime.GOARCH, version.GetDefaultVersion(),
version.Commit(), buildTime)
version.Commit(), buildTime, version.FIPSEnabled)
return nil
}),
}
Expand Down
23 changes: 23 additions & 0 deletions libbeat/version/fips.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

//go:build requirefips

package version

// Set FIPSEnabled to true for FIPS builds.
const FIPSEnabled bool = true
23 changes: 23 additions & 0 deletions libbeat/version/nofips.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

//go:build !requirefips

package version

// Set FIPSEnabled to false for non-FIPS builds.
const FIPSEnabled bool = false
Loading