-
Notifications
You must be signed in to change notification settings - Fork 7
Arielkru patch 9 #65
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
base: master
Are you sure you want to change the base?
Arielkru patch 9 #65
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| AWSTemplateFormatVersion: '2010-09-09' | ||
| Description: AWS CloudFormation Template to deploy insecure infrastructure | ||
|
|
||
| Parameters: | ||
| CompanyName: | ||
| Description: Company Name | ||
|
|
||
| Type: String | ||
| Default: acme | ||
| Environment: | ||
| Description: Environment | ||
| Type: String | ||
|
|
||
| Default: dev | ||
| DBName: | ||
| Description: Name of the Database | ||
| Type: String | ||
|
|
||
| Default: db1 | ||
| Password: | ||
| Description: Database Password | ||
| Type: String | ||
| NoEcho: True | ||
|
|
||
| MinLength: 1 | ||
| MaxLength: 41 | ||
|
|
||
| AllowedPattern: ^[a-zA-Z0-9]*$ | ||
| LatestAmiId: | ||
| Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> | ||
| Default: /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 | ||
|
|
||
|
|
||
| Resources: | ||
| #################### | ||
| ### EC2 in VPC ### | ||
| #################### | ||
| EC2Instance: | ||
| Type: AWS::EC2::Instance | ||
| Properties: | ||
| AvailabilityZone: | ||
|
|
||
| Fn::Select: | ||
| - 0 | ||
| - Fn::GetAZs: "" | ||
|
|
||
| InstanceType: t2.nano | ||
| SecurityGroupIds: | ||
|
|
||
| - !Ref WebNodeSG | ||
| ImageId: !Ref LatestAmiId | ||
| SubnetId: !Ref WebSubnet | ||
|
|
||
| Tags: | ||
| - Key: Name | ||
| Value: !Sub "${AWS::AccountId}-${CompanyName}-${Environment}-ec2" | ||
| UserData: | ||
| Fn::Base64: | | ||
| #!/bin/bash | ||
| sudo yum -y update | ||
| sudo yum -y install httpd php php-mysqlnd | ||
| sudo systemctl enable httpd | ||
| sudo systemctl start httpd | ||
| export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMAAA | ||
| export AWS_SECRET_ACCESS_KEY=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 | ||
| export AWS_DEFAULT_REGION=us-west-2 | ||
| echo "<h1>Deployed via CloudFormation</h1>" | sudo tee /var/www/html/index.html | ||
|
|
||
| WebHostStorage: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| # Unencrypted Volume | ||
|
|
||
| Type: AWS::EC2::Volume | ||
| Properties: | ||
| AvailabilityZone: !Select | ||
| - 0 | ||
|
|
||
| - Fn::GetAZs: "" | ||
| #Encrypted: False | ||
| Size: 1 | ||
|
|
||
| Tags: | ||
| - Key: Name | ||
| Value: !Sub "${AWS::AccountId}-${CompanyName}-${Environment}-ebs" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| AWSTemplateFormatVersion: '2010-09-09' | ||
| Description: AWS CloudFormation Template to deploy insecure infrastructure | ||
|
|
||
| Parameters: | ||
| CompanyName: | ||
| Description: Company Name | ||
|
|
||
| Type: String | ||
| Default: acme | ||
| Environment: | ||
| Description: Environment | ||
| Type: String | ||
|
|
||
| Default: dev | ||
| DBName: | ||
| Description: Name of the Database | ||
| Type: String | ||
|
|
||
| Default: db1 | ||
| Password: | ||
| Description: Database Password | ||
| Type: String | ||
| NoEcho: True | ||
|
|
||
| MinLength: 1 | ||
| MaxLength: 41 | ||
|
|
||
| AllowedPattern: ^[a-zA-Z0-9]*$ | ||
| LatestAmiId: | ||
| Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> | ||
| Default: /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 | ||
|
|
||
|
|
||
| Resources: | ||
| #################### | ||
| ### EC2 in VPC ### | ||
| #################### | ||
| EC2Instance: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| Type: AWS::EC2::Instance | ||
| Properties: | ||
| AvailabilityZone: | ||
|
|
||
| Fn::Select: | ||
| - 0 | ||
| - Fn::GetAZs: "" | ||
|
|
||
| InstanceType: t2.nano | ||
| SecurityGroupIds: | ||
|
|
||
| - !Ref WebNodeSG | ||
| ImageId: !Ref LatestAmiId | ||
| SubnetId: !Ref WebSubnet | ||
|
|
||
| Tags: | ||
| - Key: Name | ||
| Value: !Sub "${AWS::AccountId}-${CompanyName}-${Environment}-ec2" | ||
| UserData: | ||
| Fn::Base64: | | ||
| #!/bin/bash | ||
| sudo yum -y update | ||
| sudo yum -y install httpd php php-mysqlnd | ||
| sudo systemctl enable httpd | ||
| sudo systemctl start httpd | ||
| export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMAAA | ||
| export AWS_SECRET_ACCESS_KEY=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 | ||
| export AWS_DEFAULT_REGION=us-west-2 | ||
| echo "<h1>Deployed via CloudFormation</h1>" | sudo tee /var/www/html/index.html | ||
|
|
||
| WebHostStorage: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| # Unencrypted Volume | ||
|
|
||
| Type: AWS::EC2::Volume | ||
| Properties: | ||
| AvailabilityZone: !Select | ||
| - 0 | ||
|
|
||
| - Fn::GetAZs: "" | ||
| #Encrypted: False | ||
| Size: 1 | ||
|
|
||
| Tags: | ||
| - Key: Name | ||
| Value: !Sub "${AWS::AccountId}-${CompanyName}-${Environment}-ebs" | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resource: AWS::EC2::Instance.EC2Instance | ID:
BC_AWS_SECRETS_1Description
**User Data** is a metadata field of an EC2 instance that allows custom code to run after the instance is launched. It contains code exposed to any entity which has the most basic access to EC2, even read-only configurations. This code is not encrypted.Removing secrets from easily-accessed unencrypted places reduces the risk of passwords, private keys and more from being exposed to third parties.