From 42b06d782db9952f88d46dff49b30b37878c7e8f Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:50:42 -0500 Subject: [PATCH 01/27] Elastic Defend arm64 is not supported on Windows yet --- ...inject_config.go => inject_config_unix.go} | 3 + .../application/info/inject_config_windows.go | 89 +++++++++++++++++++ specs/endpoint-security.spec.yml | 2 + 3 files changed, 94 insertions(+) rename internal/pkg/agent/application/info/{inject_config.go => inject_config_unix.go} (95%) create mode 100644 internal/pkg/agent/application/info/inject_config_windows.go diff --git a/internal/pkg/agent/application/info/inject_config.go b/internal/pkg/agent/application/info/inject_config_unix.go similarity index 95% rename from internal/pkg/agent/application/info/inject_config.go rename to internal/pkg/agent/application/info/inject_config_unix.go index 03f57a6ddcd..06b6d72c2c0 100644 --- a/internal/pkg/agent/application/info/inject_config.go +++ b/internal/pkg/agent/application/info/inject_config_unix.go @@ -2,6 +2,8 @@ // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build !windows + package info import ( @@ -47,6 +49,7 @@ func agentGlobalConfig() (map[string]interface{}, error) { }, "runtime.os": runtime.GOOS, "runtime.arch": runtime.GOARCH, + "runtime.nativeArch": "", // Unknown native CPU architecture "runtime.osinfo.type": hostInfo.Info().OS.Type, "runtime.osinfo.family": hostInfo.Info().OS.Family, "runtime.osinfo.version": hostInfo.Info().OS.Version, diff --git a/internal/pkg/agent/application/info/inject_config_windows.go b/internal/pkg/agent/application/info/inject_config_windows.go new file mode 100644 index 00000000000..0f44b0cc8f4 --- /dev/null +++ b/internal/pkg/agent/application/info/inject_config_windows.go @@ -0,0 +1,89 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +//go:build windows + +package info + +import ( + "fmt" + "runtime" + "syscall" + "unsafe" + + "github.com/elastic/elastic-agent/internal/pkg/agent/application/paths" + "github.com/elastic/elastic-agent/internal/pkg/agent/errors" + "github.com/elastic/elastic-agent/internal/pkg/config" + "github.com/elastic/go-sysinfo" +) + +// InjectAgentConfig injects config to a provided configuration. +func InjectAgentConfig(c *config.Config) error { + globalConfig, err := agentGlobalConfig() + if err != nil { + return err + } + + if err := c.Merge(globalConfig); err != nil { + return errors.New("failed to inject agent global config", err, errors.TypeConfig) + } + + return nil +} + +// agentGlobalConfig gets global config used for resolution of variables inside configuration +// such as ${path.data}. +func agentGlobalConfig() (map[string]interface{}, error) { + hostInfo, err := sysinfo.Host() + if err != nil { + return nil, err + } + + return map[string]interface{}{ + "path": map[string]interface{}{ + "data": paths.Data(), + "config": paths.Config(), + "home": paths.Home(), + "logs": paths.Logs(), + }, + "host": map[string]interface{}{ + "id": hostInfo.Info().UniqueID, + }, + "runtime.os": runtime.GOOS, + "runtime.arch": runtime.GOARCH, + "runtime.nativeArch": nativeArch(), + "runtime.osinfo.type": hostInfo.Info().OS.Type, + "runtime.osinfo.family": hostInfo.Info().OS.Family, + "runtime.osinfo.version": hostInfo.Info().OS.Version, + "runtime.osinfo.major": hostInfo.Info().OS.Major, + "runtime.osinfo.minor": hostInfo.Info().OS.Minor, + "runtime.osinfo.patch": hostInfo.Info().OS.Patch, + }, nil +} + +func nativeArch() string { + var processMachine, nativeMachine uint16 + + var kernel32 = syscall.NewLazyDLL("kernel32.dll") + var isWow64Process2 = kernel32.NewProc("IsWow64Process2") + + var currentProcessHandle, _ = syscall.GetCurrentProcess() + isWow64Process2.Call(uintptr(currentProcessHandle), uintptr(unsafe.Pointer(&processMachine)), uintptr(unsafe.Pointer(&nativeMachine))) + + var nativeMachineStr string + + switch nativeMachine { + case 0x8664: + nativeMachineStr = "amd64" + break + case 0xAA64: + nativeMachineStr = "arm64" + break + default: + // other unknown or unsupported by Elastic Defend architectures + nativeMachineStr = fmt.Sprintf("0x%x", nativeMachine) + } + + return nativeMachineStr +} diff --git a/specs/endpoint-security.spec.yml b/specs/endpoint-security.spec.yml index 4f3a2ff7e42..6a5b3d831e2 100644 --- a/specs/endpoint-security.spec.yml +++ b/specs/endpoint-security.spec.yml @@ -20,6 +20,8 @@ inputs: message: "Elastic Defend requires Elastic Agent be running as root" - condition: ${install.in_default} == false message: "Elastic Defend requires Elastic Agent be installed at the default installation path" + - condition: ${runtime.nativeArch} != 'amd64' and ${runtime.osinfo.type} == 'windows' + message: "Elastic Defend cannot be installed on Windows running on non-AMD64 CPU" service: &service cport: 6788 log: From 030962e5c55a7be66dc1a2d4feb052f0470e76e8 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Sat, 27 Jan 2024 03:47:07 -0500 Subject: [PATCH 02/27] fix lint --- internal/pkg/agent/application/info/inject_config_windows.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/pkg/agent/application/info/inject_config_windows.go b/internal/pkg/agent/application/info/inject_config_windows.go index 0f44b0cc8f4..d863f68cab8 100644 --- a/internal/pkg/agent/application/info/inject_config_windows.go +++ b/internal/pkg/agent/application/info/inject_config_windows.go @@ -69,17 +69,15 @@ func nativeArch() string { var isWow64Process2 = kernel32.NewProc("IsWow64Process2") var currentProcessHandle, _ = syscall.GetCurrentProcess() - isWow64Process2.Call(uintptr(currentProcessHandle), uintptr(unsafe.Pointer(&processMachine)), uintptr(unsafe.Pointer(&nativeMachine))) + _, _, _ = isWow64Process2.Call(uintptr(currentProcessHandle), uintptr(unsafe.Pointer(&processMachine)), uintptr(unsafe.Pointer(&nativeMachine))) var nativeMachineStr string switch nativeMachine { case 0x8664: nativeMachineStr = "amd64" - break case 0xAA64: nativeMachineStr = "arm64" - break default: // other unknown or unsupported by Elastic Defend architectures nativeMachineStr = fmt.Sprintf("0x%x", nativeMachine) From aed78cf809437052317b1de29d64404f0ab83633 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Sat, 27 Jan 2024 04:04:55 -0500 Subject: [PATCH 03/27] correct platform condition --- internal/pkg/agent/application/info/inject_config_unix.go | 2 +- internal/pkg/agent/application/info/inject_config_windows.go | 2 +- specs/endpoint-security.spec.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/pkg/agent/application/info/inject_config_unix.go b/internal/pkg/agent/application/info/inject_config_unix.go index 06b6d72c2c0..7b232cfb3e4 100644 --- a/internal/pkg/agent/application/info/inject_config_unix.go +++ b/internal/pkg/agent/application/info/inject_config_unix.go @@ -49,7 +49,7 @@ func agentGlobalConfig() (map[string]interface{}, error) { }, "runtime.os": runtime.GOOS, "runtime.arch": runtime.GOARCH, - "runtime.nativeArch": "", // Unknown native CPU architecture + "runtime.native_arch": "", // Unknown native CPU architecture "runtime.osinfo.type": hostInfo.Info().OS.Type, "runtime.osinfo.family": hostInfo.Info().OS.Family, "runtime.osinfo.version": hostInfo.Info().OS.Version, diff --git a/internal/pkg/agent/application/info/inject_config_windows.go b/internal/pkg/agent/application/info/inject_config_windows.go index d863f68cab8..25a137b1546 100644 --- a/internal/pkg/agent/application/info/inject_config_windows.go +++ b/internal/pkg/agent/application/info/inject_config_windows.go @@ -52,7 +52,7 @@ func agentGlobalConfig() (map[string]interface{}, error) { }, "runtime.os": runtime.GOOS, "runtime.arch": runtime.GOARCH, - "runtime.nativeArch": nativeArch(), + "runtime.native_arch": nativeArch(), "runtime.osinfo.type": hostInfo.Info().OS.Type, "runtime.osinfo.family": hostInfo.Info().OS.Family, "runtime.osinfo.version": hostInfo.Info().OS.Version, diff --git a/specs/endpoint-security.spec.yml b/specs/endpoint-security.spec.yml index 6a5b3d831e2..1f9f7cca787 100644 --- a/specs/endpoint-security.spec.yml +++ b/specs/endpoint-security.spec.yml @@ -20,8 +20,6 @@ inputs: message: "Elastic Defend requires Elastic Agent be running as root" - condition: ${install.in_default} == false message: "Elastic Defend requires Elastic Agent be installed at the default installation path" - - condition: ${runtime.nativeArch} != 'amd64' and ${runtime.osinfo.type} == 'windows' - message: "Elastic Defend cannot be installed on Windows running on non-AMD64 CPU" service: &service cport: 6788 log: @@ -79,6 +77,8 @@ inputs: message: "Elastic Defend requires Elastic Agent be running as Administrator or SYSTEM" - condition: ${install.in_default} == false message: "Elastic Defend requires Elastic Agent be installed at the default installation path" + - condition: ${runtime.native_arch} != 'amd64' + message: "Elastic Defend cannot be installed on Windows running on non-AMD64 CPU" service: cport: 6788 log: From 7e5b325fb178c1b6b1bb309f4316831db6c50337 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:34:46 -0500 Subject: [PATCH 04/27] machine architecture constants from MSDN --- .../pkg/agent/application/info/inject_config_windows.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/pkg/agent/application/info/inject_config_windows.go b/internal/pkg/agent/application/info/inject_config_windows.go index 25a137b1546..f264d9ea527 100644 --- a/internal/pkg/agent/application/info/inject_config_windows.go +++ b/internal/pkg/agent/application/info/inject_config_windows.go @@ -73,10 +73,15 @@ func nativeArch() string { var nativeMachineStr string + const ( + IMAGE_FILE_MACHINE_AMD64 = 0x8664, + IMAGE_FILE_MACHINE_ARM64 = 0xAA64, + ) + switch nativeMachine { - case 0x8664: + case IMAGE_FILE_MACHINE_AMD64: nativeMachineStr = "amd64" - case 0xAA64: + case IMAGE_FILE_MACHINE_ARM64: nativeMachineStr = "arm64" default: // other unknown or unsupported by Elastic Defend architectures From 287a839eb73ec475d49bb34de8f172e3c5afed0b Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:01:10 -0500 Subject: [PATCH 05/27] fix const declaration --- internal/pkg/agent/application/info/inject_config_windows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/pkg/agent/application/info/inject_config_windows.go b/internal/pkg/agent/application/info/inject_config_windows.go index f264d9ea527..1ebbdb2d2ca 100644 --- a/internal/pkg/agent/application/info/inject_config_windows.go +++ b/internal/pkg/agent/application/info/inject_config_windows.go @@ -74,8 +74,8 @@ func nativeArch() string { var nativeMachineStr string const ( - IMAGE_FILE_MACHINE_AMD64 = 0x8664, - IMAGE_FILE_MACHINE_ARM64 = 0xAA64, + IMAGE_FILE_MACHINE_AMD64 = 0x8664 + IMAGE_FILE_MACHINE_ARM64 = 0xAA64 ) switch nativeMachine { From 12ddaf5f9b288efbf704a18539bdfd425f589664 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 30 Jan 2024 17:00:57 -0500 Subject: [PATCH 06/27] refactoring; test fix --- docs/component-specs.md | 1 + ...inject_config_unix.go => inject_config.go} | 4 +- .../application/info/inject_config_windows.go | 92 ------------------- .../pkg/agent/application/info/svc_unix.go | 5 + .../pkg/agent/application/info/svc_windows.go | 32 +++++++ pkg/component/component_test.go | 13 +-- 6 files changed, 46 insertions(+), 101 deletions(-) rename internal/pkg/agent/application/info/{inject_config_unix.go => inject_config.go} (95%) delete mode 100644 internal/pkg/agent/application/info/inject_config_windows.go diff --git a/docs/component-specs.md b/docs/component-specs.md index 5379bda30cd..47c5b094db4 100644 --- a/docs/component-specs.md +++ b/docs/component-specs.md @@ -87,6 +87,7 @@ The variables that can be accessed by a condition are: - `runtime.os`: the operating system, either `"windows"`, `"darwin"`, `"linux"`, or `"container"`. - `runtime.arch`: the CPU architecture, either `"amd64"` or `"arm64"`. +- `runtime.native_arch`: the machine CPU architecture, either `"amd64"` or `"arm64"`. - `runtime.platform`: a string combining the OS and architecture, e.g. `"windows/amd64"`, `"darwin/arm64"`. - `runtime.family`: OS family, e.g. `"debian"`, `"redhat"`, `"windows"`, `"darwin"` - `runtime.major`, `runtime.minor`: the operating system version. Note that these are strings not integers, so they must be converted in order to use numeric comparison. For example to check if the OS major version is at most 12, use `number(runtime.major) <= 12`. diff --git a/internal/pkg/agent/application/info/inject_config_unix.go b/internal/pkg/agent/application/info/inject_config.go similarity index 95% rename from internal/pkg/agent/application/info/inject_config_unix.go rename to internal/pkg/agent/application/info/inject_config.go index 7b232cfb3e4..2baeec35808 100644 --- a/internal/pkg/agent/application/info/inject_config_unix.go +++ b/internal/pkg/agent/application/info/inject_config.go @@ -2,8 +2,6 @@ // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. -//go:build !windows - package info import ( @@ -49,7 +47,7 @@ func agentGlobalConfig() (map[string]interface{}, error) { }, "runtime.os": runtime.GOOS, "runtime.arch": runtime.GOARCH, - "runtime.native_arch": "", // Unknown native CPU architecture + "runtime.native_arch": nativeArchitecture(), "runtime.osinfo.type": hostInfo.Info().OS.Type, "runtime.osinfo.family": hostInfo.Info().OS.Family, "runtime.osinfo.version": hostInfo.Info().OS.Version, diff --git a/internal/pkg/agent/application/info/inject_config_windows.go b/internal/pkg/agent/application/info/inject_config_windows.go deleted file mode 100644 index 1ebbdb2d2ca..00000000000 --- a/internal/pkg/agent/application/info/inject_config_windows.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -// or more contributor license agreements. Licensed under the Elastic License; -// you may not use this file except in compliance with the Elastic License. - -//go:build windows - -package info - -import ( - "fmt" - "runtime" - "syscall" - "unsafe" - - "github.com/elastic/elastic-agent/internal/pkg/agent/application/paths" - "github.com/elastic/elastic-agent/internal/pkg/agent/errors" - "github.com/elastic/elastic-agent/internal/pkg/config" - "github.com/elastic/go-sysinfo" -) - -// InjectAgentConfig injects config to a provided configuration. -func InjectAgentConfig(c *config.Config) error { - globalConfig, err := agentGlobalConfig() - if err != nil { - return err - } - - if err := c.Merge(globalConfig); err != nil { - return errors.New("failed to inject agent global config", err, errors.TypeConfig) - } - - return nil -} - -// agentGlobalConfig gets global config used for resolution of variables inside configuration -// such as ${path.data}. -func agentGlobalConfig() (map[string]interface{}, error) { - hostInfo, err := sysinfo.Host() - if err != nil { - return nil, err - } - - return map[string]interface{}{ - "path": map[string]interface{}{ - "data": paths.Data(), - "config": paths.Config(), - "home": paths.Home(), - "logs": paths.Logs(), - }, - "host": map[string]interface{}{ - "id": hostInfo.Info().UniqueID, - }, - "runtime.os": runtime.GOOS, - "runtime.arch": runtime.GOARCH, - "runtime.native_arch": nativeArch(), - "runtime.osinfo.type": hostInfo.Info().OS.Type, - "runtime.osinfo.family": hostInfo.Info().OS.Family, - "runtime.osinfo.version": hostInfo.Info().OS.Version, - "runtime.osinfo.major": hostInfo.Info().OS.Major, - "runtime.osinfo.minor": hostInfo.Info().OS.Minor, - "runtime.osinfo.patch": hostInfo.Info().OS.Patch, - }, nil -} - -func nativeArch() string { - var processMachine, nativeMachine uint16 - - var kernel32 = syscall.NewLazyDLL("kernel32.dll") - var isWow64Process2 = kernel32.NewProc("IsWow64Process2") - - var currentProcessHandle, _ = syscall.GetCurrentProcess() - _, _, _ = isWow64Process2.Call(uintptr(currentProcessHandle), uintptr(unsafe.Pointer(&processMachine)), uintptr(unsafe.Pointer(&nativeMachine))) - - var nativeMachineStr string - - const ( - IMAGE_FILE_MACHINE_AMD64 = 0x8664 - IMAGE_FILE_MACHINE_ARM64 = 0xAA64 - ) - - switch nativeMachine { - case IMAGE_FILE_MACHINE_AMD64: - nativeMachineStr = "amd64" - case IMAGE_FILE_MACHINE_ARM64: - nativeMachineStr = "arm64" - default: - // other unknown or unsupported by Elastic Defend architectures - nativeMachineStr = fmt.Sprintf("0x%x", nativeMachine) - } - - return nativeMachineStr -} diff --git a/internal/pkg/agent/application/info/svc_unix.go b/internal/pkg/agent/application/info/svc_unix.go index 0d4348d31f8..3f14d016487 100644 --- a/internal/pkg/agent/application/info/svc_unix.go +++ b/internal/pkg/agent/application/info/svc_unix.go @@ -13,3 +13,8 @@ import "os" func RunningUnderSupervisor() bool { return os.Getppid() == 1 } + +func nativeArchitecture() string { + // unknown native architecture + return "" +} diff --git a/internal/pkg/agent/application/info/svc_windows.go b/internal/pkg/agent/application/info/svc_windows.go index 91c26656581..2a899c5c95e 100644 --- a/internal/pkg/agent/application/info/svc_windows.go +++ b/internal/pkg/agent/application/info/svc_windows.go @@ -7,6 +7,8 @@ package info import ( + "fmt" + "golang.org/x/sys/windows" ) @@ -51,3 +53,33 @@ func allocSid(subAuth0 uint32) (*windows.SID, error) { } return sid, nil } + +func nativeArchitecture() string { + var nativeMachineStr string + var processMachine, nativeMachine uint16 + var currentProcessHandle = windows.CurrentProcess() + defer windows.CloseHandle(currentProcessHandle) + + err := windows.IsWow64Process2(currentProcessHandle, &processMachine, &nativeMachine) + if err != nil { + return "", err + } + + // https://learn.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants + const ( + IMAGE_FILE_MACHINE_AMD64 = 0x8664 + IMAGE_FILE_MACHINE_ARM64 = 0xAA64 + ) + + switch nativeMachine { + case IMAGE_FILE_MACHINE_AMD64: + nativeMachineStr = "amd64" + case IMAGE_FILE_MACHINE_ARM64: + nativeMachineStr = "arm64" + default: + // other unknown or unsupported by Elastic Defend architectures + nativeMachineStr = fmt.Sprintf("0x%x", nativeMachine) + } + + return nativeMachineStr +} diff --git a/pkg/component/component_test.go b/pkg/component/component_test.go index b6b49546fce..368145e3909 100644 --- a/pkg/component/component_test.go +++ b/pkg/component/component_test.go @@ -1980,12 +1980,13 @@ func TestPreventionsAreValid(t *testing.T) { "in_default": true, }, "runtime": map[string]interface{}{ - "platform": "platform", - "os": "os", - "arch": "arch", - "family": "family", - "major": "major", - "minor": "minor", + "platform": "platform", + "os": "os", + "arch": "arch", + "native_arch": "native_arch", + "family": "family", + "major": "major", + "minor": "minor", }, "user": map[string]interface{}{ "root": false, From 69c326d6931c5500f86a5a5465257cae3dec2b0f Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 30 Jan 2024 17:13:23 -0500 Subject: [PATCH 07/27] return fix --- internal/pkg/agent/application/info/svc_windows.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/pkg/agent/application/info/svc_windows.go b/internal/pkg/agent/application/info/svc_windows.go index 2a899c5c95e..0014a8eec39 100644 --- a/internal/pkg/agent/application/info/svc_windows.go +++ b/internal/pkg/agent/application/info/svc_windows.go @@ -62,7 +62,8 @@ func nativeArchitecture() string { err := windows.IsWow64Process2(currentProcessHandle, &processMachine, &nativeMachine) if err != nil { - return "", err + // unknown native architecture + return "" } // https://learn.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants @@ -77,7 +78,7 @@ func nativeArchitecture() string { case IMAGE_FILE_MACHINE_ARM64: nativeMachineStr = "arm64" default: - // other unknown or unsupported by Elastic Defend architectures + // other unknown or unsupported by Elastic architectures nativeMachineStr = fmt.Sprintf("0x%x", nativeMachine) } From d44171995e3d3783165a67c395a35bc24762103f Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 30 Jan 2024 17:31:26 -0500 Subject: [PATCH 08/27] refactoring --- internal/pkg/agent/application/info/svc_windows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/pkg/agent/application/info/svc_windows.go b/internal/pkg/agent/application/info/svc_windows.go index 0014a8eec39..225c4633768 100644 --- a/internal/pkg/agent/application/info/svc_windows.go +++ b/internal/pkg/agent/application/info/svc_windows.go @@ -57,8 +57,8 @@ func allocSid(subAuth0 uint32) (*windows.SID, error) { func nativeArchitecture() string { var nativeMachineStr string var processMachine, nativeMachine uint16 - var currentProcessHandle = windows.CurrentProcess() - defer windows.CloseHandle(currentProcessHandle) + // the pseudo handle doesn't need to be closed, err is always nil + var currentProcessHandle, _ = windows.GetCurrentProcess() err := windows.IsWow64Process2(currentProcessHandle, &processMachine, &nativeMachine) if err != nil { From e711ac33c230fc548a98223e82f4e28eee78fc88 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 30 Jan 2024 17:46:42 -0500 Subject: [PATCH 09/27] refactoring --- internal/pkg/agent/application/info/svc_windows.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/pkg/agent/application/info/svc_windows.go b/internal/pkg/agent/application/info/svc_windows.go index 225c4633768..4d2cae518a7 100644 --- a/internal/pkg/agent/application/info/svc_windows.go +++ b/internal/pkg/agent/application/info/svc_windows.go @@ -55,10 +55,9 @@ func allocSid(subAuth0 uint32) (*windows.SID, error) { } func nativeArchitecture() string { - var nativeMachineStr string var processMachine, nativeMachine uint16 - // the pseudo handle doesn't need to be closed, err is always nil - var currentProcessHandle, _ = windows.GetCurrentProcess() + // the pseudo handle doesn't need to be closed + var currentProcessHandle = windows.CurrentProcess() err := windows.IsWow64Process2(currentProcessHandle, &processMachine, &nativeMachine) if err != nil { @@ -72,6 +71,8 @@ func nativeArchitecture() string { IMAGE_FILE_MACHINE_ARM64 = 0xAA64 ) + var nativeMachineStr string + switch nativeMachine { case IMAGE_FILE_MACHINE_AMD64: nativeMachineStr = "amd64" From 6cd6a747275b33218471025787c4127e90a09101 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:17:05 +0100 Subject: [PATCH 10/27] fix lint errors on legacy code --- internal/pkg/agent/application/info/svc_windows.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/pkg/agent/application/info/svc_windows.go b/internal/pkg/agent/application/info/svc_windows.go index 4d2cae518a7..217bdad6c1e 100644 --- a/internal/pkg/agent/application/info/svc_windows.go +++ b/internal/pkg/agent/application/info/svc_windows.go @@ -23,9 +23,10 @@ func RunningUnderSupervisor() bool { if err != nil { return false } - defer windows.FreeSid(serviceSid) + defer func() { _ = windows.FreeSid(serviceSid) }() - t, err := windows.OpenCurrentProcessToken() + var t windows.Token + err = windows.OpenProcessToken(windows.CurrentProcess(), windows.TOKEN_QUERY|windows.TOKEN_QUERY_SOURCE, &t) if err != nil { return false } From 98e1366e741be9623b356fde375f865dbb371512 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:42:40 +0100 Subject: [PATCH 11/27] remove unnecessary access query mask --- internal/pkg/agent/application/info/svc_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/pkg/agent/application/info/svc_windows.go b/internal/pkg/agent/application/info/svc_windows.go index 217bdad6c1e..87589e099a9 100644 --- a/internal/pkg/agent/application/info/svc_windows.go +++ b/internal/pkg/agent/application/info/svc_windows.go @@ -26,7 +26,7 @@ func RunningUnderSupervisor() bool { defer func() { _ = windows.FreeSid(serviceSid) }() var t windows.Token - err = windows.OpenProcessToken(windows.CurrentProcess(), windows.TOKEN_QUERY|windows.TOKEN_QUERY_SOURCE, &t) + err = windows.OpenProcessToken(windows.CurrentProcess(), windows.TOKEN_QUERY, &t) if err != nil { return false } From 618952bfec4cb5c21876cbe30f879529fbfe6af9 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Mon, 12 Feb 2024 12:22:18 +0100 Subject: [PATCH 12/27] use updated go-sysinfo --- go.mod | 2 +- go.sum | 2 + .../agent/application/info/inject_config.go | 2 +- .../pkg/agent/application/info/svc_unix.go | 6 +-- .../pkg/agent/application/info/svc_windows.go | 39 +------------------ 5 files changed, 7 insertions(+), 44 deletions(-) diff --git a/go.mod b/go.mod index 9c280e565f2..8ac89f441d4 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/elastic/elastic-transport-go/v8 v8.3.0 github.com/elastic/go-elasticsearch/v8 v8.10.1 github.com/elastic/go-licenser v0.4.1 - github.com/elastic/go-sysinfo v1.11.2 + github.com/elastic/go-sysinfo v1.12.1-0.20240212102512-80edf3d8ca8f github.com/elastic/go-ucfg v0.8.6 github.com/fatih/color v1.15.0 github.com/fsnotify/fsnotify v1.7.0 diff --git a/go.sum b/go.sum index e2e98302985..633058a0380 100644 --- a/go.sum +++ b/go.sum @@ -822,6 +822,8 @@ github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6 github.com/elastic/go-sysinfo v1.7.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= github.com/elastic/go-sysinfo v1.11.2 h1:mcm4OSYVMyws6+n2HIVMGkln5HOpo5Ie1ZmbbNn0jg4= github.com/elastic/go-sysinfo v1.11.2/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= +github.com/elastic/go-sysinfo v1.12.1-0.20240212102512-80edf3d8ca8f h1:r+qvry9+v7JYmqfWV1ZVOO+5FN7b4cS5MLn6FWXw3VA= +github.com/elastic/go-sysinfo v1.12.1-0.20240212102512-80edf3d8ca8f/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= github.com/elastic/go-ucfg v0.8.6 h1:stUeyh2goTgGX+/wb9gzKvTv0YB0231LTpKUgCKj4U0= github.com/elastic/go-ucfg v0.8.6/go.mod h1:4E8mPOLSUV9hQ7sgLEJ4bvt0KhMuDJa8joDT2QGAEKA= github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU= diff --git a/internal/pkg/agent/application/info/inject_config.go b/internal/pkg/agent/application/info/inject_config.go index 2baeec35808..84e5e93e73e 100644 --- a/internal/pkg/agent/application/info/inject_config.go +++ b/internal/pkg/agent/application/info/inject_config.go @@ -47,7 +47,7 @@ func agentGlobalConfig() (map[string]interface{}, error) { }, "runtime.os": runtime.GOOS, "runtime.arch": runtime.GOARCH, - "runtime.native_arch": nativeArchitecture(), + "runtime.native_arch": hostInfo.Info().NativeArchitecture, "runtime.osinfo.type": hostInfo.Info().OS.Type, "runtime.osinfo.family": hostInfo.Info().OS.Family, "runtime.osinfo.version": hostInfo.Info().OS.Version, diff --git a/internal/pkg/agent/application/info/svc_unix.go b/internal/pkg/agent/application/info/svc_unix.go index 3f14d016487..d5c407d17d7 100644 --- a/internal/pkg/agent/application/info/svc_unix.go +++ b/internal/pkg/agent/application/info/svc_unix.go @@ -3,6 +3,7 @@ // you may not use this file except in compliance with the Elastic License. //go:build !windows +// +build !windows package info @@ -13,8 +14,3 @@ import "os" func RunningUnderSupervisor() bool { return os.Getppid() == 1 } - -func nativeArchitecture() string { - // unknown native architecture - return "" -} diff --git a/internal/pkg/agent/application/info/svc_windows.go b/internal/pkg/agent/application/info/svc_windows.go index 87589e099a9..91c26656581 100644 --- a/internal/pkg/agent/application/info/svc_windows.go +++ b/internal/pkg/agent/application/info/svc_windows.go @@ -7,8 +7,6 @@ package info import ( - "fmt" - "golang.org/x/sys/windows" ) @@ -23,10 +21,9 @@ func RunningUnderSupervisor() bool { if err != nil { return false } - defer func() { _ = windows.FreeSid(serviceSid) }() + defer windows.FreeSid(serviceSid) - var t windows.Token - err = windows.OpenProcessToken(windows.CurrentProcess(), windows.TOKEN_QUERY, &t) + t, err := windows.OpenCurrentProcessToken() if err != nil { return false } @@ -54,35 +51,3 @@ func allocSid(subAuth0 uint32) (*windows.SID, error) { } return sid, nil } - -func nativeArchitecture() string { - var processMachine, nativeMachine uint16 - // the pseudo handle doesn't need to be closed - var currentProcessHandle = windows.CurrentProcess() - - err := windows.IsWow64Process2(currentProcessHandle, &processMachine, &nativeMachine) - if err != nil { - // unknown native architecture - return "" - } - - // https://learn.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants - const ( - IMAGE_FILE_MACHINE_AMD64 = 0x8664 - IMAGE_FILE_MACHINE_ARM64 = 0xAA64 - ) - - var nativeMachineStr string - - switch nativeMachine { - case IMAGE_FILE_MACHINE_AMD64: - nativeMachineStr = "amd64" - case IMAGE_FILE_MACHINE_ARM64: - nativeMachineStr = "arm64" - default: - // other unknown or unsupported by Elastic architectures - nativeMachineStr = fmt.Sprintf("0x%x", nativeMachine) - } - - return nativeMachineStr -} From 69ad4a030da4e95fa8662a31ce9231428cd441d6 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Mon, 12 Feb 2024 12:58:54 +0100 Subject: [PATCH 13/27] fix unit test --- pkg/component/component.go | 13 +++++++------ pkg/component/platforms.go | 14 ++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pkg/component/component.go b/pkg/component/component.go index d9100a6dd98..455f8ad0e48 100644 --- a/pkg/component/component.go +++ b/pkg/component/component.go @@ -867,12 +867,13 @@ func varsForPlatform(platform PlatformDetail) (*transpiler.Vars, error) { "in_default": paths.ArePathsEqual(paths.Top(), paths.InstallPath(paths.DefaultBasePath)) || pkgmgr.InstalledViaExternalPkgMgr(), }, "runtime": map[string]interface{}{ - "platform": platform.String(), - "os": platform.OS, - "arch": platform.Arch, - "family": platform.Family, - "major": platform.Major, - "minor": platform.Minor, + "platform": platform.String(), + "os": platform.OS, + "arch": platform.Arch, + "native_arch": platform.NativeArch, + "family": platform.Family, + "major": platform.Major, + "minor": platform.Minor, }, "user": map[string]interface{}{ "root": hasRoot, diff --git a/pkg/component/platforms.go b/pkg/component/platforms.go index 552adde716c..45a3012dbcf 100644 --- a/pkg/component/platforms.go +++ b/pkg/component/platforms.go @@ -103,9 +103,10 @@ func (p Platforms) Exists(platform string) bool { type PlatformDetail struct { Platform - Family string - Major string - Minor string + NativeArch string + Family string + Major string + Minor string } // PlatformModifier can modify the platform details before the runtime specifications are loaded. @@ -124,9 +125,10 @@ func LoadPlatformDetail(modifiers ...PlatformModifier) (PlatformDetail, error) { Arch: goruntime.GOARCH, GOOS: goruntime.GOOS, }, - Family: os.Family, - Major: strconv.Itoa(os.Major), - Minor: strconv.Itoa(os.Minor), + NativeArch: info.Info().NativeArchitecture, + Family: os.Family, + Major: strconv.Itoa(os.Major), + Minor: strconv.Itoa(os.Minor), } for _, modifier := range modifiers { detail = modifier(detail) From 0768c59ad816312a36d4b8196f05b34f707c52fa Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Mon, 12 Feb 2024 13:05:07 +0100 Subject: [PATCH 14/27] revert accidental change --- internal/pkg/agent/application/info/svc_unix.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/pkg/agent/application/info/svc_unix.go b/internal/pkg/agent/application/info/svc_unix.go index d5c407d17d7..0d4348d31f8 100644 --- a/internal/pkg/agent/application/info/svc_unix.go +++ b/internal/pkg/agent/application/info/svc_unix.go @@ -3,7 +3,6 @@ // you may not use this file except in compliance with the Elastic License. //go:build !windows -// +build !windows package info From 9e4febb48049274afa0f5f565cb0c9c00819d8c8 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Mon, 12 Feb 2024 13:33:47 +0100 Subject: [PATCH 15/27] update go-sysinfo to official release --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 8ac89f441d4..19a5ccf44bc 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/elastic/elastic-transport-go/v8 v8.3.0 github.com/elastic/go-elasticsearch/v8 v8.10.1 github.com/elastic/go-licenser v0.4.1 - github.com/elastic/go-sysinfo v1.12.1-0.20240212102512-80edf3d8ca8f + github.com/elastic/go-sysinfo v1.13.0 github.com/elastic/go-ucfg v0.8.6 github.com/fatih/color v1.15.0 github.com/fsnotify/fsnotify v1.7.0 diff --git a/go.sum b/go.sum index 633058a0380..e9bf2bf34d7 100644 --- a/go.sum +++ b/go.sum @@ -824,6 +824,8 @@ github.com/elastic/go-sysinfo v1.11.2 h1:mcm4OSYVMyws6+n2HIVMGkln5HOpo5Ie1ZmbbNn github.com/elastic/go-sysinfo v1.11.2/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= github.com/elastic/go-sysinfo v1.12.1-0.20240212102512-80edf3d8ca8f h1:r+qvry9+v7JYmqfWV1ZVOO+5FN7b4cS5MLn6FWXw3VA= github.com/elastic/go-sysinfo v1.12.1-0.20240212102512-80edf3d8ca8f/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= +github.com/elastic/go-sysinfo v1.13.0 h1:dDtII66poplao+ijBBfl7gW4giVA/60lXJJf3/C3zIk= +github.com/elastic/go-sysinfo v1.13.0/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= github.com/elastic/go-ucfg v0.8.6 h1:stUeyh2goTgGX+/wb9gzKvTv0YB0231LTpKUgCKj4U0= github.com/elastic/go-ucfg v0.8.6/go.mod h1:4E8mPOLSUV9hQ7sgLEJ4bvt0KhMuDJa8joDT2QGAEKA= github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU= From f3aca60f547520cdc09270869e7b4a20ea02f24b Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Mon, 12 Feb 2024 18:10:58 +0100 Subject: [PATCH 16/27] go mod tidy --- go.sum | 4 ---- 1 file changed, 4 deletions(-) diff --git a/go.sum b/go.sum index e9bf2bf34d7..73b569f24b0 100644 --- a/go.sum +++ b/go.sum @@ -820,10 +820,6 @@ github.com/elastic/go-structform v0.0.10 h1:oy08o/Ih2hHTkNcRY/1HhaYvIp5z6t8si8gn github.com/elastic/go-structform v0.0.10/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4= github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= github.com/elastic/go-sysinfo v1.7.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= -github.com/elastic/go-sysinfo v1.11.2 h1:mcm4OSYVMyws6+n2HIVMGkln5HOpo5Ie1ZmbbNn0jg4= -github.com/elastic/go-sysinfo v1.11.2/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= -github.com/elastic/go-sysinfo v1.12.1-0.20240212102512-80edf3d8ca8f h1:r+qvry9+v7JYmqfWV1ZVOO+5FN7b4cS5MLn6FWXw3VA= -github.com/elastic/go-sysinfo v1.12.1-0.20240212102512-80edf3d8ca8f/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= github.com/elastic/go-sysinfo v1.13.0 h1:dDtII66poplao+ijBBfl7gW4giVA/60lXJJf3/C3zIk= github.com/elastic/go-sysinfo v1.13.0/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= github.com/elastic/go-ucfg v0.8.6 h1:stUeyh2goTgGX+/wb9gzKvTv0YB0231LTpKUgCKj4U0= From c788a5b548bc4ba7666297ed7dda451e09f824b0 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 09:11:43 +0100 Subject: [PATCH 17/27] update go-sysinfo --- NOTICE.txt | 6 +++--- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index 8b931ec6088..0580e031f63 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -2222,11 +2222,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-licenser@v0. -------------------------------------------------------------------------------- Dependency : github.com/elastic/go-sysinfo -Version: v1.11.2 +Version: v1.13.1 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/go-sysinfo@v1.11.2/LICENSE.txt: +Contents of probable licence file $GOMODCACHE/github.com/elastic/go-sysinfo@v1.13.1/LICENSE.txt: Apache License @@ -39227,4 +39227,4 @@ Contents of the file that refers to the licence https://opensource.apple.com/sou 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. \ No newline at end of file + limitations under the License. diff --git a/go.mod b/go.mod index 19a5ccf44bc..6f53f3e2693 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/elastic/elastic-transport-go/v8 v8.3.0 github.com/elastic/go-elasticsearch/v8 v8.10.1 github.com/elastic/go-licenser v0.4.1 - github.com/elastic/go-sysinfo v1.13.0 + github.com/elastic/go-sysinfo v1.13.1 github.com/elastic/go-ucfg v0.8.6 github.com/fatih/color v1.15.0 github.com/fsnotify/fsnotify v1.7.0 diff --git a/go.sum b/go.sum index 73b569f24b0..79d363ec3b8 100644 --- a/go.sum +++ b/go.sum @@ -822,6 +822,8 @@ github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6 github.com/elastic/go-sysinfo v1.7.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= github.com/elastic/go-sysinfo v1.13.0 h1:dDtII66poplao+ijBBfl7gW4giVA/60lXJJf3/C3zIk= github.com/elastic/go-sysinfo v1.13.0/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= +github.com/elastic/go-sysinfo v1.13.1 h1:U5Jlx6c/rLkR72O8wXXXo1abnGlWGJU/wbzNJ2AfQa4= +github.com/elastic/go-sysinfo v1.13.1/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= github.com/elastic/go-ucfg v0.8.6 h1:stUeyh2goTgGX+/wb9gzKvTv0YB0231LTpKUgCKj4U0= github.com/elastic/go-ucfg v0.8.6/go.mod h1:4E8mPOLSUV9hQ7sgLEJ4bvt0KhMuDJa8joDT2QGAEKA= github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU= From 1a30c8a535300e92c17d1cc38fe26739fbbfde64 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 09:15:42 +0100 Subject: [PATCH 18/27] go mod tidy --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 95d313e1e15..84692a724d3 100644 --- a/go.sum +++ b/go.sum @@ -820,8 +820,6 @@ github.com/elastic/go-structform v0.0.10 h1:oy08o/Ih2hHTkNcRY/1HhaYvIp5z6t8si8gn github.com/elastic/go-structform v0.0.10/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4= github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= github.com/elastic/go-sysinfo v1.7.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= -github.com/elastic/go-sysinfo v1.13.0 h1:dDtII66poplao+ijBBfl7gW4giVA/60lXJJf3/C3zIk= -github.com/elastic/go-sysinfo v1.13.0/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= github.com/elastic/go-sysinfo v1.13.1 h1:U5Jlx6c/rLkR72O8wXXXo1abnGlWGJU/wbzNJ2AfQa4= github.com/elastic/go-sysinfo v1.13.1/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= github.com/elastic/go-ucfg v0.8.6 h1:stUeyh2goTgGX+/wb9gzKvTv0YB0231LTpKUgCKj4U0= From 39a4ee9148403518239b271110e60cce30a40c9c Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 10:04:24 +0100 Subject: [PATCH 19/27] hex edit version --- NOTICE.txt | 506 ++++++++++++++++++++++++++--------------------------- 1 file changed, 253 insertions(+), 253 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index a474f77754a..5a0ef7f2fee 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1166,11 +1166,11 @@ SOFTWARE -------------------------------------------------------------------------------- Dependency : github.com/elastic/elastic-agent-libs -Version: v0.7.5 +Version: v0.7.4 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.7.5/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.7.4/LICENSE: Apache License Version 2.0, January 2004 @@ -6139,44 +6139,6 @@ Contents of probable licence file $GOMODCACHE/github.com/spf13/cobra@v1.8.0/LICE of your accepting any such warranty or additional liability. --------------------------------------------------------------------------------- -Dependency : github.com/spf13/pflag -Version: v1.0.5 -Licence type (autodetected): BSD-3-Clause --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/github.com/spf13/pflag@v1.0.5/LICENSE: - -Copyright (c) 2012 Alex Ogier. All rights reserved. -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -------------------------------------------------------------------------------- Dependency : github.com/stretchr/testify Version: v1.8.4 @@ -8361,218 +8323,6 @@ Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/expo limitations under the License. --------------------------------------------------------------------------------- -Dependency : go.opentelemetry.io/collector/featuregate -Version: v1.0.1 -Licence type (autodetected): Apache-2.0 --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/featuregate@v1.0.1/LICENSE: - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -------------------------------------------------------------------------------- Dependency : go.opentelemetry.io/collector/otelcol Version: v0.93.0 @@ -26913,6 +26663,44 @@ Contents of probable licence file $GOMODCACHE/github.com/spf13/afero@v1.9.5/LICE of your accepting any such warranty or additional liability. +-------------------------------------------------------------------------------- +Dependency : github.com/spf13/pflag +Version: v1.0.5 +Licence type (autodetected): BSD-3-Clause +-------------------------------------------------------------------------------- + +Contents of probable licence file $GOMODCACHE/github.com/spf13/pflag@v1.0.5/LICENSE: + +Copyright (c) 2012 Alex Ogier. All rights reserved. +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + -------------------------------------------------------------------------------- Dependency : github.com/stretchr/objx Version: v0.5.0 @@ -31557,6 +31345,218 @@ Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/exte limitations under the License. +-------------------------------------------------------------------------------- +Dependency : go.opentelemetry.io/collector/featuregate +Version: v1.0.1 +Licence type (autodetected): Apache-2.0 +-------------------------------------------------------------------------------- + +Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/featuregate@v1.0.1/LICENSE: + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + + -------------------------------------------------------------------------------- Dependency : go.opentelemetry.io/collector/pdata Version: v1.0.1 @@ -39227,4 +39227,4 @@ Contents of the file that refers to the licence https://opensource.apple.com/sou 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. + limitations under the License. \ No newline at end of file From 93f108630d95ea4477b7c83904ca3623697d17dd Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 10:34:46 +0100 Subject: [PATCH 20/27] Revert "hex edit version" This reverts commit 39a4ee9148403518239b271110e60cce30a40c9c. --- NOTICE.txt | 506 ++++++++++++++++++++++++++--------------------------- 1 file changed, 253 insertions(+), 253 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index 5a0ef7f2fee..a474f77754a 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1166,11 +1166,11 @@ SOFTWARE -------------------------------------------------------------------------------- Dependency : github.com/elastic/elastic-agent-libs -Version: v0.7.4 +Version: v0.7.5 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.7.4/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.7.5/LICENSE: Apache License Version 2.0, January 2004 @@ -6139,6 +6139,44 @@ Contents of probable licence file $GOMODCACHE/github.com/spf13/cobra@v1.8.0/LICE of your accepting any such warranty or additional liability. +-------------------------------------------------------------------------------- +Dependency : github.com/spf13/pflag +Version: v1.0.5 +Licence type (autodetected): BSD-3-Clause +-------------------------------------------------------------------------------- + +Contents of probable licence file $GOMODCACHE/github.com/spf13/pflag@v1.0.5/LICENSE: + +Copyright (c) 2012 Alex Ogier. All rights reserved. +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + -------------------------------------------------------------------------------- Dependency : github.com/stretchr/testify Version: v1.8.4 @@ -8323,6 +8361,218 @@ Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/expo limitations under the License. +-------------------------------------------------------------------------------- +Dependency : go.opentelemetry.io/collector/featuregate +Version: v1.0.1 +Licence type (autodetected): Apache-2.0 +-------------------------------------------------------------------------------- + +Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/featuregate@v1.0.1/LICENSE: + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + + -------------------------------------------------------------------------------- Dependency : go.opentelemetry.io/collector/otelcol Version: v0.93.0 @@ -26663,44 +26913,6 @@ Contents of probable licence file $GOMODCACHE/github.com/spf13/afero@v1.9.5/LICE of your accepting any such warranty or additional liability. --------------------------------------------------------------------------------- -Dependency : github.com/spf13/pflag -Version: v1.0.5 -Licence type (autodetected): BSD-3-Clause --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/github.com/spf13/pflag@v1.0.5/LICENSE: - -Copyright (c) 2012 Alex Ogier. All rights reserved. -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -------------------------------------------------------------------------------- Dependency : github.com/stretchr/objx Version: v0.5.0 @@ -31345,218 +31557,6 @@ Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/exte limitations under the License. --------------------------------------------------------------------------------- -Dependency : go.opentelemetry.io/collector/featuregate -Version: v1.0.1 -Licence type (autodetected): Apache-2.0 --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/featuregate@v1.0.1/LICENSE: - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -------------------------------------------------------------------------------- Dependency : go.opentelemetry.io/collector/pdata Version: v1.0.1 @@ -39227,4 +39227,4 @@ Contents of the file that refers to the licence https://opensource.apple.com/sou 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. \ No newline at end of file + limitations under the License. From 6139af4a57574c3885867ad1a919d2e35ab28b91 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 10:42:32 +0100 Subject: [PATCH 21/27] hex edit --- NOTICE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE.txt b/NOTICE.txt index a474f77754a..dc2315d2268 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -39227,4 +39227,4 @@ Contents of the file that refers to the licence https://opensource.apple.com/sou 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. + limitations under the License. \ No newline at end of file From 5f4b3dd1a53823be524d6dd657bf896aed68d23d Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:26:57 +0100 Subject: [PATCH 22/27] go-sysinfo HostInfo.Architecture and HostInfo.NativeArchitecture use x86_64 instead of amd64 --- docs/component-specs.md | 2 +- specs/endpoint-security.spec.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/component-specs.md b/docs/component-specs.md index 47c5b094db4..c7f4d617a1e 100644 --- a/docs/component-specs.md +++ b/docs/component-specs.md @@ -87,7 +87,7 @@ The variables that can be accessed by a condition are: - `runtime.os`: the operating system, either `"windows"`, `"darwin"`, `"linux"`, or `"container"`. - `runtime.arch`: the CPU architecture, either `"amd64"` or `"arm64"`. -- `runtime.native_arch`: the machine CPU architecture, either `"amd64"` or `"arm64"`. +- `runtime.native_arch`: the machine CPU architecture, either `"x86_64"` or `"arm64"`. - `runtime.platform`: a string combining the OS and architecture, e.g. `"windows/amd64"`, `"darwin/arm64"`. - `runtime.family`: OS family, e.g. `"debian"`, `"redhat"`, `"windows"`, `"darwin"` - `runtime.major`, `runtime.minor`: the operating system version. Note that these are strings not integers, so they must be converted in order to use numeric comparison. For example to check if the OS major version is at most 12, use `number(runtime.major) <= 12`. diff --git a/specs/endpoint-security.spec.yml b/specs/endpoint-security.spec.yml index 1f9f7cca787..635a7852fa0 100644 --- a/specs/endpoint-security.spec.yml +++ b/specs/endpoint-security.spec.yml @@ -77,7 +77,7 @@ inputs: message: "Elastic Defend requires Elastic Agent be running as Administrator or SYSTEM" - condition: ${install.in_default} == false message: "Elastic Defend requires Elastic Agent be installed at the default installation path" - - condition: ${runtime.native_arch} != 'amd64' + - condition: ${runtime.native_arch} != 'x86_64' message: "Elastic Defend cannot be installed on Windows running on non-AMD64 CPU" service: cport: 6788 From eb9dadbc11f6b843d41d1d47b1b84473a0611c68 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:36:48 +0100 Subject: [PATCH 23/27] unify amd64 arch in Agent --- docs/component-specs.md | 2 +- internal/pkg/agent/application/info/inject_config.go | 7 ++++++- pkg/component/platforms.go | 8 +++++++- specs/endpoint-security.spec.yml | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/component-specs.md b/docs/component-specs.md index c7f4d617a1e..47c5b094db4 100644 --- a/docs/component-specs.md +++ b/docs/component-specs.md @@ -87,7 +87,7 @@ The variables that can be accessed by a condition are: - `runtime.os`: the operating system, either `"windows"`, `"darwin"`, `"linux"`, or `"container"`. - `runtime.arch`: the CPU architecture, either `"amd64"` or `"arm64"`. -- `runtime.native_arch`: the machine CPU architecture, either `"x86_64"` or `"arm64"`. +- `runtime.native_arch`: the machine CPU architecture, either `"amd64"` or `"arm64"`. - `runtime.platform`: a string combining the OS and architecture, e.g. `"windows/amd64"`, `"darwin/arm64"`. - `runtime.family`: OS family, e.g. `"debian"`, `"redhat"`, `"windows"`, `"darwin"` - `runtime.major`, `runtime.minor`: the operating system version. Note that these are strings not integers, so they must be converted in order to use numeric comparison. For example to check if the OS major version is at most 12, use `number(runtime.major) <= 12`. diff --git a/internal/pkg/agent/application/info/inject_config.go b/internal/pkg/agent/application/info/inject_config.go index 84e5e93e73e..331617417a4 100644 --- a/internal/pkg/agent/application/info/inject_config.go +++ b/internal/pkg/agent/application/info/inject_config.go @@ -35,6 +35,11 @@ func agentGlobalConfig() (map[string]interface{}, error) { return nil, err } + nativeArch := hostInfo.Info().NativeArchitecture + if "x86_64" == nativeArch { + nativeArch = "amd64" + } + return map[string]interface{}{ "path": map[string]interface{}{ "data": paths.Data(), @@ -47,7 +52,7 @@ func agentGlobalConfig() (map[string]interface{}, error) { }, "runtime.os": runtime.GOOS, "runtime.arch": runtime.GOARCH, - "runtime.native_arch": hostInfo.Info().NativeArchitecture, + "runtime.native_arch": nativeArch, "runtime.osinfo.type": hostInfo.Info().OS.Type, "runtime.osinfo.family": hostInfo.Info().OS.Family, "runtime.osinfo.version": hostInfo.Info().OS.Version, diff --git a/pkg/component/platforms.go b/pkg/component/platforms.go index 45a3012dbcf..2e59f5c2756 100644 --- a/pkg/component/platforms.go +++ b/pkg/component/platforms.go @@ -119,13 +119,19 @@ func LoadPlatformDetail(modifiers ...PlatformModifier) (PlatformDetail, error) { return PlatformDetail{}, err } os := info.Info().OS + nativeArch := info.Info().NativeArchitecture + if "x86_64" == nativeArch { + // go-sysinfo Architecture and NativeArchitecture prefer x64_64 + // but GOARCH prefers amd64 + nativeArch = "amd64" + } detail := PlatformDetail{ Platform: Platform{ OS: goruntime.GOOS, Arch: goruntime.GOARCH, GOOS: goruntime.GOOS, }, - NativeArch: info.Info().NativeArchitecture, + NativeArch: nativeArch, Family: os.Family, Major: strconv.Itoa(os.Major), Minor: strconv.Itoa(os.Minor), diff --git a/specs/endpoint-security.spec.yml b/specs/endpoint-security.spec.yml index 635a7852fa0..1f9f7cca787 100644 --- a/specs/endpoint-security.spec.yml +++ b/specs/endpoint-security.spec.yml @@ -77,7 +77,7 @@ inputs: message: "Elastic Defend requires Elastic Agent be running as Administrator or SYSTEM" - condition: ${install.in_default} == false message: "Elastic Defend requires Elastic Agent be installed at the default installation path" - - condition: ${runtime.native_arch} != 'x86_64' + - condition: ${runtime.native_arch} != 'amd64' message: "Elastic Defend cannot be installed on Windows running on non-AMD64 CPU" service: cport: 6788 From 676a2fbf40ff9f5df854dd5e86093fa969cfda7f Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:48:53 +0100 Subject: [PATCH 24/27] aarch64 to arm64 --- internal/pkg/agent/application/info/inject_config.go | 3 +++ pkg/component/platforms.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/internal/pkg/agent/application/info/inject_config.go b/internal/pkg/agent/application/info/inject_config.go index 331617417a4..a82958be166 100644 --- a/internal/pkg/agent/application/info/inject_config.go +++ b/internal/pkg/agent/application/info/inject_config.go @@ -39,6 +39,9 @@ func agentGlobalConfig() (map[string]interface{}, error) { if "x86_64" == nativeArch { nativeArch = "amd64" } + if "aarch64" == nativeArch { + nativeArch = "arm64" + } return map[string]interface{}{ "path": map[string]interface{}{ diff --git a/pkg/component/platforms.go b/pkg/component/platforms.go index 2e59f5c2756..a44b21d8aaf 100644 --- a/pkg/component/platforms.go +++ b/pkg/component/platforms.go @@ -125,6 +125,11 @@ func LoadPlatformDetail(modifiers ...PlatformModifier) (PlatformDetail, error) { // but GOARCH prefers amd64 nativeArch = "amd64" } + if "aarch64" == nativeArch { + // go-sysinfo Architecture and NativeArchitecture prefer aarch64 + // but GOARCH prefers arm64 + nativeArch = "arm64" + } detail := PlatformDetail{ Platform: Platform{ OS: goruntime.GOOS, From 2364e1353890d9a2e67f063a021d90ed2ea0cc0a Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:58:02 +0100 Subject: [PATCH 25/27] lint fix: don't use Yoda ifs --- internal/pkg/agent/application/info/inject_config.go | 4 ++-- pkg/component/platforms.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/pkg/agent/application/info/inject_config.go b/internal/pkg/agent/application/info/inject_config.go index a82958be166..4bedfed1cf3 100644 --- a/internal/pkg/agent/application/info/inject_config.go +++ b/internal/pkg/agent/application/info/inject_config.go @@ -36,10 +36,10 @@ func agentGlobalConfig() (map[string]interface{}, error) { } nativeArch := hostInfo.Info().NativeArchitecture - if "x86_64" == nativeArch { + if nativeArch == "x86_64" { nativeArch = "amd64" } - if "aarch64" == nativeArch { + if nativeArch == "aarch64" { nativeArch = "arm64" } diff --git a/pkg/component/platforms.go b/pkg/component/platforms.go index a44b21d8aaf..afb232e94db 100644 --- a/pkg/component/platforms.go +++ b/pkg/component/platforms.go @@ -120,12 +120,12 @@ func LoadPlatformDetail(modifiers ...PlatformModifier) (PlatformDetail, error) { } os := info.Info().OS nativeArch := info.Info().NativeArchitecture - if "x86_64" == nativeArch { + if nativeArch == "x86_64" { // go-sysinfo Architecture and NativeArchitecture prefer x64_64 // but GOARCH prefers amd64 nativeArch = "amd64" } - if "aarch64" == nativeArch { + if nativeArch == "aarch64" { // go-sysinfo Architecture and NativeArchitecture prefer aarch64 // but GOARCH prefers arm64 nativeArch = "arm64" From 9a202b38035a23f3bf0a7d4370498f2351177092 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 19:13:13 +0100 Subject: [PATCH 26/27] try to increase test coverage ratio --- .../application/info/inject_config_test.go | 24 +++++++++++++++++++ pkg/component/platforms_test.go | 17 +++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 internal/pkg/agent/application/info/inject_config_test.go create mode 100644 pkg/component/platforms_test.go diff --git a/internal/pkg/agent/application/info/inject_config_test.go b/internal/pkg/agent/application/info/inject_config_test.go new file mode 100644 index 00000000000..4cd3334a697 --- /dev/null +++ b/internal/pkg/agent/application/info/inject_config_test.go @@ -0,0 +1,24 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package info + +import ( + "testing" + + "github.com/elastic/elastic-agent/internal/pkg/config" + "github.com/stretchr/testify/assert" +) + +func TestInjectAgentConfig(t *testing.T) { + c := config.New() + err := InjectAgentConfig(c) + assert.NoError(t, err) +} + +func TestAgentGlobalConfig(t *testing.T) { + c, err := agentGlobalConfig() + assert.NoError(t, err) + assert.NotEmpty(t, c) +} diff --git a/pkg/component/platforms_test.go b/pkg/component/platforms_test.go new file mode 100644 index 00000000000..35052a9474d --- /dev/null +++ b/pkg/component/platforms_test.go @@ -0,0 +1,17 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package component + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestLoadPlatformDetail(t *testing.T) { + platformDetail, err := LoadPlatformDetail() + assert.NoError(t, err) + assert.NotEmpty(t, platformDetail) +} From fc0ee5b48671adc434cc4b54be26b19242f6a3b0 Mon Sep 17 00:00:00 2001 From: Leszek Kubik <39905449+intxgo@users.noreply.github.com> Date: Tue, 13 Feb 2024 19:34:35 +0100 Subject: [PATCH 27/27] fix goimports --- internal/pkg/agent/application/info/inject_config_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/pkg/agent/application/info/inject_config_test.go b/internal/pkg/agent/application/info/inject_config_test.go index 4cd3334a697..1ea96fa5cd4 100644 --- a/internal/pkg/agent/application/info/inject_config_test.go +++ b/internal/pkg/agent/application/info/inject_config_test.go @@ -7,8 +7,9 @@ package info import ( "testing" - "github.com/elastic/elastic-agent/internal/pkg/config" "github.com/stretchr/testify/assert" + + "github.com/elastic/elastic-agent/internal/pkg/config" ) func TestInjectAgentConfig(t *testing.T) {