diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index 75478112e8c..8d25d83aa68 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -30,6 +30,7 @@ - Fix shell wrapper for deb/rpm packaging {pull}23038[23038] - Fixed parsing of npipe URI {pull}22978[22978] - Remove artifacts on transient download errors {pull}23235[23235] +- Support for linux/arm64 {pull}23479[23479] - Skip top level files when unziping archive during upgrade {pull}23456[23456] - Do not take ownership of Endpoint log path {pull}23444[23444] diff --git a/x-pack/elastic-agent/pkg/agent/application/global_config.go b/x-pack/elastic-agent/pkg/agent/application/global_config.go index ae77d4d7a80..92bee739cde 100644 --- a/x-pack/elastic-agent/pkg/agent/application/global_config.go +++ b/x-pack/elastic-agent/pkg/agent/application/global_config.go @@ -5,6 +5,8 @@ package application import ( + "runtime" + "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths" "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/errors" "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/config" @@ -30,5 +32,7 @@ func agentGlobalConfig() map[string]interface{} { "home": paths.Home(), "logs": paths.Logs(), }, + "runtime.os": runtime.GOOS, + "runtime.arch": runtime.GOARCH, } } diff --git a/x-pack/elastic-agent/pkg/agent/program/program.go b/x-pack/elastic-agent/pkg/agent/program/program.go index f3f17d06b9d..87d46bf07a0 100644 --- a/x-pack/elastic-agent/pkg/agent/program/program.go +++ b/x-pack/elastic-agent/pkg/agent/program/program.go @@ -69,6 +69,21 @@ func detectPrograms(agentInfo transpiler.AgentInfo, singleConfig *transpiler.AST programs := make([]Program, 0) for _, spec := range Supported { specificAST := singleConfig.Clone() + if len(spec.Constraints) > 0 { + constraints, err := eql.New(spec.Constraints) + if err != nil { + return nil, err + } + ok, err := constraints.Eval(specificAST) + if err != nil { + return nil, err + } + + if !ok { + continue + } + } + err := spec.Rules.Apply(agentInfo, specificAST) if err != nil { return nil, err diff --git a/x-pack/elastic-agent/pkg/agent/program/program_test.go b/x-pack/elastic-agent/pkg/agent/program/program_test.go index 119574ebb6f..262c3e5cc8c 100644 --- a/x-pack/elastic-agent/pkg/agent/program/program_test.go +++ b/x-pack/elastic-agent/pkg/agent/program/program_test.go @@ -423,6 +423,9 @@ func TestConfiguration(t *testing.T) { "endpoint_unknown_output": { expected: 0, }, + "endpoint_arm": { + expected: 0, + }, } for name, test := range testcases { diff --git a/x-pack/elastic-agent/pkg/agent/program/spec.go b/x-pack/elastic-agent/pkg/agent/program/spec.go index 2ae1d698dba..f7d81b74a7e 100644 --- a/x-pack/elastic-agent/pkg/agent/program/spec.go +++ b/x-pack/elastic-agent/pkg/agent/program/spec.go @@ -39,6 +39,7 @@ type Spec struct { PostInstallSteps *transpiler.StepList `yaml:"post_install"` PreUninstallSteps *transpiler.StepList `yaml:"pre_uninstall"` When string `yaml:"when"` + Constraints string `yaml:"constraints"` } // ReadSpecs reads all the specs that match the provided globbing path. diff --git a/x-pack/elastic-agent/pkg/agent/program/spec_test.go b/x-pack/elastic-agent/pkg/agent/program/spec_test.go index df1fb082f7a..634f0bc70a1 100644 --- a/x-pack/elastic-agent/pkg/agent/program/spec_test.go +++ b/x-pack/elastic-agent/pkg/agent/program/spec_test.go @@ -54,7 +54,8 @@ func TestSerialization(t *testing.T) { PreUninstallSteps: transpiler.NewStepList( transpiler.ExecFile(30, "app", "uninstall", "--force"), ), - When: "1 == 1", + When: "1 == 1", + Constraints: "2 == 2", } yml := `name: hello cmd: hellocmd @@ -118,6 +119,7 @@ pre_uninstall: - --force timeout: 30 when: 1 == 1 +constraints: 2 == 2 ` t.Run("serialization", func(t *testing.T) { b, err := yaml.Marshal(spec) diff --git a/x-pack/elastic-agent/pkg/agent/program/supported.go b/x-pack/elastic-agent/pkg/agent/program/supported.go index 9e615b9c271..626466dd94c 100644 --- a/x-pack/elastic-agent/pkg/agent/program/supported.go +++ b/x-pack/elastic-agent/pkg/agent/program/supported.go @@ -23,7 +23,7 @@ func init() { // spec/heartbeat.yml // spec/metricbeat.yml // spec/packetbeat.yml - unpacked := packer.MustUnpack("eJzMWUl3qz6W3/fH+G+rBxBxuuhzamFIM9khz+QFCe2QZAO2wPwDHqBPf/c+EhiDnbyhXtc7tXKMhYare3/Dzf/8UZVr+h9xmf9btX4/rt//vcn5H//1B8mtGn/dJ6vQ8Jehz2mBOU3KLYGrR9e2TuRVbTHyAEbuIkKeEkOcRtqHvxW03Sewcevg1a1c06sjOEsxCGsMZ8oyDw8R9CoMVzpzPBXLMZ+NVY/YftPXpnqKoP++hLjCMFTc7JS4mWrJz3yy/gHblhKFesscj0dQbe/X85hZeCqxw/Yl2SeuqSQ45w9I8xWahyn5uk/WmrJwzXnt2rgkTsAp10EEzypGz49mNk9cc564js+JHW6ZrTcvmVGSwlCZ87yQv5nzJAbh7CUzlDUy+PUdnBIn5LTdD+O6dawTWQ17qZgdNt3exO9Gi+GZR1pwpMVofXOeLF/v1+3m01XmGCqbl1psh4eXzKgwnBXMTvaeU/fv+Pridf4X92meRHC2c+00pUrN16/Jbg369x2lck3GiW21zOZbCsKU5v7ea3aLP/61S6R1wcp9VtQ3aRTA2Y7aekmKVfIGwi1DXsmc3SIC6u4lMzjJgxMB/MBMtcXQV2nOlfWqTGkRlDi3tuxpn+DrHDW2Q2AWMi3LCLw9uk+R9vKULIitF0gzUman3XXaQUoLVpLtPnEz/TmGXhMhb7ZUwipCvhLD5+Nob0eqBSmz345iniUID9gxjrFIvdf9QTxz5ZznkhThw0s2z5ZAPzFTty4hWSqjdzRfiVDAl+B8xI0+OqPy5zIXz9yFaxpaDGc7orFWzLdqS4osoyGANRFUkiDnFUY+Rf992a/8e1gDWeeW2ZaCwzOVZ7fOH64TgZRHoN7EcCbGV+Rpv1i+Gnxth1sEcEnstz6VjFOEgr3Yyzje9HpnWT8upTlrL2m5fJ1nLA+bGOKZ2z9jNq8x1FVxd8/tfEFtvWWW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fsyH7FAZtSmAnDcFhDdeg3CZMg4o3R6lEADQGBLOZlvjpSjbcCpJYFr4k5EyLwYloW1z7IxwU/JqsYznYYJRdSlILmJTMuZ2w7AuKHOJf9nku7f0Md7xiBsKVAH4qHgNkmAvoB5+eyM7H8QEHYMEtPcREMomUwo32+9QahEblD4NAvzWmu1/cmIThen/nDvx+6faopfbrpdX5gfD4xG1uiGTMErIpYn5i6bu3rmiNwuD/77EgGwdIJ/7Xtc+qsJDkNhqmRdVH2ZnPI1a6BMTGPGVrd7FULjgicS6qtpr2tiykb3dHEYP7UOYY7zDDEEsx+s3G8E+hIYyWz0w3NwwKjdGgyfCDKO1LKHt6XoMcx7Xn3TQH4e0XjL5ri8HOS/pZJdjxR4+vFk7760jVu/rLMqvI+Rj2RijWe9ok37kd3Bu4QQZVPTVcvbCdjrw0Pgd8MnvlVkKppDMJNhLwmuu3R9jky4AQYhOwoVy579vmVmH/EXI7e+xkze9Mn/70GWH5vx/3j32Wib8z//7HhmWoM8e5tbuHCO45zQWoUoTnuuWHgyZ8xT5N5r3fbC7BRv34k6j42UJOzHC75/ksmqjNOg9D7URNVxnS3/shFvdnWNgahMhF6jhBUNWf2rdCjddAt9B2hJ8bcjf2m0JMqtVGtTq3+kNCTjnL59iY/vyP0pmM/FXrsM6EnHRxGnzqpX3MsNwD5mVuh/V2Z/brXDr+I1azr9Od/vfzD8Z/hav5fuBeZ2P/zL/8bAAD//+ql68I=") SupportedMap = make(map[string]Spec) for f, v := range unpacked { diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/endpoint_arm.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/endpoint_arm.yml new file mode 100644 index 00000000000..30b760d9c97 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/endpoint_arm.yml @@ -0,0 +1,115 @@ +revision: 5 +name: Endpoint Host +fleet: + agent: + id: fleet-agent-id + host: + id: host-agent-id + access_api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw + kibana: + protocol: https + host: localhost:5601 + timeout: 30s + +outputs: + default: + type: elasticsearch + hosts: [127.0.0.1:9200, 127.0.0.1:9300] + username: elastic + password: changeme + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + +inputs: +- id: endpoint-id + type: endpoint + name: endpoint-1 + enabled: true + package: + name: endpoint + version: 0.3.0 + data_stream: + namespace: default + artifact_manifest: + schema_version: v22 + manifest_version: v21 + artifacts: + - endpoint-allowlist-windows: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-windows + - endpoint-allowlist-macos: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-macos + - endpoint-allowlist-linux: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-linux + policy: + linux: + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + process: logs-endpoint.events.process-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + process: true + file: true + network: true + windows: + malware: + mode: prevent + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + registry: logs-endpoint.events.registry-default + process: logs-endpoint.events.process-default + driver: logs-endpoint.events.driver-default + library: logs-endpoint.events.library-default + alerts: logs-endpoint.alerts-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + registry: true + process: true + security: true + file: true + dns: false + dll_and_driver_load: false + network: true + mac: + malware: + mode: prevent + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + process: logs-endpoint.events.process-default + alerts: logs-endpoint.alerts-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + process: true + file: true + network: true +runtime: + arch: arm64 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/endpoint_basic.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/endpoint_basic.yml index 9eee9b3a01d..728b4813a4e 100644 --- a/x-pack/elastic-agent/pkg/agent/program/testdata/endpoint_basic.yml +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/endpoint_basic.yml @@ -111,3 +111,5 @@ inputs: process: true file: true network: true +runtime: + arch: x86_64 diff --git a/x-pack/elastic-agent/pkg/artifact/artifact.go b/x-pack/elastic-agent/pkg/artifact/artifact.go index 7f4001e77e0..5f8a099ed6a 100644 --- a/x-pack/elastic-agent/pkg/artifact/artifact.go +++ b/x-pack/elastic-agent/pkg/artifact/artifact.go @@ -13,12 +13,13 @@ import ( ) var packageArchMap = map[string]string{ - "linux-binary-32": "linux-x86.tar.gz", - "linux-binary-64": "linux-x86_64.tar.gz", - "windows-binary-32": "windows-x86.zip", - "windows-binary-64": "windows-x86_64.zip", - "darwin-binary-32": "darwin-x86_64.tar.gz", - "darwin-binary-64": "darwin-x86_64.tar.gz", + "linux-binary-32": "linux-x86.tar.gz", + "linux-binary-64": "linux-x86_64.tar.gz", + "linux-binary-arm64": "linux-arm64.tar.gz", + "windows-binary-32": "windows-x86.zip", + "windows-binary-64": "windows-x86_64.zip", + "darwin-binary-32": "darwin-x86_64.tar.gz", + "darwin-binary-64": "darwin-x86_64.tar.gz", } // GetArtifactName constructs a path to a downloaded artifact diff --git a/x-pack/elastic-agent/pkg/artifact/config.go b/x-pack/elastic-agent/pkg/artifact/config.go index 81ed3f856fc..78a0e62ad8a 100644 --- a/x-pack/elastic-agent/pkg/artifact/config.go +++ b/x-pack/elastic-agent/pkg/artifact/config.go @@ -77,7 +77,9 @@ func (c *Config) Arch() string { } arch := "32" - if strings.Contains(runtime.GOARCH, "64") { + if strings.Contains(runtime.GOARCH, "arm64") { + arch = "arm64" + } else if strings.Contains(runtime.GOARCH, "64") { arch = "64" } diff --git a/x-pack/elastic-agent/pkg/artifact/download/http/elastic_test.go b/x-pack/elastic-agent/pkg/artifact/download/http/elastic_test.go index e2097a9297f..a329b9b2f8e 100644 --- a/x-pack/elastic-agent/pkg/artifact/download/http/elastic_test.go +++ b/x-pack/elastic-agent/pkg/artifact/download/http/elastic_test.go @@ -137,6 +137,7 @@ func getTestCases() []testCase { return []testCase{ {"linux", "32"}, {"linux", "64"}, + {"linux", "arm64"}, {"darwin", "32"}, {"darwin", "64"}, {"windows", "32"}, @@ -164,6 +165,7 @@ func getElasticCoClient() http.Client { fmt.Sprintf("%s-%s-%s", beatSpec.Cmd, version, "i686.rpm"): struct{}{}, fmt.Sprintf("%s-%s-%s", beatSpec.Cmd, version, "x86_64.rpm"): struct{}{}, fmt.Sprintf("%s-%s-%s", beatSpec.Cmd, version, "linux-x86.tar.gz"): struct{}{}, + fmt.Sprintf("%s-%s-%s", beatSpec.Cmd, version, "linux-arm64.tar.gz"): struct{}{}, fmt.Sprintf("%s-%s-%s", beatSpec.Cmd, version, "linux-x86_64.tar.gz"): struct{}{}, fmt.Sprintf("%s-%s-%s", beatSpec.Cmd, version, "windows-x86.zip"): struct{}{}, fmt.Sprintf("%s-%s-%s", beatSpec.Cmd, version, "windows-x86_64.zip"): struct{}{}, diff --git a/x-pack/elastic-agent/spec/endpoint.yml b/x-pack/elastic-agent/spec/endpoint.yml index 1bc5817f5c1..a435c2f9ed4 100644 --- a/x-pack/elastic-agent/spec/endpoint.yml +++ b/x-pack/elastic-agent/spec/endpoint.yml @@ -62,3 +62,4 @@ rules: - revision when: length(${fleet}) > 0 and length(${inputs}) > 0 and hasKey(${output}, 'elasticsearch') +constraints: ${runtime.arch} != 'arm64'