Skip to content

Commit 6979356

Browse files
[8.19](backport #43840) Add FIPS indicator to startup and version command (#44122)
* Add FIPS indicator to startup and version command (#43840) * Add FIPS indicator to startup and version command * Rename FIPS variables to FIPSDistribution * Reword FIPS in version and log to FIPS-distribution (cherry picked from commit 868cf62) # Conflicts: # libbeat/cmd/instance/beat.go * Fix merge --------- Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com> Co-authored-by: michel-laterman <michel.laterman@elastic.co>
1 parent 236288a commit 6979356

File tree

5 files changed

+73
-25
lines changed

5 files changed

+73
-25
lines changed

libbeat/beat/info.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,19 @@ import (
2828

2929
// Info stores a beats instance meta data.
3030
type Info struct {
31-
Beat string // The actual beat's name
32-
IndexPrefix string // The beat's index prefix in Elasticsearch.
33-
Version string // The beat version. Defaults to the libbeat version when an implementation does not set a version
34-
ElasticLicensed bool // Whether the beat is licensed under and Elastic License
35-
Name string // configured beat name
36-
Hostname string // hostname
37-
FQDN string // FQDN
38-
ID uuid.UUID // ID assigned to beat machine
39-
EphemeralID uuid.UUID // ID assigned to beat process invocation (PID)
40-
FirstStart time.Time // The time of the first start of the Beat.
41-
StartTime time.Time // The time of last start of the Beat. Updated when the Beat is started or restarted.
42-
UserAgent string // A string of the user-agent that can be passed to any outputs or network connections
31+
Beat string // The actual beat's name
32+
IndexPrefix string // The beat's index prefix in Elasticsearch.
33+
Version string // The beat version. Defaults to the libbeat version when an implementation does not set a version
34+
ElasticLicensed bool // Whether the beat is licensed under and Elastic License
35+
Name string // configured beat name
36+
Hostname string // hostname
37+
FQDN string // FQDN
38+
ID uuid.UUID // ID assigned to beat machine
39+
EphemeralID uuid.UUID // ID assigned to beat process invocation (PID)
40+
FirstStart time.Time // The time of the first start of the Beat.
41+
StartTime time.Time // The time of last start of the Beat. Updated when the Beat is started or restarted.
42+
UserAgent string // A string of the user-agent that can be passed to any outputs or network connections
43+
FIPSDistribution bool // If the beat was compiled as a FIPS distribution.
4344

4445
// Monitoring-related fields
4546
Monitoring Monitoring

libbeat/cmd/instance/beat.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,17 @@ func NewBeat(name, indexPrefix, v string, elasticLicensed bool, initFuncs []func
244244

245245
b := beat.Beat{
246246
Info: beat.Info{
247-
Beat: name,
248-
ElasticLicensed: elasticLicensed,
249-
IndexPrefix: indexPrefix,
250-
Version: v,
251-
Name: hostname,
252-
Hostname: hostname,
253-
ID: id,
254-
FirstStart: time.Now(),
255-
StartTime: time.Now(),
256-
EphemeralID: metricreport.EphemeralID(),
247+
Beat: name,
248+
ElasticLicensed: elasticLicensed,
249+
IndexPrefix: indexPrefix,
250+
Version: v,
251+
Name: hostname,
252+
Hostname: hostname,
253+
ID: id,
254+
FirstStart: time.Now(),
255+
StartTime: time.Now(),
256+
EphemeralID: metricreport.EphemeralID(),
257+
FIPSDistribution: version.FIPSDistribution,
257258
},
258259
Fields: fields,
259260
Registry: reload.NewRegistry(),
@@ -553,7 +554,7 @@ func (b *Beat) createBeater(bt beat.Creator) (beat.Beater, error) {
553554
}
554555

555556
log := logp.NewLogger("beat")
556-
log.Infof("Setup Beat: %s; Version: %s", b.Info.Beat, b.Info.Version)
557+
log.Infof("Setup Beat: %s; Version: %s (FIPS-distribution: %v)", b.Info.Beat, b.Info.Version, b.Info.FIPSDistribution)
557558
b.logSystemInfo(log)
558559

559560
err = b.registerESVersionCheckCallback()

libbeat/cmd/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ func GenVersionCmd(settings instance.Settings) *cobra.Command {
4444
if bt := version.BuildTime(); !bt.IsZero() {
4545
buildTime = bt.String()
4646
}
47-
fmt.Printf("%s version %s (%s), libbeat %s [%s built %s]\n",
47+
fmt.Printf("%s version %s (%s), libbeat %s [%s built %s] (FIPS-distribution: %v)\n",
4848
beat.Info.Beat, beat.Info.Version, runtime.GOARCH, version.GetDefaultVersion(),
49-
version.Commit(), buildTime)
49+
version.Commit(), buildTime, version.FIPSDistribution)
5050
return nil
5151
}),
5252
}

libbeat/version/fips.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Licensed to Elasticsearch B.V. under one or more contributor
2+
// license agreements. See the NOTICE file distributed with
3+
// this work for additional information regarding copyright
4+
// ownership. Elasticsearch B.V. licenses this file to you under
5+
// the Apache License, Version 2.0 (the "License"); you may
6+
// not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
//go:build requirefips
19+
20+
package version
21+
22+
// Set FIPSDistribution to true for FIPS builds.
23+
const FIPSDistribution bool = true

libbeat/version/nofips.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Licensed to Elasticsearch B.V. under one or more contributor
2+
// license agreements. See the NOTICE file distributed with
3+
// this work for additional information regarding copyright
4+
// ownership. Elasticsearch B.V. licenses this file to you under
5+
// the Apache License, Version 2.0 (the "License"); you may
6+
// not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
//go:build !requirefips
19+
20+
package version
21+
22+
// Set FIPSDistribution to false for non-FIPS builds.
23+
const FIPSDistribution bool = false

0 commit comments

Comments
 (0)