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
| Key | Required | Description |
|---|---|---|
policy_labels | no | JSON 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:
| Field | Source |
|---|---|
account_id | the caller's AWS account |
distribution_id | the distribution ID |
arn | the distribution ARN |
domain_name | the distribution's CloudFront domain name |
status | the distribution status |
enabled | whether the distribution is enabled |
certificate_arn | the viewer certificate's ACM certificate ARN (omitted when there is none) |
cache_behaviours | path_pattern and viewer_protocol_policy for the default cache behaviour (reported as path /*) and each path-based cache behaviour |
tags | the 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.
| Field | Type | Description |
|---|---|---|
account_id | string | AWS account ID the plugin is running against. |
distribution_id | string | ID of the distribution. |
arn | string | ARN of the distribution. |
domain_name | string | The distribution's CloudFront domain name. |
status | string | Distribution status, Deployed or InProgress. |
enabled | boolean | Whether the distribution is enabled. |
certificate_arn | string | ARN of the ACM certificate the viewer connection uses. Omitted when the distribution uses no ACM certificate. |
cache_behaviours | array of objects | The 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). |
tags | object (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 key | Description |
|---|---|
account_id | AWS account ID. |
distribution_id | CloudFront 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.
| Bundle | Latest version | Controls covered | Compatible plugin lines |
|---|---|---|---|
plugin-aws-cloudfront-policies | v0.1.1 | CC6.7 | latest |
Default policy bundle mapping
| Repository | Primary input |
|---|---|
plugin-aws-cloudfront-policies | one CloudFront distribution per evaluation |