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:
1 parent
a276eb6a98
commit
7b381e0bbb
25 files changed
+503
-175
No files matched your search
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user