forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cloud Security] add GCP support for agentless (elastic#177965)
## Summary Part of: - elastic/security-team#8040 Adding support for GCP for Agentless. Specifics: - only JSON blob credentials type is supported - in contrast to Agent-based, in "GCP organisation" option there is no need to provide to `Project ID` field as it's not required for Agentless ## Screencast [screencast-github.com-2024.03.07-10_25_43.webm](https://github.com/elastic/kibana/assets/478762/cae1483c-20de-48f5-9814-b6510c1482da) ## how to test The simplest way is to deploy the Kibana image built for this PR to dev MKI env, following this documentation https://docs.elastic.dev/kibana-dev-docs/serverless/custom-kibana-image-on-serverless I tested both Org and Single Account set up with real credentials of Cloud Security Google Cloud account, got findings in the dev MKI environments ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
- Loading branch information
Showing
9 changed files
with
257 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...ublic/components/fleet_extensions/gcp_credentials_form/gcp_credentials_form_agentless.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiSpacer } from '@elastic/eui'; | ||
|
||
import { | ||
GcpFormProps, | ||
GCPSetupInfoContent, | ||
GcpInputVarFields, | ||
gcpField, | ||
getInputVarsFields, | ||
} from './gcp_credential_form'; | ||
import { getPosturePolicy } from '../utils'; | ||
import { ReadDocumentation } from '../aws_credentials_form/aws_credentials_form'; | ||
import { cspIntegrationDocsNavigation } from '../../../common/navigation/constants'; | ||
|
||
export const GcpCredentialsFormAgentless = ({ | ||
input, | ||
newPolicy, | ||
updatePolicy, | ||
disabled, | ||
}: GcpFormProps) => { | ||
const accountType = input.streams?.[0]?.vars?.['gcp.account_type']?.value; | ||
const isOrganization = accountType === 'organization-account'; | ||
const organizationFields = ['gcp.organization_id', 'gcp.credentials.json']; | ||
const singleAccountFields = ['gcp.project_id', 'gcp.credentials.json']; | ||
|
||
/* | ||
For Agentless only JSON credentials type is supported. | ||
Also in case of organisation setup, project_id is not required in contrast to Agent-based. | ||
*/ | ||
const fields = getInputVarsFields(input, gcpField.fields).filter((field) => { | ||
if (isOrganization) { | ||
return organizationFields.includes(field.id); | ||
} else { | ||
return singleAccountFields.includes(field.id); | ||
} | ||
}); | ||
|
||
return ( | ||
<> | ||
<GCPSetupInfoContent /> | ||
<EuiSpacer size="l" /> | ||
<GcpInputVarFields | ||
disabled={disabled} | ||
fields={fields} | ||
onChange={(key, value) => | ||
updatePolicy(getPosturePolicy(newPolicy, input.type, { [key]: { value } })) | ||
} | ||
isOrganization={isOrganization} | ||
/> | ||
<EuiSpacer size="s" /> | ||
<ReadDocumentation url={cspIntegrationDocsNavigation.cspm.getStartedPath} /> | ||
<EuiSpacer /> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.