From 0944f7145722de22706aed33386c1f16af0ba9cc Mon Sep 17 00:00:00 2001 From: skpratt Date: Mon, 29 May 2023 13:02:06 -0500 Subject: [PATCH] fips oss version changes (#17500) --- command/version/formatter.go | 4 ++++ command/version/version.go | 5 ++++- version/fips.go | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 version/fips.go diff --git a/command/version/formatter.go b/command/version/formatter.go index ee55406457..c7c16da441 100644 --- a/command/version/formatter.go +++ b/command/version/formatter.go @@ -49,6 +49,10 @@ func (_ *prettyFormatter) Format(info *VersionInfo) (string, error) { buffer.WriteString(fmt.Sprintf("Build Date %s\n", info.BuildDate.Format(time.RFC3339))) + if info.FIPS != "" { + buffer.WriteString(fmt.Sprintf("FIPS: %s\n", info.FIPS)) + } + var supplement string if info.RPC.Default < info.RPC.Max { supplement = fmt.Sprintf(" (agent will automatically use protocol >%d when speaking to compatible agents)", diff --git a/command/version/version.go b/command/version/version.go index 6dc42a7ec1..1c2157a8ea 100644 --- a/command/version/version.go +++ b/command/version/version.go @@ -9,10 +9,11 @@ import ( "strings" "time" + "github.com/mitchellh/cli" + "github.com/hashicorp/consul/agent/consul" "github.com/hashicorp/consul/command/flags" "github.com/hashicorp/consul/version" - "github.com/mitchellh/cli" ) func New(ui cli.Ui) *cmd { @@ -50,6 +51,7 @@ type VersionInfo struct { Version string Revision string Prerelease string + FIPS string `json:",omitempty"` BuildDate time.Time RPC RPCVersionInfo } @@ -78,6 +80,7 @@ func (c *cmd) Run(args []string) int { Revision: version.GitCommit, Prerelease: version.VersionPrerelease, BuildDate: buildDate, + FIPS: version.GetFIPSInfo(), RPC: RPCVersionInfo{ Default: consul.DefaultRPCProtocol, Min: int(consul.ProtocolVersionMin), diff --git a/version/fips.go b/version/fips.go new file mode 100644 index 0000000000..5b131754c5 --- /dev/null +++ b/version/fips.go @@ -0,0 +1,7 @@ +//go:build !fips + +package version + +func GetFIPSInfo() string { + return "" +}