Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create ec2.tf #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Create ec2.tf #3

wants to merge 2 commits into from

Conversation

pasqua1e
Copy link
Owner

No description provided.

Copy link

@bridgecrew bridgecrew bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bridgecrew has found 6 infrastructure configuration errors in this PR ⬇️

region = "us-west-2"
}

resource "aws_security_group" "ssh_traffic" {
Copy link

@bridgecrew bridgecrew bot Sep 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW   AWS resources that support tags do not have Tags
    Resource: aws_security_group.ssh_traffic | ID: BC_AWS_GENERAL_26

How to Fix

resource "aws_security_group" "sg" {
  name = "my-sg"
  ...
+ tags = {
+   Environment = "dev"
+   Owner = "apps-team"
+ }
}

Description

Many different types of AWS resources support tags. Tags allow you to add metadata to a resource to help identify ownership, perform cost / billing analysis, and to enrich a resource with other valuable information, such as descriptions and environment names. While there are many ways that tags can be used, we recommend you follow a tagging practice.

View AWS's recommended tagging best practices here.

}
}

resource "aws_instance" "web_server_instance" {
Copy link

@bridgecrew bridgecrew bot Sep 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW   Instance Metadata Service version 1 is enabled
    Resource: aws_instance.web_server_instance | ID: BC_AWS_GENERAL_31

How to Fix

resource "aws_instance" "example" {
  ...
  instance_type     = "t2.micro"
+   metadata_options {
        ...
+       http_endpoint = "enabled"
+       http_tokens   = "required"
+  }
  ...
}

Description

The Instance Metadata Service (IMDS) is an on-instance component used by code on the instance to securely access instance metadata. You can access instance metadata from a running instance using one of the following methods: * Instance Metadata Service Version 1 (IMDSv1) – a request/response method * Instance Metadata Service Version 2 (IMDSv2) – a session-oriented method

As a request/response method IMDSv1 is prone to local misconfigurations:

  • Open proxies, open NATs and routers, server-side reflection vulnerabilities.
  • One way or another, local software might access local-only data.

Benchmarks

  • FEDRAMP (MODERATE) AC-6

tags = {
Name = "bc_workshop_ec2"
}
}
Copy link

@bridgecrew bridgecrew bot Sep 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
monitoring = true
}
MEDIUM   Detailed monitoring for EC2 instances is disabled
    Resource: aws_instance.web_server_instance | ID: BC_AWS_LOGGING_26

Description

TBA

tags = {
Name = "bc_workshop_ec2"
}
}
Copy link

@bridgecrew bridgecrew bot Sep 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
ebs_optimized = true
}
LOW   EC2 EBS is not optimized
    Resource: aws_instance.web_server_instance | ID: BC_AWS_GENERAL_68

Description

TBA

region = "us-west-2"
}

resource "aws_security_group" "ssh_traffic" {
Copy link

@bridgecrew bridgecrew bot Sep 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL   AWS Security Group allows all traffic on SSH port 22
    Resource: aws_security_group.ssh_traffic | ID: BC_AWS_NETWORKING_1

Description

Security groups are stateful and provide filtering of ingress/egress network traffic to AWS resources. We recommend that security groups do not allow unrestricted ingress access to port 22. Removing unfettered connectivity to remote console services, such as SSH, reduces a server's exposure to risk.

Benchmarks

  • SOC2 CC6.3.3
  • PCI-DSS V3.2 2
  • HIPAA 164.312(E)(1)
  • NIST-800-53 AC-17, CA-3, CA-9, CM-3, SC-2
  • ISO27001 A.10.1.1
  • CIS AWS V1.2 4.1
  • PCI-DSS V3.2.1 1.2.1, 1.3, 2.2.2
  • FEDRAMP (MODERATE) AC-4, SC-7, SC-7(3)
  • CIS AWS V1.3 5.2

}
}

resource "aws_instance" "web_server_instance" {
Copy link

@bridgecrew bridgecrew bot Sep 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH   EBS volumes do not have encrypted launch configurations
    Resource: aws_instance.web_server_instance | ID: BC_AWS_GENERAL_13

How to Fix

resource "aws_launch_configuration" "example" {
  ...
  instance_type = "t2.micro"
+ root_block_device {
+ encrypted     = true
+ }
  ...
}

Description

Amazon Elastic Block Store (EBS) volumes allow you to create encrypted launch configurations when creating EC2 instances and auto scaling. When the entire EBS volume is encrypted, data stored at rest on the volume, disk I/O, snapshots created from the volume, and data in-transit between EBS and EC2 are all encrypted.

Benchmarks

  • PCI-DSS V3.2 3

@pasqua1e pasqua1e closed this Sep 21, 2021
@pasqua1e pasqua1e reopened this Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant