Skip to content

Commit bea8e45

Browse files
Remove references to username/password (#29458)
* Remove references to username/password * restore ouput username/password * Update CHANGELOG
1 parent 9b19aae commit bea8e45

17 files changed

+24
-186
lines changed

x-pack/elastic-agent/CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- Default to port 80 and 443 for Kibana and Fleet Server connections. {pull}25723[25723]
1515
- Remove deprecated/undocumented IncludeCreatorMetadata setting from kubernetes metadata config options {pull}28006[28006]
1616
- The `/processes/<subprocess>` endpoint proxies to the subprocess's monitoring endpoint, instead of querying its `/stats` endpoint {pull}28165[28165]
17+
- Remove username/password for fleet-server authentication. {pull}29458[29458]
1718

1819
==== Bugfixes
1920
- Fix rename *ConfigChange to *PolicyChange to align on changes in the UI. {pull}20779[20779]

x-pack/elastic-agent/_meta/config/common.p2.yml.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ outputs:
55
default:
66
type: elasticsearch
77
hosts: [127.0.0.1:9200]
8-
username: elastic
9-
password: changeme
8+
api-key: "example-key"
9+
# username: "elastic"
10+
# password: "changeme"
1011

1112
inputs:
1213
- type: system/metrics
@@ -74,8 +75,7 @@ inputs:
7475

7576
# # optional values
7677
# #protocol: "https"
77-
# #username: "elastic"
78-
# #password: "changeme"
78+
# #service_token: "example-token"
7979
# #path: ""
8080
# #ssl.verification_mode: full
8181
# #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]

x-pack/elastic-agent/_meta/config/common.reference.p2.yml.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ outputs:
55
default:
66
type: elasticsearch
77
hosts: [127.0.0.1:9200]
8-
username: elastic
9-
password: changeme
8+
api-key: "example-key"
9+
# username: "elastic"
10+
# password: "changeme"
1011

1112
inputs:
1213
- type: system/metrics
@@ -43,8 +44,7 @@ inputs:
4344

4445
# # optional values
4546
# #protocol: "https"
46-
# #username: "elastic"
47-
# #password: "changeme"
47+
# #service_token: "example-token"
4848
# #path: ""
4949
# #ssl.verification_mode: full
5050
# #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]

x-pack/elastic-agent/_meta/config/elastic-agent.docker.yml.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ inputs:
4343

4444
# # optional values
4545
# #protocol: "https"
46-
# #username: "elastic"
47-
# #password: "changeme"
46+
# #service_token: "${FLEET_SERVER_SERVICE_TOKEN}"
4847
# #path: ""
4948
# #ssl.verification_mode: full
5049
# #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]

x-pack/elastic-agent/_meta/elastic-agent.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ inputs:
4343

4444
# # optional values
4545
# #protocol: "https"
46-
# #username: "elastic"
47-
# #password: "changeme"
46+
# #service_token: "example-token"
4847
# #path: ""
4948
# #ssl.verification_mode: full
5049
# #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]

x-pack/elastic-agent/elastic-agent.docker.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ inputs:
4343

4444
# # optional values
4545
# #protocol: "https"
46-
# #username: "elastic"
47-
# #password: "changeme"
46+
# #service_token: "${FLEET_SERVER_SERVICE_TOKEN}"
4847
# #path: ""
4948
# #ssl.verification_mode: full
5049
# #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]

x-pack/elastic-agent/elastic-agent.reference.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ outputs:
1111
default:
1212
type: elasticsearch
1313
hosts: [127.0.0.1:9200]
14-
username: elastic
15-
password: changeme
14+
api-key: "example-key"
15+
# username: "elastic"
16+
# password: "changeme"
1617

1718
inputs:
1819
- type: system/metrics
@@ -49,8 +50,7 @@ inputs:
4950

5051
# # optional values
5152
# #protocol: "https"
52-
# #username: "elastic"
53-
# #password: "changeme"
53+
# #service_token: "example-token"
5454
# #path: ""
5555
# #ssl.verification_mode: full
5656
# #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]

x-pack/elastic-agent/elastic-agent.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ outputs:
1111
default:
1212
type: elasticsearch
1313
hosts: [127.0.0.1:9200]
14-
username: elastic
15-
password: changeme
14+
api-key: "example-key"
15+
# username: "elastic"
16+
# password: "changeme"
1617

1718
inputs:
1819
- type: system/metrics
@@ -80,8 +81,7 @@ inputs:
8081

8182
# # optional values
8283
# #protocol: "https"
83-
# #username: "elastic"
84-
# #password: "changeme"
84+
# #service_token: "example-token"
8585
# #path: ""
8686
# #ssl.verification_mode: full
8787
# #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]

x-pack/elastic-agent/pkg/agent/cmd/container.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ The following actions are possible and grouped based on the actions.
7979
The following vars are need in the scenario that Elastic Agent should automatically fetch its own token.
8080
8181
KIBANA_FLEET_HOST - kibana host to enable create enrollment token on [$KIBANA_HOST]
82-
KIBANA_FLEET_USERNAME - kibana username to create enrollment token [$KIBANA_USERNAME]
83-
KIBANA_FLEET_PASSWORD - kibana password to create enrollment token [$KIBANA_PASSWORD]
8482
FLEET_TOKEN_NAME - token name to use for fetching token from Kibana. This requires Kibana configs to be set.
8583
FLEET_TOKEN_POLICY_NAME - token policy name to use for fetching token from Kibana. This requires Kibana configs to be set.
8684
@@ -93,8 +91,6 @@ The following actions are possible and grouped based on the actions.
9391
9492
FLEET_SERVER_ENABLE - set to 1 enables bootstrapping of Fleet Server inside Elastic Agent (forces FLEET_ENROLL enabled)
9593
FLEET_SERVER_ELASTICSEARCH_HOST - elasticsearch host for Fleet Server to communicate with [$ELASTICSEARCH_HOST]
96-
FLEET_SERVER_ELASTICSEARCH_USERNAME - elasticsearch username for Fleet Server [$ELASTICSEARCH_USERNAME]
97-
FLEET_SERVER_ELASTICSEARCH_PASSWORD - elasticsearch password for Fleet Server [$ELASTICSEARCH_PASSWORD]
9894
FLEET_SERVER_ELASTICSEARCH_CA - path to certificate authority to use with communicate with elasticsearch [$ELASTICSEARCH_CA]
9995
FLEET_SERVER_ELASTICSEARCH_CA_TRUSTED_FINGERPRINT - The sha-256 fingerprint value of the certificate authority to trust
10096
FLEET_SERVER_ELASTICSEARCH_INSECURE - disables cert validation for communication with Elasticsearch
@@ -113,8 +109,6 @@ The following actions are possible and grouped based on the actions.
113109
114110
KIBANA_FLEET_SETUP - set to 1 enables the setup of Fleet in Kibana by Elastic Agent. This was previously FLEET_SETUP.
115111
KIBANA_FLEET_HOST - Kibana host accessible from fleet-server. [$KIBANA_HOST]
116-
KIBANA_FLEET_USERNAME - kibana username to enable Fleet [$KIBANA_USERNAME]
117-
KIBANA_FLEET_PASSWORD - kibana password to enable Fleet [$KIBANA_PASSWORD]
118112
KIBANA_FLEET_CA - path to certificate authority to use with communicate with Kibana [$KIBANA_CA]
119113
KIBANA_REQUEST_RETRY_SLEEP - specifies sleep duration taken when agent performs a request to kibana [default 1s]
120114
KIBANA_REQUEST_RETRY_COUNT - specifies number of retries agent performs when executing a request to kibana [default 30]
@@ -123,12 +117,8 @@ The following environment variables are provided as a convenience to prevent a l
123117
be used when the same credentials will be used across all the possible actions above.
124118
125119
ELASTICSEARCH_HOST - elasticsearch host [http://elasticsearch:9200]
126-
ELASTICSEARCH_USERNAME - elasticsearch username [elastic]
127-
ELASTICSEARCH_PASSWORD - elasticsearch password [changeme]
128120
ELASTICSEARCH_CA - path to certificate authority to use with communicate with elasticsearch
129121
KIBANA_HOST - kibana host [http://kibana:5601]
130-
KIBANA_USERNAME - kibana username [$ELASTICSEARCH_USERNAME]
131-
KIBANA_PASSWORD - kibana password [$ELASTICSEARCH_PASSWORD]
132122
KIBANA_CA - path to certificate authority to use with communicate with Kibana [$ELASTICSEARCH_CA]
133123
134124
@@ -427,10 +417,7 @@ func buildFleetServerConnStr(cfg fleetServerConfig) (string, error) {
427417
if u.Path != "" {
428418
path += "/" + strings.TrimLeft(u.Path, "/")
429419
}
430-
if cfg.Elasticsearch.ServiceToken != "" {
431-
return fmt.Sprintf("%s://%s%s", u.Scheme, u.Host, path), nil
432-
}
433-
return fmt.Sprintf("%s://%s:%s@%s%s", u.Scheme, cfg.Elasticsearch.Username, cfg.Elasticsearch.Password, u.Host, path), nil
420+
return fmt.Sprintf("%s://%s%s", u.Scheme, u.Host, path), nil
434421
}
435422

436423
func kibanaSetup(cfg setupConfig, client *kibana.Client, streams *cli.IOStreams) error {
@@ -485,8 +472,6 @@ func kibanaClient(cfg kibanaConfig, headers map[string]string) (*kibana.Client,
485472

486473
return kibana.NewClientWithConfigDefault(&kibana.ClientConfig{
487474
Host: cfg.Fleet.Host,
488-
Username: cfg.Fleet.Username,
489-
Password: cfg.Fleet.Password,
490475
ServiceToken: cfg.Fleet.ServiceToken,
491476
IgnoreVersion: true,
492477
Transport: transport,

x-pack/elastic-agent/pkg/agent/cmd/enroll_cmd_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ func TestEnroll(t *testing.T) {
157157
require.NoError(t, err)
158158
require.Equal(t, "my-access-api-key", config.AccessAPIKey)
159159
require.Equal(t, host, config.Client.Host)
160-
require.Equal(t, "", config.Client.Username)
161-
require.Equal(t, "", config.Client.Password)
162160
},
163161
))
164162

@@ -217,8 +215,6 @@ func TestEnroll(t *testing.T) {
217215
require.NoError(t, err)
218216
require.Equal(t, "my-access-api-key", config.AccessAPIKey)
219217
require.Equal(t, host, config.Client.Host)
220-
require.Equal(t, "", config.Client.Username)
221-
require.Equal(t, "", config.Client.Password)
222218
},
223219
))
224220

@@ -277,8 +273,6 @@ func TestEnroll(t *testing.T) {
277273
require.NoError(t, err)
278274
require.Equal(t, "my-access-api-key", config.AccessAPIKey)
279275
require.Equal(t, host, config.Client.Host)
280-
require.Equal(t, "", config.Client.Username)
281-
require.Equal(t, "", config.Client.Password)
282276
},
283277
))
284278

0 commit comments

Comments
 (0)