Skip to content

Commit 265bfbf

Browse files
authored
Add ability to enroll with a specific ID (#4290)
Add ability to enroll and provide the agent id as well as a replace-token to allow an existing agent to be replaced by a new agent that has the same agent id.
1 parent d4f8013 commit 265bfbf

18 files changed

+983
-160
lines changed

NOTICE.txt

+37-37
Original file line numberDiff line numberDiff line change
@@ -5033,6 +5033,43 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
50335033
THE SOFTWARE.
50345034

50355035

5036+
--------------------------------------------------------------------------------
5037+
Dependency : golang.org/x/crypto
5038+
Version: v0.32.0
5039+
Licence type (autodetected): BSD-3-Clause
5040+
--------------------------------------------------------------------------------
5041+
5042+
Contents of probable licence file $GOMODCACHE/golang.org/x/crypto@v0.32.0/LICENSE:
5043+
5044+
Copyright 2009 The Go Authors.
5045+
5046+
Redistribution and use in source and binary forms, with or without
5047+
modification, are permitted provided that the following conditions are
5048+
met:
5049+
5050+
* Redistributions of source code must retain the above copyright
5051+
notice, this list of conditions and the following disclaimer.
5052+
* Redistributions in binary form must reproduce the above
5053+
copyright notice, this list of conditions and the following disclaimer
5054+
in the documentation and/or other materials provided with the
5055+
distribution.
5056+
* Neither the name of Google LLC nor the names of its
5057+
contributors may be used to endorse or promote products derived from
5058+
this software without specific prior written permission.
5059+
5060+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5061+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5062+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
5063+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
5064+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
5065+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
5066+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
5067+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
5068+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5069+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5070+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5071+
5072+
50365073
--------------------------------------------------------------------------------
50375074
Dependency : golang.org/x/sync
50385075
Version: v0.10.0
@@ -20045,43 +20082,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2004520082
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2004620083

2004720084

20048-
--------------------------------------------------------------------------------
20049-
Dependency : golang.org/x/crypto
20050-
Version: v0.32.0
20051-
Licence type (autodetected): BSD-3-Clause
20052-
--------------------------------------------------------------------------------
20053-
20054-
Contents of probable licence file $GOMODCACHE/golang.org/x/crypto@v0.32.0/LICENSE:
20055-
20056-
Copyright 2009 The Go Authors.
20057-
20058-
Redistribution and use in source and binary forms, with or without
20059-
modification, are permitted provided that the following conditions are
20060-
met:
20061-
20062-
* Redistributions of source code must retain the above copyright
20063-
notice, this list of conditions and the following disclaimer.
20064-
* Redistributions in binary form must reproduce the above
20065-
copyright notice, this list of conditions and the following disclaimer
20066-
in the documentation and/or other materials provided with the
20067-
distribution.
20068-
* Neither the name of Google LLC nor the names of its
20069-
contributors may be used to endorse or promote products derived from
20070-
this software without specific prior written permission.
20071-
20072-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20073-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20074-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20075-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20076-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20077-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20078-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20079-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20080-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20081-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20082-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20083-
20084-
2008520085
--------------------------------------------------------------------------------
2008620086
Dependency : golang.org/x/mod
2008720087
Version: v0.20.0
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: feature
12+
13+
# Change summary; a 80ish characters long description of the change.
14+
summary: Add ability for enrollment to take an agent ID
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:
20+
21+
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
22+
component: fleet-server
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/fleet-server/pull/4290
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/elastic/fleet-server/issues/4226

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ require (
3535
go.elastic.co/apm/v2 v2.6.3
3636
go.elastic.co/ecszerolog v0.2.0
3737
go.uber.org/zap v1.27.0
38+
golang.org/x/crypto v0.32.0
3839
golang.org/x/sync v0.10.0
3940
golang.org/x/time v0.5.0
4041
google.golang.org/grpc v1.63.2
@@ -88,7 +89,6 @@ require (
8889
go.opentelemetry.io/otel/metric v1.28.0 // indirect
8990
go.opentelemetry.io/otel/trace v1.28.0 // indirect
9091
go.uber.org/multierr v1.11.0 // indirect
91-
golang.org/x/crypto v0.32.0 // indirect
9292
golang.org/x/mod v0.20.0 // indirect
9393
golang.org/x/net v0.34.0 // indirect
9494
golang.org/x/sys v0.29.0 // indirect

internal/pkg/api/error.go

+9
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ func NewHTTPErrResp(err error) HTTPErrResp {
100100
zerolog.InfoLevel,
101101
},
102102
},
103+
{
104+
ErrAgentNotReplaceable,
105+
HTTPErrResp{
106+
http.StatusForbidden,
107+
"AgentNotReplaceable",
108+
"existing agent cannot be replaced",
109+
zerolog.WarnLevel,
110+
},
111+
},
103112
{
104113
ErrInvalidUserAgent,
105114
HTTPErrResp{

0 commit comments

Comments
 (0)