diff --git a/libbeat/beat/info.go b/libbeat/beat/info.go index 31fd96e42e34..896259541f3c 100644 --- a/libbeat/beat/info.go +++ b/libbeat/beat/info.go @@ -28,18 +28,19 @@ import ( // Info stores a beats instance meta data. type Info struct { - Beat string // The actual beat's name - IndexPrefix string // The beat's index prefix in Elasticsearch. - Version string // The beat version. Defaults to the libbeat version when an implementation does not set a version - ElasticLicensed bool // Whether the beat is licensed under and Elastic License - Name string // configured beat name - Hostname string // hostname - FQDN string // FQDN - ID uuid.UUID // ID assigned to beat machine - EphemeralID uuid.UUID // ID assigned to beat process invocation (PID) - 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 + Beat string // The actual beat's name + IndexPrefix string // The beat's index prefix in Elasticsearch. + Version string // The beat version. Defaults to the libbeat version when an implementation does not set a version + ElasticLicensed bool // Whether the beat is licensed under and Elastic License + Name string // configured beat name + Hostname string // hostname + FQDN string // FQDN + ID uuid.UUID // ID assigned to beat machine + EphemeralID uuid.UUID // ID assigned to beat process invocation (PID) + 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 + FIPSDistribution bool // If the beat was compiled as a FIPS distribution. // Monitoring-related fields Monitoring Monitoring diff --git a/libbeat/cmd/instance/beat.go b/libbeat/cmd/instance/beat.go index 424a354343c2..0abdb0f2b524 100644 --- a/libbeat/cmd/instance/beat.go +++ b/libbeat/cmd/instance/beat.go @@ -244,16 +244,17 @@ func NewBeat(name, indexPrefix, v string, elasticLicensed bool, initFuncs []func b := beat.Beat{ Info: beat.Info{ - Beat: name, - ElasticLicensed: elasticLicensed, - IndexPrefix: indexPrefix, - Version: v, - Name: hostname, - Hostname: hostname, - ID: id, - FirstStart: time.Now(), - StartTime: time.Now(), - EphemeralID: metricreport.EphemeralID(), + Beat: name, + ElasticLicensed: elasticLicensed, + IndexPrefix: indexPrefix, + Version: v, + Name: hostname, + Hostname: hostname, + ID: id, + FirstStart: time.Now(), + StartTime: time.Now(), + EphemeralID: metricreport.EphemeralID(), + FIPSDistribution: version.FIPSDistribution, }, Fields: fields, Registry: reload.NewRegistry(), @@ -553,7 +554,7 @@ func (b *Beat) createBeater(bt beat.Creator) (beat.Beater, error) { } log := logp.NewLogger("beat") - log.Infof("Setup Beat: %s; Version: %s", b.Info.Beat, b.Info.Version) + log.Infof("Setup Beat: %s; Version: %s (FIPS-distribution: %v)", b.Info.Beat, b.Info.Version, b.Info.FIPSDistribution) b.logSystemInfo(log) err = b.registerESVersionCheckCallback() diff --git a/libbeat/cmd/version.go b/libbeat/cmd/version.go index a26ed1a8089a..05246aa87532 100644 --- a/libbeat/cmd/version.go +++ b/libbeat/cmd/version.go @@ -44,9 +44,9 @@ func GenVersionCmd(settings instance.Settings) *cobra.Command { 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-distribution: %v)\n", beat.Info.Beat, beat.Info.Version, runtime.GOARCH, version.GetDefaultVersion(), - version.Commit(), buildTime) + version.Commit(), buildTime, version.FIPSDistribution) return nil }), } diff --git a/libbeat/version/fips.go b/libbeat/version/fips.go new file mode 100644 index 000000000000..9901459a31b5 --- /dev/null +++ b/libbeat/version/fips.go @@ -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 FIPSDistribution to true for FIPS builds. +const FIPSDistribution bool = true diff --git a/libbeat/version/nofips.go b/libbeat/version/nofips.go new file mode 100644 index 000000000000..2ce48e90193b --- /dev/null +++ b/libbeat/version/nofips.go @@ -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 FIPSDistribution to false for non-FIPS builds. +const FIPSDistribution bool = false