Skip to main content

AWS CloudFront

This plugin collects read-only metadata for the AWS CloudFront distributions in an account, evaluates CCF Rego policy bundles against each distribution, and emits evidence back through the CCF agent.

This page is for operators who run the plugin-aws-cloudfront plugin with the CCF Agent, and for developers who write policies for it. It documents v0.1.2 and is generated from the plugin's README at v0.1.2.

How it works​

How it fits in CCF​

The CCF agent starts this binary through HashiCorp go-plugin (runner protocol v2), passes configuration and policy paths over gRPC, and receives generated evidence through the runner callback. This repository does not call the CCF API directly.

During Init, the plugin registers the cloudfront-distribution subject template (identified by account_id and distribution_id) and the subject and risk templates discovered from the supplied policy bundles.

Configuration​

KeyRequiredDescription
policy_labelsnoJSON object of extra labels added to every evidence, e.g. {"team":"platform"}.

CloudFront is a global service, so there is no region setting: every AWS call (CloudFront and sts:GetCallerIdentity) goes to us-east-1. AWS credentials come from the default AWS SDK credential chain.

Any agent-supplied policy_data is passed through to Rego as data.*, on top of the bundle's own data.json (agent-supplied keys win).

Evidence collected​

Data collected​

For every distribution returned by the CloudFront ListDistributions API (all pages), the plugin reads its tags with ListTagsForResource and builds this policy input:

FieldSource
account_idthe caller's AWS account
distribution_idthe distribution ID
arnthe distribution ARN
domain_namethe distribution's CloudFront domain name
statusthe distribution status
enabledwhether the distribution is enabled
certificate_arnthe viewer certificate's ACM certificate ARN (omitted when there is none)
cache_behaviourspath_pattern and viewer_protocol_policy for the default cache behaviour (reported as path /*) and each path-based cache behaviour
tagsthe distribution's tags (empty when they cannot be read)

Each evidence carries the labels provider=aws, type=cloudfront-distribution, distribution_id, resource_arn, account_id and domain_name, plus any policy_labels.

Policy input​

One document per CloudFront distribution. CloudFront is global, so there is no region. The plugin builds the document from ListDistributions and ListTagsForResource, and a policy reads it as input.

FieldTypeDescription
account_idstringAWS account ID the plugin is running against.
distribution_idstringID of the distribution.
arnstringARN of the distribution.
domain_namestringThe distribution's CloudFront domain name.
statusstringDistribution status, Deployed or InProgress.
enabledbooleanWhether the distribution is enabled.
certificate_arnstringARN of the ACM certificate the viewer connection uses. Omitted when the distribution uses no ACM certificate.
cache_behavioursarray of objectsThe default cache behaviour first, with path pattern /*, then every other cache behaviour. Each has path_pattern (string) and viewer_protocol_policy (string: allow-all, https-only or redirect-to-https).
tagsobject (string to string)The distribution's tags. An empty object when it has none or when the tags could not be read.

An example input:

{
"account_id": "111122223333",
"distribution_id": "E2EXAMPLE1ABCD",
"arn": "arn:aws:cloudfront::111122223333:distribution/E2EXAMPLE1ABCD",
"domain_name": "d1example2abcd.cloudfront.net",
"status": "Deployed",
"enabled": true,
"certificate_arn": "arn:aws:acm:us-east-1:111122223333:certificate/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
"cache_behaviours": [
{
"path_pattern": "/*",
"viewer_protocol_policy": "redirect-to-https"
},
{
"path_pattern": "/static/*",
"viewer_protocol_policy": "https-only"
}
],
"tags": {
"Environment": "production"
}
}

Subject templates​

The subject templates this plugin registers. Each example is built from sample data.

cloudfront-distribution​

A CloudFront distribution. The plugin registers it as a component subject and attaches it to the evidence of every distribution it evaluates. Title: CloudFront Distribution {{ .distribution_id }}.

Identity keyDescription
account_idAWS account ID.
distribution_idCloudFront distribution ID.

Example:

{
"name": "cloudfront-distribution",
"type": "component",
"title": "CloudFront Distribution E2EXAMPLE1ABCD",
"description": "AWS CloudFront Distribution E2EXAMPLE1ABCD (d1example2abcd.cloudfront.net) in account 111122223333.",
"purpose": "Represents an AWS CloudFront distribution evaluated for TLS compliance posture.",
"identityLabels": {
"account_id": "111122223333",
"distribution_id": "E2EXAMPLE1ABCD"
}
}

Policies​

The policy bundles that work with this plugin, at their newest releases. The controls are the ones the bundle's policies list in their metadata.

BundleLatest versionControls coveredCompatible plugin lines
plugin-aws-cloudfront-policiesv0.1.1CC6.7latest

Default policy bundle mapping​

RepositoryPrimary input
plugin-aws-cloudfront-policiesone CloudFront distribution per evaluation