Skip to content

Add CloudFormation template for Federated Identity (AWS)#7422

Draft
seanrathier wants to merge 4 commits into
mainfrom
seanrathier/federated-identity-aws-cft
Draft

Add CloudFormation template for Federated Identity (AWS)#7422
seanrathier wants to merge 4 commits into
mainfrom
seanrathier/federated-identity-aws-cft

Conversation

@seanrathier

@seanrathier seanrathier commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds deploy/cloudformation/federated-identity-aws.yml — a single static CloudFormation template that creates one read-only IAM role granting the permissions required by all agentless-enabled AWS integrations.
  • The only required parameter is ElasticResourceId (used to derive the composite ExternalId). No per-integration toggles: policies are grouped into five inline policy resources — Transport (S3 read / SQS consume / CloudWatch Logs read), Metrics, Security Findings (Security Hub, Inspector, Config, CloudTrail), Service Inventory, and Security Posture (CSPM / Cloud Asset Inventory / KSPM-EKS supplemental reads, sourced from the per-package IaC patches in [WIP] Support dynamic IaC for integrations integrations#20240) — plus the AmazonGuardDutyReadOnlyAccess and SecurityAudit managed policies. CNVM is deliberately excluded: its scan operations need write access and keep their own dedicated template.
  • Registers the template in scripts/publish_cft.sh so it is uploaded to s3://elastic-cspm-cft/ as cloudformation-federated-identity-aws-{version}.yml on release.

Background

Part of https://github.com/elastic/ingest-dev/issues/8887.

This template supports the Federated Identity auth path for Cloud Connectors across the AWS package's agentless integrations, replacing the GuardDuty-only cloud-connectors-guardduty.yml as the target of Kibana's quick-create URL. A single all-permissions template means users deploy one stack and never need to update it when they enable additional integrations, and Kibana needs no changes beyond pointing iac_template_url at the new template (elastic/integrations PR to follow).

An earlier revision of this PR parameterized the template with one Enable* boolean per integration, attaching policies via CloudFormation Conditions. That was dropped in favor of the simpler unconditional grant — see commit history. The long-term plan remains for elastic/cloud-iac-provisioner to generate role policies dynamically; this static template serves as the bridge until that IaC path is available.

Test plan

  • Validate YAML with cfn-lint deploy/cloudformation/federated-identity-aws.yml (passes in pre-commit)
  • Deploy a stack in a test AWS account and verify the role is created with the four inline policies + GuardDuty managed policy
  • Confirm stack outputs contain RoleArn and ExternalId, and that assuming the role with the composite ExternalId succeeds
  • Run publish_cft.sh against a test S3 bucket to verify the upload entry works

🤖 Generated with Claude Code

Introduces federated-identity-aws.yml — a single CFT with one Enable*
boolean parameter per AWS integration. CloudFormation Conditions attach
only the IAM policies needed for the selected data streams, keeping the
role minimal. Transport-layer policies (S3/SQS, CloudWatch Logs, Metrics)
are auto-derived so users never need to think about them.

Adds the template to publish_cft.sh so it is uploaded to S3 alongside
the existing cloud-connectors templates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@seanrathier
seanrathier requested a review from a team as a code owner July 21, 2026 20:13
@mergify

mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This pull request does not have a backport label. Could you fix it @seanrathier? 🙏
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
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@seanrathier
seanrathier marked this pull request as draft July 21, 2026 20:18
…nally

Drops the 24 Enable* parameters and all CloudFormation Conditions in
favor of a single static read-only role. Every IAM policy needed by the
agentless-enabled AWS policy templates is always attached, so Kibana
only needs to pass ElasticResourceId in the quick-create URL and users
never have to update the stack when they add integrations later.

Policies are grouped into four inline policy resources (transport,
metrics, security findings, service inventory) plus the GuardDuty
managed policy. Trust policy, ExternalId derivation, and outputs are
unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@seanrathier seanrathier changed the title Add parameterized CloudFormation template for Federated Identity (AWS) Add CloudFormation template for Federated Identity (AWS) Jul 22, 2026
@seanrathier seanrathier added backport-skip aws Team:Security-Cloud Services Security Data Experience - Cloud Services team. labels Jul 22, 2026
seanrathier and others added 2 commits July 23, 2026 09:45
Extends the federated identity role to cover CSPM, Cloud Asset
Inventory, and KSPM-EKS: attaches the SecurityAudit managed policy and
adds an ElasticSecurityPosture inline policy with the supplemental
config, organizations, access-analyzer, account, cross-account
sts:AssumeRole, and EKS read permissions declared in the per-package
IaC patches of elastic/integrations#20240.

CNVM is deliberately excluded: its scan operations (snapshot
create/delete, RunInstances/TerminateInstances, iam:PassRole) require
write access, and this role stays read-only. CNVM keeps its dedicated
template.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cross-checked every inline action against the provider_permissions
declarations in elastic/integrations#19405 (the AWS package's
per-datastream permission manifest) and added the missing actions the
agentless data streams require at runtime:

- ec2:DescribeInstanceStatus (ec2_metrics)
- ecs:DescribeClusters (ecs_metrics)
- elasticloadbalancing:DescribeTargetHealth (elb_metrics)
- lambda:GetFunction (lambda)
- rds:DescribeDBClusters (rds)
- health:DescribeAffectedEntities (awshealth)
- securityhub:BatchGetSecurityControls, GetInsightResults
  (securityhub_findings_full_posture, securityhub_insights)

securityhub:ListInsights, declared by #19405, is NOT added: cfn-lint
confirms no such IAM action exists — listing insights is
securityhub:GetInsights, which was already granted.

Also corrects the Config grant: the aws.config data stream polls rule
compliance (DescribeConfigRules, DescribeComplianceByConfigRule,
GetComplianceDetailsByConfigRule), not resource inventory; the
inventory-style Config reads moved to the SecurityPosturePolicy with
the rest of the Asset Inventory permission set.

Actions not declared by #19405 are retained when another primary source
documents them (e.g. iam:ListAccountAliases in the package README);
services whose policy templates are not agentless-enabled (apigateway,
natgateway, vpn, emr, kafka, kinesis, redshift, s3_storage_lens) stay
out of scope.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aws backport-skip Team:Security-Cloud Services Security Data Experience - Cloud Services team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant