Enforce DENY non-HTTPS requests to s3 buckets (#250)

- Enforces access over HTTPS to all Fleet-terraform created buckets.
- Fixes vpc-flow-logs log retention; now allows configuring the
retention in days.
This commit is contained in:
Jorge Falcon authored and GitHub committed 2026-06-08 18:37:48 -04:00
1 parent a276eb6a98
commit 7b381e0bbb
25 files changed
+503 -175

No files matched your search

@@ -14,14 +14,18 @@ The second link includes a script that can be used to test and see if signed URL
This addon is intentionally out of scope for AWS GovCloud compatibility. CloudFront is not available inside the AWS GovCloud (US) partition, so using it with GovCloud-hosted resources is a cross-partition architecture that should be designed and reviewed separately.
## S3 Bucket Policy
This addon no longer manages an S3 bucket policy on the software installers bucket. The bucket policy is now managed by the core module (`byo-ecs`), which automatically denies non-HTTPS requests and includes the CloudFront allow statement when `cloudfront_distribution_arn` is set.
## Other module requirements
These are the minimum versions of modules required if used:
- tf-mod-root-v1.13.0
- tf-mod-byo-vpc-v1.14.0
- tf-mod-byo-db-v1.10.0
- tf-mod-byo-ecs-v1.9.0
- tf-mod-root-v1.30.0
- tf-mod-byo-vpc-v1.31.0
- tf-mod-byo-db-v1.21.0
- tf-mod-byo-ecs-v1.21.0
- tf-mod-addon-logging-alb-v1.3.0
Previous versions do not allow for proper interaction with both the software installers and logging s3 buckets.
@@ -121,7 +125,7 @@ Now with those encrypted we could setup the module with something like the follo
```
module "cloudfront-software-installers" {
source = "github.com/fleetdm/fleet-terraform/addons/cloudfront-software-installers?ref=tf-mod-addon-cloudfront-software-installers-v1.2.0"
source = "github.com/fleetdm/fleet-terraform/addons/cloudfront-software-installers?ref=tf-mod-addon-cloudfront-software-installers-v3.0.0"
customer = "fleet"
s3_bucket = module.main.byo-vpc.byo-db.byo-ecs.fleet_s3_software_installers_config.bucket_name
# OPTIONAL
@@ -13,14 +13,18 @@ The second link includes a script that can be used to test and see if signed URL
This addon is intentionally out of scope for AWS GovCloud compatibility. CloudFront is not available inside the AWS GovCloud (US) partition, so using it with GovCloud-hosted resources is a cross-partition architecture that should be designed and reviewed separately.
## S3 Bucket Policy
This addon no longer manages an S3 bucket policy on the software installers bucket. The bucket policy is now managed by the core module (`byo-ecs`), which automatically denies non-HTTPS requests and includes the CloudFront allow statement when `cloudfront_distribution_arn` is set.
## Other module requirements
These are the minimum versions of modules required if used:
- tf-mod-root-v1.13.0
- tf-mod-byo-vpc-v1.14.0
- tf-mod-byo-db-v1.10.0
- tf-mod-byo-ecs-v1.9.0
- tf-mod-root-v1.30.0
- tf-mod-byo-vpc-v1.31.0
- tf-mod-byo-db-v1.21.0
- tf-mod-byo-ecs-v1.21.0
- tf-mod-addon-logging-alb-v1.3.0
Previous versions do not allow for proper interaction with both the software installers and logging s3 buckets.
@@ -120,7 +124,7 @@ Now with those encrypted we could setup the module with something like the follo
```
module "cloudfront-software-installers" {
source = "github.com/fleetdm/fleet-terraform/addons/cloudfront-software-installers?ref=tf-mod-addon-cloudfront-software-installers-v1.2.0"
source = "github.com/fleetdm/fleet-terraform/addons/cloudfront-software-installers?ref=tf-mod-addon-cloudfront-software-installers-v3.0.0"
customer = "fleet"
s3_bucket = module.main.byo-vpc.byo-db.byo-ecs.fleet_s3_software_installers_config.bucket_name
# OPTIONAL
@@ -177,7 +181,7 @@ No requirements.
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 6.36.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 6.49.0 |
## Modules
@@ -192,10 +196,8 @@ No requirements.
| [aws_cloudfront_key_group.software_installers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_key_group) | resource |
| [aws_cloudfront_public_key.software_installers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_public_key) | resource |
| [aws_iam_policy.software_installers_secret](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
| [aws_s3_bucket_policy.software_installers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_secretsmanager_secret.software_installers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret) | resource |
| [aws_secretsmanager_secret_version.software_installers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret_version) | resource |
| [aws_iam_policy_document.software_installers_bucket](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.software_installers_secret](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_s3_bucket.logging](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket) | data source |
| [aws_s3_bucket.software_installers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket) | data source |
@@ -1,29 +1,7 @@
data "aws_iam_policy_document" "software_installers_bucket" {
statement {
actions = ["s3:GetObject"]
resources = ["${data.aws_s3_bucket.software_installers.arn}/*"]
effect = "Allow"
principals {
type = "Service"
identifiers = ["cloudfront.amazonaws.com"]
}
condition {
test = "StringEquals"
variable = "AWS:SourceArn"
values = [module.cloudfront_software_installers.cloudfront_distribution_arn]
}
}
}
data "aws_s3_bucket" "software_installers" {
bucket = var.s3_bucket
}
resource "aws_s3_bucket_policy" "software_installers" {
bucket = data.aws_s3_bucket.software_installers.bucket
policy = data.aws_iam_policy_document.software_installers_bucket.json
}
data "aws_iam_policy_document" "software_installers_secret" {
statement {
effect = "Allow"
@@ -7,11 +7,15 @@ This addon configures AWS Kinesis Firehose to send Fleet's osquery logs to Datad
3. IAM roles and policies for the Firehose streams to access the S3 bucket
4. An IAM policy for Fleet to access the Firehose streams
## S3 Bucket Policy: Deny Non-HTTPS
This module automatically attaches a bucket policy to the failure S3 bucket that denies any requests made over plain HTTP. No configuration is required.
## How to use
```hcl
module "datadog-logging" {
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-datadog?ref=tf-mod-addon-datadog-logging-v1.1.2"
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-datadog?ref=tf-mod-addon-datadog-logging-v1.2.0"
datadog_api_key = "your-datadog-api-key"
@@ -82,7 +86,7 @@ Then you can use the module's outputs in your Fleet configuration:
```hcl
module "fleet" {
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.27.0"
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.30.0"
certificate_arn = module.acm.acm_certificate_arn
vpc = {
+17 -2
View File
@@ -7,11 +7,23 @@ This addon configures AWS Kinesis Firehose to send Fleet's osquery logs to Datad
3. IAM roles and policies for the Firehose streams to access the S3 bucket
4. An IAM policy for Fleet to access the Firehose streams
## S3 Bucket Policy: Deny Non-HTTPS
Set `attach_deny_insecure_transport_policy = true` to attach a bucket policy to the failure S3 bucket that denies any requests made over plain HTTP:
```hcl
module "datadog-logging" {
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-datadog?ref=<tag>"
attach_deny_insecure_transport_policy = true
# ... other configuration ...
}
```
## How to use
```hcl
module "datadog-logging" {
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-datadog?ref=tf-mod-addon-datadog-logging-v1.1.2"
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-datadog?ref=tf-mod-addon-datadog-logging-v1.2.0"
datadog_api_key = "your-datadog-api-key"
@@ -82,7 +94,7 @@ Then you can use the module's outputs in your Fleet configuration:
```hcl
module "fleet" {
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.27.0"
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.30.0"
certificate_arn = module.acm.acm_certificate_arn
vpc = {
@@ -138,8 +150,10 @@ No modules.
| [aws_kinesis_firehose_delivery_stream.datadog](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kinesis_firehose_delivery_stream) | resource |
| [aws_s3_bucket.datadog-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_lifecycle_configuration.datadog-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_policy.deny_insecure_transport](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_public_access_block.datadog-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.datadog-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_iam_policy_document.deny_insecure_transport](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.firehose-logging](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.firehose_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.osquery_firehose_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
@@ -149,6 +163,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_attach_deny_insecure_transport_policy"></a> [attach\_deny\_insecure\_transport\_policy](#input\_attach\_deny\_insecure\_transport\_policy) | When true, attach a bucket policy to the S3 bucket that denies non-SSL requests. | `bool` | `false` | no |
| <a name="input_compression_format"></a> [compression\_format](#input\_compression\_format) | Compression format for the Firehose delivery stream | `string` | `"UNCOMPRESSED"` | no |
| <a name="input_datadog_api_key"></a> [datadog\_api\_key](#input\_datadog\_api\_key) | Datadog API key for authentication | `string` | n/a | yes |
| <a name="input_datadog_url"></a> [datadog\_url](#input\_datadog\_url) | Datadog HTTP API endpoint URL | `string` | n/a | yes |
@@ -36,6 +36,33 @@ resource "aws_s3_bucket_public_access_block" "datadog-failure" {
restrict_public_buckets = true
}
data "aws_iam_policy_document" "deny_insecure_transport" {
statement {
sid = "DenyNonHTTPS"
effect = "Deny"
actions = ["s3:*"]
resources = [
aws_s3_bucket.datadog-failure.arn,
"${aws_s3_bucket.datadog-failure.arn}/*",
]
principals {
type = "*"
identifiers = ["*"]
}
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
}
resource "aws_s3_bucket_policy" "deny_insecure_transport" {
bucket = aws_s3_bucket.datadog-failure.id
policy = data.aws_iam_policy_document.deny_insecure_transport.json
}
data "aws_iam_policy_document" "firehose_policy" {
statement {
effect = "Allow"
@@ -1,2 +1,6 @@
# Logging Destination: Firehose
This addon provides a Kinesis Firehose logging destination for Fleet.
## S3 Bucket Policy: Deny Non-HTTPS
This module automatically attaches a bucket policy to each S3 bucket (osquery-results, osquery-status, audit) that denies any requests made over plain HTTP. No configuration is required.
@@ -1,6 +1,10 @@
# Logging Destination: Firehose
This addon provides a Kinesis Firehose logging destination for Fleet.
## S3 Bucket Policy: Deny Non-HTTPS
This module automatically attaches a bucket policy to each S3 bucket (osquery-results, osquery-status, audit) that denies any requests made over plain HTTP. No configuration is required.
## Requirements
No requirements.
@@ -38,6 +42,9 @@ No modules.
| [aws_s3_bucket_lifecycle_configuration.audit](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_lifecycle_configuration.osquery-results](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_lifecycle_configuration.osquery-status](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_policy.deny_insecure_transport_audit](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_policy.deny_insecure_transport_osquery_results](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_policy.deny_insecure_transport_osquery_status](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_public_access_block.audit](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [aws_s3_bucket_public_access_block.osquery-results](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [aws_s3_bucket_public_access_block.osquery-status](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
@@ -45,6 +52,9 @@ No modules.
| [aws_s3_bucket_server_side_encryption_configuration.osquery-results](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.osquery-status](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_iam_policy_document.audit_policy_doc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.deny_insecure_transport_audit](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.deny_insecure_transport_osquery_results](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.deny_insecure_transport_osquery_status](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.firehose-logging](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.osquery_firehose_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.osquery_results_policy_doc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
@@ -42,6 +42,34 @@ resource "aws_s3_bucket_public_access_block" "osquery-results" {
restrict_public_buckets = true
}
data "aws_iam_policy_document" "deny_insecure_transport_osquery_results" {
statement {
sid = "DenyNonHTTPS"
effect = "Deny"
actions = ["s3:*"]
resources = [
aws_s3_bucket.osquery-results.arn,
"${aws_s3_bucket.osquery-results.arn}/*",
]
principals {
type = "*"
identifiers = ["*"]
}
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
}
resource "aws_s3_bucket_policy" "deny_insecure_transport_osquery_results" {
bucket = aws_s3_bucket.osquery-results.id
policy = data.aws_iam_policy_document.deny_insecure_transport_osquery_results.json
}
// Customer keys are not supported in our Fleet Terraforms at the moment. We will evaluate the
// possibility of providing this capability in the future.
// No versioning on this bucket is by design.
@@ -83,6 +111,34 @@ resource "aws_s3_bucket_public_access_block" "osquery-status" {
restrict_public_buckets = true
}
data "aws_iam_policy_document" "deny_insecure_transport_osquery_status" {
statement {
sid = "DenyNonHTTPS"
effect = "Deny"
actions = ["s3:*"]
resources = [
aws_s3_bucket.osquery-status.arn,
"${aws_s3_bucket.osquery-status.arn}/*",
]
principals {
type = "*"
identifiers = ["*"]
}
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
}
resource "aws_s3_bucket_policy" "deny_insecure_transport_osquery_status" {
bucket = aws_s3_bucket.osquery-status.id
policy = data.aws_iam_policy_document.deny_insecure_transport_osquery_status.json
}
// Customer keys are not supported in our Fleet Terraforms at the moment. We will evaluate the
// possibility of providing this capability in the future.
// No versioning on this bucket is by design.
@@ -124,6 +180,34 @@ resource "aws_s3_bucket_public_access_block" "audit" {
restrict_public_buckets = true
}
data "aws_iam_policy_document" "deny_insecure_transport_audit" {
statement {
sid = "DenyNonHTTPS"
effect = "Deny"
actions = ["s3:*"]
resources = [
aws_s3_bucket.audit.arn,
"${aws_s3_bucket.audit.arn}/*",
]
principals {
type = "*"
identifiers = ["*"]
}
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
}
resource "aws_s3_bucket_policy" "deny_insecure_transport_audit" {
bucket = aws_s3_bucket.audit.id
policy = data.aws_iam_policy_document.deny_insecure_transport_audit.json
}
data "aws_iam_policy_document" "osquery_results_policy_doc" {
statement {
effect = "Allow"
@@ -7,11 +7,15 @@ This addon configures AWS Kinesis Firehose to send Fleet's osquery logs to Snowf
3. IAM roles and policies for the Firehose streams to access the S3 bucket
4. An IAM policy for Fleet to access the Firehose streams
## S3 Bucket Policy: Deny Non-HTTPS
This module automatically attaches a bucket policy to the failure S3 bucket that denies any requests made over plain HTTP. No configuration is required.
## How to use
```hcl
module "snowflake-logging" {
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-snowflake?depth=1&ref=tf-mod-addon-logging-destination-snowflake-v1.0.3"
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-snowflake?depth=1&ref=tf-mod-addon-logging-destination-snowflake-v1.1.0"
s3_bucket_config = {
name_prefix = "fleet-snowflake-failure"
@@ -78,7 +82,7 @@ Then you can use the module's outputs in your Fleet configuration:
```hcl
module "fleet" {
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.27.0"
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.30.0"
certificate_arn = module.acm.acm_certificate_arn
vpc = {
@@ -7,11 +7,15 @@ This addon configures AWS Kinesis Firehose to send Fleet's osquery logs to Snowf
3. IAM roles and policies for the Firehose streams to access the S3 bucket
4. An IAM policy for Fleet to access the Firehose streams
## S3 Bucket Policy: Deny Non-HTTPS
This module automatically attaches a bucket policy to the failure S3 bucket that denies any requests made over plain HTTP. No configuration is required.
## How to use
```hcl
module "snowflake-logging" {
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-snowflake?depth=1&ref=tf-mod-addon-logging-destination-snowflake-v1.0.3"
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-snowflake?depth=1&ref=tf-mod-addon-logging-destination-snowflake-v1.1.0"
s3_bucket_config = {
name_prefix = "fleet-snowflake-failure"
@@ -78,7 +82,7 @@ Then you can use the module's outputs in your Fleet configuration:
```hcl
module "fleet" {
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.27.0"
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.30.0"
certificate_arn = module.acm.acm_certificate_arn
vpc = {
@@ -134,8 +138,10 @@ No modules.
| [aws_kinesis_firehose_delivery_stream.snowflake](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kinesis_firehose_delivery_stream) | resource |
| [aws_s3_bucket.snowflake-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_lifecycle_configuration.snowflake-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_policy.deny_insecure_transport](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_public_access_block.snowflake-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.snowflake-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_iam_policy_document.deny_insecure_transport](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.firehose-logging](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.firehose_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.osquery_firehose_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
@@ -37,6 +37,33 @@ resource "aws_s3_bucket_public_access_block" "snowflake-failure" {
restrict_public_buckets = true
}
data "aws_iam_policy_document" "deny_insecure_transport" {
statement {
sid = "DenyNonHTTPS"
effect = "Deny"
actions = ["s3:*"]
resources = [
aws_s3_bucket.snowflake-failure.arn,
"${aws_s3_bucket.snowflake-failure.arn}/*",
]
principals {
type = "*"
identifiers = ["*"]
}
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
}
resource "aws_s3_bucket_policy" "deny_insecure_transport" {
bucket = aws_s3_bucket.snowflake-failure.id
policy = data.aws_iam_policy_document.deny_insecure_transport.json
}
data "aws_iam_policy_document" "firehose_policy" {
statement {
effect = "Allow"
+6 -2
View File
@@ -7,11 +7,15 @@ This addon configures AWS Kinesis Firehose to send Fleet's osquery logs to Splun
3. IAM roles and policies for the Firehose streams to access the S3 bucket
4. An IAM policy for Fleet to access the Firehose streams
## S3 Bucket Policy: Deny Non-HTTPS
This module automatically attaches a bucket policy to the failure S3 bucket that denies any requests made over plain HTTP. No configuration is required.
## How to use
```hcl
module "splunk-logging" {
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-splunk?depth=1&ref=tf-mod-addon-logging-destination-splunk-v1.0.1"
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-splunk?depth=1&ref=tf-mod-addon-logging-destination-splunk-v1.1.0"
s3_bucket_config = {
name_prefix = "fleet-splunk-failure"
@@ -58,7 +62,7 @@ Then you can use the module's outputs in your Fleet configuration:
```hcl
module "fleet" {
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.27.0"
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.30.0"
certificate_arn = module.acm.acm_certificate_arn
vpc = {
+8 -2
View File
@@ -7,11 +7,15 @@ This addon configures AWS Kinesis Firehose to send Fleet's osquery logs to Splun
3. IAM roles and policies for the Firehose streams to access the S3 bucket
4. An IAM policy for Fleet to access the Firehose streams
## S3 Bucket Policy: Deny Non-HTTPS
This module automatically attaches a bucket policy to the failure S3 bucket that denies any requests made over plain HTTP. No configuration is required.
## How to use
```hcl
module "splunk-logging" {
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-splunk?depth=1&ref=tf-mod-addon-logging-destination-splunk-v1.0.1"
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-splunk?depth=1&ref=tf-mod-addon-logging-destination-splunk-v1.1.0"
s3_bucket_config = {
name_prefix = "fleet-splunk-failure"
@@ -58,7 +62,7 @@ Then you can use the module's outputs in your Fleet configuration:
```hcl
module "fleet" {
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.27.0"
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.30.0"
certificate_arn = module.acm.acm_certificate_arn
vpc = {
@@ -114,8 +118,10 @@ No modules.
| [aws_kinesis_firehose_delivery_stream.splunk](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kinesis_firehose_delivery_stream) | resource |
| [aws_s3_bucket.splunk-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_lifecycle_configuration.splunk-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_policy.deny_insecure_transport](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_public_access_block.splunk-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.splunk-failure](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_iam_policy_document.deny_insecure_transport](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.firehose-logging](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.firehose_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.osquery_firehose_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
+27
View File
@@ -37,6 +37,33 @@ resource "aws_s3_bucket_public_access_block" "splunk-failure" {
restrict_public_buckets = true
}
data "aws_iam_policy_document" "deny_insecure_transport" {
statement {
sid = "DenyNonHTTPS"
effect = "Deny"
actions = ["s3:*"]
resources = [
aws_s3_bucket.splunk-failure.arn,
"${aws_s3_bucket.splunk-failure.arn}/*",
]
principals {
type = "*"
identifiers = ["*"]
}
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
}
resource "aws_s3_bucket_policy" "deny_insecure_transport" {
bucket = aws_s3_bucket.splunk-failure.id
policy = data.aws_iam_policy_document.deny_insecure_transport.json
}
data "aws_iam_policy_document" "firehose_policy" {
statement {
effect = "Allow"
+4
View File
@@ -13,3 +13,7 @@ When a module-created customer-managed key must trust the Fleet IAM role, Terraf
The IAM policy exported by this addon is intentionally S3-only. KMS authorization is handled in the KMS key policy for module-created keys. If `osquery_carve_s3_bucket.kms.kms_key_arn` is set, this module does not manage the referenced key policy and does not export a generic KMS IAM policy for it.
When bringing your own KMS key, it is your responsibility to ensure that key policy and any separately managed IAM permissions allow the Fleet role to perform the required KMS actions for S3 object encryption and decryption.
## S3 Bucket Policy: Deny Non-HTTPS
This module automatically attaches a bucket policy that denies any requests made over plain HTTP. No configuration is required.
+6
View File
@@ -14,6 +14,10 @@ The IAM policy exported by this addon is intentionally S3-only. KMS authorizatio
When bringing your own KMS key, it is your responsibility to ensure that key policy and any separately managed IAM permissions allow the Fleet role to perform the required KMS actions for S3 object encryption and decryption.
## S3 Bucket Policy: Deny Non-HTTPS
This module automatically attaches a bucket policy that denies any requests made over plain HTTP. No configuration is required.
## Requirements
| Name | Version |
@@ -41,9 +45,11 @@ No modules.
| [aws_kms_key_policy.osquery_carve](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key_policy) | resource |
| [aws_s3_bucket.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_lifecycle_configuration.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_policy.deny_insecure_transport](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_public_access_block.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.deny_insecure_transport](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.osquery_carve_kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_role.osquery_carve_fleet](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_role) | data source |
+27
View File
@@ -205,6 +205,33 @@ resource "aws_s3_bucket_public_access_block" "main" {
restrict_public_buckets = true
}
data "aws_iam_policy_document" "deny_insecure_transport" {
statement {
sid = "DenyNonHTTPS"
effect = "Deny"
actions = ["s3:*"]
resources = [
aws_s3_bucket.main.arn,
"${aws_s3_bucket.main.arn}/*",
]
principals {
type = "*"
identifiers = ["*"]
}
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
}
resource "aws_s3_bucket_policy" "deny_insecure_transport" {
bucket = aws_s3_bucket.main.id
policy = data.aws_iam_policy_document.deny_insecure_transport.json
}
data "aws_iam_policy_document" "main" {
statement {
actions = [