mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Cloud Security] Added 'x-elastic-internal-origin' to agentless axios request headers for Kibana 9.0 (#203188)
This commit is contained in:
parent
1d3bf85d19
commit
e08d7126eb
2 changed files with 730 additions and 663 deletions
File diff suppressed because it is too large
Load diff
|
@ -113,16 +113,7 @@ class AgentlessAgentService {
|
|||
labels,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
'X-Request-ID': traceId,
|
||||
},
|
||||
httpsAgent: new https.Agent({
|
||||
rejectUnauthorized: tlsConfig.rejectUnauthorized,
|
||||
cert: tlsConfig.certificate,
|
||||
key: tlsConfig.key,
|
||||
ca: tlsConfig.certificateAuthorities,
|
||||
}),
|
||||
...this.getHeaders(tlsConfig, traceId),
|
||||
};
|
||||
|
||||
const cloudSetup = appContextService.getCloud();
|
||||
|
@ -157,6 +148,7 @@ class AgentlessAgentService {
|
|||
|
||||
public async deleteAgentlessAgent(agentlessPolicyId: string) {
|
||||
const logger = appContextService.getLogger();
|
||||
const traceId = apm.currentTransaction?.traceparent;
|
||||
const agentlessConfig = appContextService.getConfig()?.agentless;
|
||||
const tlsConfig = this.createTlsConfig(agentlessConfig);
|
||||
const requestConfig = {
|
||||
|
@ -165,17 +157,9 @@ class AgentlessAgentService {
|
|||
`/deployments/${agentlessPolicyId}`
|
||||
),
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
},
|
||||
httpsAgent: new https.Agent({
|
||||
rejectUnauthorized: tlsConfig.rejectUnauthorized,
|
||||
cert: tlsConfig.certificate,
|
||||
key: tlsConfig.key,
|
||||
ca: tlsConfig.certificateAuthorities,
|
||||
}),
|
||||
...this.getHeaders(tlsConfig, traceId),
|
||||
};
|
||||
const traceId = apm.currentTransaction?.traceparent;
|
||||
|
||||
const errorMetadata: LogMeta = {
|
||||
trace: {
|
||||
id: traceId,
|
||||
|
@ -220,6 +204,22 @@ class AgentlessAgentService {
|
|||
return response;
|
||||
}
|
||||
|
||||
private getHeaders(tlsConfig: SslConfig, traceId: string | undefined) {
|
||||
return {
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
'X-Request-ID': traceId,
|
||||
'x-elastic-internal-origin': 'Kibana',
|
||||
},
|
||||
httpsAgent: new https.Agent({
|
||||
rejectUnauthorized: tlsConfig.rejectUnauthorized,
|
||||
cert: tlsConfig.certificate,
|
||||
key: tlsConfig.key,
|
||||
ca: tlsConfig.certificateAuthorities,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
private getAgentlessTags(agentlessAgentPolicy: AgentPolicy) {
|
||||
if (!agentlessAgentPolicy.global_data_tags) {
|
||||
return undefined;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue