Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add agentless CSPM AWS findings assertion in serverless mode #1664

Merged
merged 36 commits into from
Dec 19, 2023

Conversation

amirbenun
Copy link
Contributor

@amirbenun amirbenun commented Dec 14, 2023

Summary of your changes

Our sanity tests has already a serverless mode.
On this PR, the sanity tests install CSPM AWS integration on the agentless policy and verify it produces findings.

Screenshot/Data

Related Issues

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary README/documentation (if appropriate)

Introducing a new rule?

@amirbenun amirbenun requested a review from a team as a code owner December 14, 2023 17:00
Copy link

mergify bot commented Dec 14, 2023

This pull request does not have a backport label. Could you fix it @amirbenun? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit
    NOTE: backport-skip has been added to this pull request.

Comment on lines +87 to +98
logger.info(f"Create {NAME} integration for policy {AGENT_POLICY_ID}")
package_policy = generate_package_policy(cspm_template, integration_data)

logger.info(f"Created {package_policy}")

create_cspm_integration(
cfg=cnfg.elk_config,
pkg_policy=package_policy,
agent_policy_id=AGENT_POLICY_ID,
cspm_data={},
)
logger.info(f"Installation of {NAME} integration is done")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create-environment workflow supports different elastic versions installation, and the main branch is always used for deployment. To prevent some misconfigurations, such as policy field discrepancies, and ensure integration availability, logic based on the package version has been implemented for each integration. It might be better to retrieve the current package version and prevent the installation of integrations if the version is less than required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With serverless it is a bit different, you will always deploy the latest elastic stack so this check is redundant.

tests/agents_map.py Outdated Show resolved Hide resolved
tests/agents_map.py Outdated Show resolved Hide resolved
@amirbenun amirbenun changed the title Add agentless findings testing to the serverless mode Add agentless CSPM AWS findings assertion in serverless mode Dec 18, 2023
Copy link
Collaborator

@gurevichdmitry gurevichdmitry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amirbenun great work, LGTM.
Could you please verify that running the regular workflow (not agentless) is also functioning correctly?

@amirbenun amirbenun mentioned this pull request Dec 19, 2023
6 tasks
@amirbenun amirbenun merged commit ba2614a into elastic:main Dec 19, 2023
18 checks passed
@amirbenun amirbenun deleted the agentless-sanity branch December 19, 2023 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Agentless CSPM sanity test
3 participants