Skip to content

Commit 8674b2f

Browse files
authored
update elastic-agent-libs to v0.46.1 (#51921)
Improve logging when TLS certificates and keys fail to load preventing it from logging a malformed key when it fails to load. full changelog: elastic/elastic-agent-libs@v0.45.0...v0.46.1=
1 parent 397822f commit 8674b2f

7 files changed

Lines changed: 47 additions & 12 deletions

File tree

NOTICE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10798,11 +10798,11 @@ SOFTWARE
1079810798

1079910799
--------------------------------------------------------------------------------
1080010800
Dependency : github.com/elastic/elastic-agent-libs
10801-
Version: v0.45.0
10801+
Version: v0.46.1
1080210802
Licence type (autodetected): Apache-2.0
1080310803
--------------------------------------------------------------------------------
1080410804

10805-
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.45.0/LICENSE:
10805+
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.46.1/LICENSE:
1080610806

1080710807
Apache License
1080810808
Version 2.0, January 2004
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Kind can be one of:
2+
# - breaking-change: a change to previously-documented behavior
3+
# - deprecation: functionality that is being removed in a later release
4+
# - bug-fix: fixes a problem in a previous version
5+
# - enhancement: extends functionality but does not break or fix existing behavior
6+
# - feature: new functionality
7+
# - known-issue: problems that we are aware of in a given version
8+
# - security: impacts on the security of a product or a user’s deployment.
9+
# - upgrade: important information for someone upgrading from a prior version
10+
# - other: does not fit into any of the other categories
11+
kind: bug-fix
12+
13+
# Change summary; a 80ish characters long description of the change.
14+
summary: update elastic-agent-libs to v0.46.1
15+
16+
# Long description; in case the summary is not enough to describe the change
17+
# this field accommodate a description without length limits.
18+
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
19+
description: Fixed an issue where malformed TLS keys could be printed in the error logs during loading failures.
20+
21+
# Affected component; a word indicating the component this changeset affects.
22+
component: all
23+
24+
# PR URL; optional; the PR number that added the changeset.
25+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
26+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
27+
# Please provide it if you are adding a fragment for a different PR.
28+
pr: https://github.com/elastic/beats/pull/51921
29+
30+
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
31+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
32+
#issue: https://github.com/owner/repo/1234

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ require (
171171
github.com/elastic/bayeux v1.0.5
172172
github.com/elastic/ebpfevents v0.9.0
173173
github.com/elastic/elastic-agent-autodiscover v0.10.3-0.20260423154939-e990715f9426
174-
github.com/elastic/elastic-agent-libs v0.45.0
174+
github.com/elastic/elastic-agent-libs v0.46.1
175175
github.com/elastic/elastic-agent-system-metrics v0.14.4
176176
github.com/elastic/go-elasticsearch/v8 v8.19.0
177177
github.com/elastic/go-freelru v0.16.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ github.com/elastic/elastic-agent-autodiscover v0.10.3-0.20260423154939-e990715f9
381381
github.com/elastic/elastic-agent-autodiscover v0.10.3-0.20260423154939-e990715f9426/go.mod h1:HyjdiEVP/A7iMN0jeac2EoUohpHKAZIFRDQsvPDg2Dw=
382382
github.com/elastic/elastic-agent-client/v7 v7.18.1 h1:WnM53JjaukeysrAuiTyrhDPmFxJG07ZAByc2TrkcKcs=
383383
github.com/elastic/elastic-agent-client/v7 v7.18.1/go.mod h1:uDpSGZ+YCKgqgtkwCA0qjwX0gU/wmixDsVbPjY3GkPs=
384-
github.com/elastic/elastic-agent-libs v0.45.0 h1:ioCrNcd03tJVxrnAdZ19MCmea1SgOO+QeFtt+KvcJC0=
385-
github.com/elastic/elastic-agent-libs v0.45.0/go.mod h1:axkpqDCCzAky6G4D/cklgtZQa3jTNGAMVHVkU0u6YbU=
384+
github.com/elastic/elastic-agent-libs v0.46.1 h1:1dVRKOaGWBxqDQPb/NCtoJHI8Nx3QbJOmr4v6y+UdKQ=
385+
github.com/elastic/elastic-agent-libs v0.46.1/go.mod h1:axkpqDCCzAky6G4D/cklgtZQa3jTNGAMVHVkU0u6YbU=
386386
github.com/elastic/elastic-agent-system-metrics v0.14.4 h1:XGGepNVOxhtfJmanQsgqCAZESIJtyDIFOKErOaVzFEw=
387387
github.com/elastic/elastic-agent-system-metrics v0.14.4/go.mod h1:NyNMrdqMfznb/Zy8EmIAHlJpX6HuRlNW+bBL9UN7WQY=
388388
github.com/elastic/elastic-transport-go/v8 v8.8.0 h1:7k1Ua+qluFr6p1jfJjGDl97ssJS/P7cHNInzfxgBQAo=

x-pack/filebeat/input/o365audit/auth/cert.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ import (
1111

1212
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
1313

14+
"github.com/elastic/elastic-agent-libs/logp"
1415
"github.com/elastic/elastic-agent-libs/transport/tlscommon"
1516
)
1617

1718
// NewProviderFromCertificate returns a TokenProvider that uses certificate-based
1819
// authentication.
19-
func NewProviderFromCertificate(resource, applicationID, tenantID string, conf tlscommon.CertificateConfig) (sptp TokenProvider, err error) {
20-
cert, privKey, err := loadConfigCerts(conf)
20+
func NewProviderFromCertificate(resource, applicationID, tenantID string, conf tlscommon.CertificateConfig, logger *logp.Logger) (sptp TokenProvider, err error) {
21+
cert, privKey, err := loadConfigCerts(conf, logger)
2122
if err != nil {
2223
return nil, fmt.Errorf("failed loading certificates: %w", err)
2324
}
@@ -30,8 +31,8 @@ func NewProviderFromCertificate(resource, applicationID, tenantID string, conf t
3031
return (*credentialTokenProvider)(cred), nil
3132
}
3233

33-
func loadConfigCerts(cfg tlscommon.CertificateConfig) (cert *x509.Certificate, key *rsa.PrivateKey, err error) {
34-
tlsCert, err := tlscommon.LoadCertificate(&cfg)
34+
func loadConfigCerts(cfg tlscommon.CertificateConfig, logger *logp.Logger) (cert *x509.Certificate, key *rsa.PrivateKey, err error) {
35+
tlsCert, err := tlscommon.LoadCertificate(&cfg, logger)
3536
if err != nil {
3637
return nil, nil, fmt.Errorf("error loading X509 certificate from '%s': %w", cfg.Certificate, err)
3738
}

x-pack/filebeat/input/o365audit/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"time"
1212

1313
"github.com/elastic/beats/v7/x-pack/filebeat/input/o365audit/auth"
14+
"github.com/elastic/elastic-agent-libs/logp"
1415
"github.com/elastic/elastic-agent-libs/transport/tlscommon"
1516
)
1617

@@ -186,7 +187,7 @@ func (s *stringList) Unpack(value interface{}) error {
186187
}
187188

188189
// NewTokenProvider returns an auth.TokenProvider for the given tenantID.
189-
func (c *Config) NewTokenProvider(tenantID string) (auth.TokenProvider, error) {
190+
func (c *Config) NewTokenProvider(tenantID string, logger *logp.Logger) (auth.TokenProvider, error) {
190191
if c.ClientSecret != "" {
191192
return auth.NewProviderFromClientSecret(
192193
c.API.AuthenticationEndpoint,
@@ -201,6 +202,7 @@ func (c *Config) NewTokenProvider(tenantID string) (auth.TokenProvider, error) {
201202
c.ApplicationID,
202203
tenantID,
203204
c.CertificateConfig,
205+
logger,
204206
)
205207
}
206208

x-pack/filebeat/input/o365audit/input.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (inp *o365input) Name() string { return pluginName }
9494

9595
func (inp *o365input) Test(src cursor.Source, ctx v2.TestContext) error {
9696
tenantID := src.(*stream).tenantID
97-
auth, err := inp.config.NewTokenProvider(tenantID)
97+
auth, err := inp.config.NewTokenProvider(tenantID, ctx.Logger)
9898
if err != nil {
9999
return err
100100
}
@@ -148,7 +148,7 @@ func (inp *o365input) run(v2ctx v2.Context, stream *stream, cursor cursor.Cursor
148148
log := v2ctx.Logger.With("tenantID", tenantID, "contentType", contentType)
149149
ctx := ctxtool.FromCanceller(v2ctx.Cancelation)
150150

151-
tokenProvider, err := inp.config.NewTokenProvider(stream.tenantID)
151+
tokenProvider, err := inp.config.NewTokenProvider(stream.tenantID, log)
152152
if err != nil {
153153
return err
154154
}

0 commit comments

Comments
 (0)