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

Update actions #483

Open
wants to merge 147 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
bd5a674
Delete .github/workflows directory
jluevan13 Mar 7, 2023
909a3a3
Create main.yml
jluevan13 Mar 7, 2023
2e607ca
test change to s3 file
jluevan13 Mar 7, 2023
172a698
Merge pull request #1 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
b61dabf
test change to s3 file
jluevan13 Mar 7, 2023
cc7e1cd
Merge pull request #2 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
796a1f0
Update main.yml
jluevan13 Mar 7, 2023
10594f3
Update main.yml
jluevan13 Mar 7, 2023
239cdb1
one more change
jluevan13 Mar 7, 2023
9748019
Update main.yml
jluevan13 Mar 7, 2023
b7fcf4b
Update main.yml
jluevan13 Mar 7, 2023
cf6d559
Update main.yml
jluevan13 Mar 7, 2023
012a8e0
one more change
jluevan13 Mar 7, 2023
ea6be73
lets see what happens
jluevan13 Mar 7, 2023
9aa9eeb
Update main.yml
jluevan13 Mar 7, 2023
4fe3460
another one
jluevan13 Mar 7, 2023
781070d
Merge pull request #4 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
a895398
Update main.yml
jluevan13 Mar 7, 2023
aaeae28
another onev2
jluevan13 Mar 7, 2023
e7ac5fc
Merge pull request #5 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
ac7aaa8
Update main.yml
jluevan13 Mar 7, 2023
4ccaefd
another onev3
jluevan13 Mar 7, 2023
5b832de
Merge pull request #6 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
476103a
Update main.yml
jluevan13 Mar 7, 2023
9f2f162
another onev4
jluevan13 Mar 7, 2023
d3bdb02
Merge pull request #7 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
0ea8ab7
Update main.yml
jluevan13 Mar 7, 2023
7ce7d10
another onev4
jluevan13 Mar 7, 2023
e19f0ca
Merge pull request #8 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
6d3ab8a
Update main.yml
jluevan13 Mar 7, 2023
6dfc5c5
another onev5
jluevan13 Mar 7, 2023
7660a71
Merge pull request #9 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
5f87731
Update main.yml
jluevan13 Mar 7, 2023
d7850af
another onev6
jluevan13 Mar 7, 2023
c031dc7
Merge pull request #10 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
6826036
Update main.yml
jluevan13 Mar 7, 2023
7e90771
another onev7
jluevan13 Mar 7, 2023
0390816
Merge pull request #11 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
e8fc457
Update main.yml
jluevan13 Mar 7, 2023
37a6c0a
another onev8
jluevan13 Mar 7, 2023
6be4b2d
Merge pull request #12 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
52bdb50
Update main.yml
jluevan13 Mar 7, 2023
fd9ffbc
another onev8
jluevan13 Mar 7, 2023
d5e6dcd
Merge pull request #13 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
8d5afb1
Update main.yml
jluevan13 Mar 7, 2023
279eab2
another onev8
jluevan13 Mar 7, 2023
c3af2c2
Merge pull request #14 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
753f96e
Update main.yml
jluevan13 Mar 7, 2023
b60dfd5
another onev9
jluevan13 Mar 7, 2023
81e1498
Merge pull request #15 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
bb6ab55
Update main.yml
jluevan13 Mar 7, 2023
538a8e2
another onev9
jluevan13 Mar 7, 2023
5721b49
Merge pull request #16 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
2b24ea5
Update main.yml
jluevan13 Mar 7, 2023
57120ff
Update main.yml
jluevan13 Mar 7, 2023
c5def5d
another onev10
jluevan13 Mar 7, 2023
f89a60a
Merge pull request #17 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
bca9210
another onev11
jluevan13 Mar 7, 2023
e580bd5
Merge pull request #18 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
17af1ed
Update main.yml
jluevan13 Mar 7, 2023
a211bf2
another onev12
jluevan13 Mar 7, 2023
2ad7d56
Merge pull request #19 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
9553e82
another onev13
jluevan13 Mar 7, 2023
174cb09
Merge pull request #20 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
41a014d
Update main.yml
jluevan13 Mar 7, 2023
c6b2144
another onev14
jluevan13 Mar 7, 2023
5c6f932
Merge pull request #21 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
589bca2
soft fail high
jluevan13 Mar 7, 2023
8596a77
Merge pull request #22 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
1ef7c68
hard fail high
jluevan13 Mar 7, 2023
f672453
Merge pull request #23 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
8d05710
info only
jluevan13 Mar 7, 2023
c43bd94
Merge pull request #24 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
5887e14
info only
jluevan13 Mar 7, 2023
8c2330a
Merge pull request #25 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
c27d0e4
soft fail high
jluevan13 Mar 7, 2023
1e71f7e
Merge pull request #26 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
31c9ad9
hard fail high
jluevan13 Mar 7, 2023
7584696
Merge pull request #27 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
6d125f3
hard fail high
jluevan13 Mar 7, 2023
4419b9b
Merge pull request #28 from jluevan13/s3-changes
jluevan13 Mar 7, 2023
45021ad
this is a change
jluevan13 Mar 7, 2023
6ad5390
Update main.yml
jluevan13 Mar 8, 2023
29dbe51
Merge pull request #30 from jluevan13/s3-changes
jluevan13 Mar 8, 2023
831e865
Update main.yml
jluevan13 Mar 8, 2023
883cede
this is a change
jluevan13 Mar 8, 2023
8a3b00c
Merge pull request #31 from jluevan13/s3-changes
jluevan13 Mar 8, 2023
b8bf6c0
Update main.yml
jluevan13 Mar 8, 2023
2ff84b3
this is a change2
jluevan13 Mar 8, 2023
eae175d
Merge pull request #32 from jluevan13/s3-changes
jluevan13 Mar 8, 2023
d55e2c9
Update main.yml
jluevan13 Mar 9, 2023
68086b2
this is a change3
jluevan13 Mar 9, 2023
1b9b508
Merge pull request #33 from jluevan13/s3-changes
jluevan13 Mar 9, 2023
b651d04
this is a change4
jluevan13 Mar 9, 2023
ba6689e
Merge pull request #34 from jluevan13/s3-changes
jluevan13 Mar 9, 2023
e7042fb
this is a change4
jluevan13 Mar 10, 2023
eaf1948
test
jluevan13 Apr 6, 2023
1070cdc
Create main.yml
jluevan13 Mar 7, 2023
cf5f385
Update main.yml
jluevan13 Mar 7, 2023
edf87d9
Update main.yml
jluevan13 Mar 7, 2023
0b9dea6
Update main.yml
jluevan13 Mar 7, 2023
838511e
Update main.yml
jluevan13 Mar 7, 2023
97d7c1e
Update main.yml
jluevan13 Mar 7, 2023
2a5fa9b
Update main.yml
jluevan13 Mar 7, 2023
146ad59
Update main.yml
jluevan13 Mar 7, 2023
e6dad97
Update main.yml
jluevan13 Mar 7, 2023
9277486
Update main.yml
jluevan13 Mar 7, 2023
f40e1f3
Update main.yml
jluevan13 Mar 7, 2023
944f8a8
Update main.yml
jluevan13 Mar 7, 2023
149287d
Update main.yml
jluevan13 Mar 7, 2023
2887f0e
Update main.yml
jluevan13 Mar 7, 2023
fc6fff7
Update main.yml
jluevan13 Mar 7, 2023
6da4974
Update main.yml
jluevan13 Mar 7, 2023
9605df6
Update main.yml
jluevan13 Mar 7, 2023
89d0e05
Update main.yml
jluevan13 Mar 7, 2023
53a41c9
Update main.yml
jluevan13 Mar 7, 2023
8a5982a
Update main.yml
jluevan13 Mar 7, 2023
270ee73
Update main.yml
jluevan13 Mar 7, 2023
d2a8a24
Update main.yml
jluevan13 Mar 7, 2023
ec6305c
Update main.yml
jluevan13 Mar 7, 2023
1b87ad4
Update main.yml
jluevan13 Mar 8, 2023
00c3f12
Update main.yml
jluevan13 Mar 8, 2023
73c5528
Update main.yml
jluevan13 Mar 8, 2023
8b1328e
Update main.yml
jluevan13 Mar 9, 2023
3bf8da0
update
jluevan13 Apr 6, 2023
d0291d7
test
jluevan13 Apr 6, 2023
e32b294
Merge pull request #37 from jluevan13/s3-changes
jluevan13 Apr 6, 2023
00e1cf8
test
jluevan13 Apr 6, 2023
e3e9f4d
update webhost
jluevan13 May 16, 2023
ff615f0
Merge pull request #38 from jluevan13/s3-changes
jluevan13 May 16, 2023
170b969
update webhost
jluevan13 May 16, 2023
040f4e7
add bucket policy
jluevan13 May 30, 2023
8baa7e1
Merge pull request #40 from jluevan13/s3-changes
jluevan13 May 30, 2023
96d1d0a
create public storage container
jluevan13 Jun 5, 2023
e23f5e5
Merge pull request #42 from jluevan13/azure-storage-updates
jluevan13 Jun 6, 2023
3b328c2
comment public blob container
jluevan13 Jun 6, 2023
1226bd1
update ebs volume
jluevan13 Dec 13, 2023
61ab9e3
Merge pull request #47 from jluevan13/azure-storage-updates
jluevan13 Dec 13, 2023
2ac2254
skip web_host_storage encryption check
jluevan13 Dec 13, 2023
129d567
Merge pull request #48 from jluevan13/azure-storage-updates
jluevan13 Dec 13, 2023
714a4b4
add unneeded comment
jluevan13 Dec 13, 2023
60ea30f
update ec2 web host
Feb 14, 2024
4af11b3
update
jluevan13 Jun 2, 2024
2914f0a
Merge pull request #51 from jluevan13/azure-storage-updates
jluevan13 Jun 2, 2024
533d163
ask why is this public
jluevan13 Jun 3, 2024
fbc49dc
Merge pull request #53 from jluevan13/azure-storage-updates
jluevan13 Jun 3, 2024
de54072
update actions
jluevan13 Jun 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions .github/workflows/build.yaml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Prisma Cloud IaC Scan
on:
pull_request:
types:
- closed
jobs:
scan:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Run Bridgecrew
id: Bridgecrew
uses: bridgecrewio/bridgecrew-action@master
env:
PRISMA_API_URL: https://api0.prismacloud.io
with:
api-key: ${{ secrets.BC_API_KEY }}
directory: terraform/azure/
use_enforcement_rules: true


# name: Prisma Cloud IaC Scan with checkov
# on:
# pull_request:
# types:
# - closed
# jobs:
# # if_merged:
# # if: github.event.pull_request.merged == true
# # runs-on: ubuntu-latest
# # steps:
# # - run: |
# # echo The PR was merged
# scan:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: [3.8]
# defaults:
# run:
# working-directory: ./terraform
# steps:
# - name: Checkout repo
# uses: actions/checkout@v2
# - name: Install checkov
# run: pip3 install checkov
# - name: Run checkov
# run: |
# export PRISMA_API_URL=https://api4.prismacloud.io
# checkov -d . --bc-api-key ${{secrets.BC_API_KEY }} --repo-id jluevan13/terragoat-forked --branch master --use-enforcement-rules
16 changes: 0 additions & 16 deletions .github/workflows/pull_request.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/semgrep.yml

This file was deleted.

18 changes: 13 additions & 5 deletions terraform/aws/ec2.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
resource "aws_instance" "web_host" {
# ec2 have plain text secrets in user data
ami = "${var.ami}"
# test change
ami = var.ami
instance_type = "t2.nano"

vpc_security_group_ids = [
"${aws_security_group.web-node.id}"]
subnet_id = "${aws_subnet.web_subnet.id}"
subnet_id = aws_subnet.web_subnet.id
user_data = <<EOF
#! /bin/bash
sudo apt-get update
Expand All @@ -16,6 +17,7 @@ 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 Terraform</h1>" | sudo tee /var/www/html/index.html
d
EOF
tags = merge({
Name = "${local.resource_prefix.value}-ec2"
Expand All @@ -31,8 +33,10 @@ EOF
})
}


resource "aws_ebs_volume" "web_host_storage" {
# unencrypted volume
# delete this
availability_zone = "${var.region}a"
#encrypted = false # Setting this causes the volume to be recreated on apply
size = 1
Expand All @@ -48,11 +52,15 @@ resource "aws_ebs_volume" "web_host_storage" {
git_repo = "terragoat"
yor_trace = "c5509daf-10f0-46af-9e03-41989212521d"
})


}



resource "aws_ebs_snapshot" "example_snapshot" {
# ebs snapshot without encryption
volume_id = "${aws_ebs_volume.web_host_storage.id}"
volume_id = aws_ebs_volume.web_host_storage.id
description = "${local.resource_prefix.value}-ebs-snapshot"
tags = merge({
Name = "${local.resource_prefix.value}-ebs-snapshot"
Expand All @@ -70,8 +78,8 @@ resource "aws_ebs_snapshot" "example_snapshot" {

resource "aws_volume_attachment" "ebs_att" {
device_name = "/dev/sdh"
volume_id = "${aws_ebs_volume.web_host_storage.id}"
instance_id = "${aws_instance.web_host.id}"
volume_id = aws_ebs_volume.web_host_storage.id
instance_id = aws_instance.web_host.id
}

resource "aws_security_group" "web-node" {
Expand Down
22 changes: 11 additions & 11 deletions terraform/aws/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ locals {
}
}

data aws_iam_policy_document "iam_policy_eks" {
data "aws_iam_policy_document" "iam_policy_eks" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole"]
Expand All @@ -15,7 +15,7 @@ data aws_iam_policy_document "iam_policy_eks" {
}
}

resource aws_iam_role "iam_for_eks" {
resource "aws_iam_role" "iam_for_eks" {
name = "${local.resource_prefix.value}-iam-for-eks"
assume_role_policy = data.aws_iam_policy_document.iam_policy_eks.json
tags = {
Expand All @@ -30,17 +30,17 @@ resource aws_iam_role "iam_for_eks" {
}
}

resource aws_iam_role_policy_attachment "policy_attachment-AmazonEKSClusterPolicy" {
resource "aws_iam_role_policy_attachment" "policy_attachment-AmazonEKSClusterPolicy" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
role = aws_iam_role.iam_for_eks.name
}

resource aws_iam_role_policy_attachment "policy_attachment-AmazonEKSServicePolicy" {
resource "aws_iam_role_policy_attachment" "policy_attachment-AmazonEKSServicePolicy" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSServicePolicy"
role = aws_iam_role.iam_for_eks.name
}

resource aws_vpc "eks_vpc" {
resource "aws_vpc" "eks_vpc" {
cidr_block = "10.10.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true
Expand All @@ -58,7 +58,7 @@ resource aws_vpc "eks_vpc" {
})
}

resource aws_subnet "eks_subnet1" {
resource "aws_subnet" "eks_subnet1" {
vpc_id = aws_vpc.eks_vpc.id
cidr_block = "10.10.10.0/24"
availability_zone = "${var.region}a"
Expand Down Expand Up @@ -86,7 +86,7 @@ resource aws_subnet "eks_subnet1" {
})
}

resource aws_subnet "eks_subnet2" {
resource "aws_subnet" "eks_subnet2" {
vpc_id = aws_vpc.eks_vpc.id
cidr_block = "10.10.11.0/24"
availability_zone = "${var.region}b"
Expand Down Expand Up @@ -114,9 +114,9 @@ resource aws_subnet "eks_subnet2" {
})
}

resource aws_eks_cluster "eks_cluster" {
resource "aws_eks_cluster" "eks_cluster" {
name = local.eks_name.value
role_arn = "${aws_iam_role.iam_for_eks.arn}"
role_arn = aws_iam_role.iam_for_eks.arn

vpc_config {
endpoint_private_access = true
Expand All @@ -140,9 +140,9 @@ resource aws_eks_cluster "eks_cluster" {
}

output "endpoint" {
value = "${aws_eks_cluster.eks_cluster.endpoint}"
value = aws_eks_cluster.eks_cluster.endpoint
}

output "kubeconfig-certificate-authority-data" {
value = "${aws_eks_cluster.eks_cluster.certificate_authority.0.data}"
value = aws_eks_cluster.eks_cluster.certificate_authority.0.data
}
25 changes: 25 additions & 0 deletions terraform/aws/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resource "aws_s3_bucket" "data" {
# bucket is not encrypted
# bucket does not have access logs
# bucket does not have versioning
# test update
bucket = "${local.resource_prefix.value}-data"
force_destroy = true
tags = merge({
Expand Down Expand Up @@ -139,3 +140,27 @@ resource "aws_s3_bucket" "logs" {
yor_trace = "01946fe9-aae2-4c99-a975-e9b0d3a4696c"
})
}

resource "aws_s3_bucket_policy" "allow_access_from_another_account" {
bucket = aws_s3_bucket.logs.id
policy = data.aws_iam_policy_document.allow_access_from_another_account.json
}

data "aws_iam_policy_document" "allow_access_from_another_account" {
statement {
principals {
type = "AWS"
identifiers = ["123456789012"]
}

actions = [
"s3:GetObject",
"s3:ListBucket",
]

resources = [
aws_s3_bucket.example.arn,
"${aws_s3_bucket.example.arn}/*",
]
}
}
4 changes: 2 additions & 2 deletions terraform/azure/aks.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource azurerm_kubernetes_cluster "k8s_cluster" {
resource "azurerm_kubernetes_cluster" "k8s_cluster" {
dns_prefix = "terragoat-${var.environment}"
location = var.location
name = "terragoat-aks-${var.environment}"
Expand Down Expand Up @@ -32,4 +32,4 @@ resource azurerm_kubernetes_cluster "k8s_cluster" {
git_repo = "terragoat"
yor_trace = "6103d111-864e-42e5-899c-1864de281fd1"
}
}
}
6 changes: 3 additions & 3 deletions terraform/azure/app_service.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource azurerm_app_service_plan "example" {
resource "azurerm_app_service_plan" "example" {
name = "terragoat-app-service-plan-${var.environment}"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
Expand All @@ -19,7 +19,7 @@ resource azurerm_app_service_plan "example" {
}
}

resource azurerm_app_service "app-service1" {
resource "azurerm_app_service" "app-service1" {
app_service_plan_id = azurerm_app_service_plan.example.id
location = var.location
name = "terragoat-app-service-${var.environment}${random_integer.rnd_int.result}"
Expand All @@ -40,7 +40,7 @@ resource azurerm_app_service "app-service1" {
}
}

resource azurerm_app_service "app-service2" {
resource "azurerm_app_service" "app-service2" {
app_service_plan_id = azurerm_app_service_plan.example.id
location = var.location
name = "terragoat-app-service-${var.environment}${random_integer.rnd_int.result}"
Expand Down
11 changes: 7 additions & 4 deletions terraform/azure/networking.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
resource "azurerm_virtual_network" "example" {
# commentzz
# new comment
name = "terragoat-vn-${var.environment}"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.example.location
Expand Down Expand Up @@ -66,7 +68,7 @@ resource "azurerm_network_interface" "ni_win" {
}
}

resource azurerm_network_security_group "bad_sg" {
resource "azurerm_network_security_group" "bad_sg" {
location = var.location
name = "terragoat-${var.environment}"
resource_group_name = azurerm_resource_group.example.name
Expand Down Expand Up @@ -106,7 +108,7 @@ resource azurerm_network_security_group "bad_sg" {
}
}

resource azurerm_network_watcher "network_watcher" {
resource "azurerm_network_watcher" "network_watcher" {
location = var.location
name = "terragoat-network-watcher-${var.environment}"
resource_group_name = azurerm_resource_group.example.name
Expand All @@ -122,7 +124,8 @@ resource azurerm_network_watcher "network_watcher" {
}
}

resource azurerm_network_watcher_flow_log "flow_log" {
resource "azurerm_network_watcher_flow_log" "flow_log" {
name = "test-flow-log-name"
enabled = false
network_security_group_id = azurerm_network_security_group.bad_sg.id
network_watcher_name = azurerm_network_watcher.network_watcher.name
Expand All @@ -142,4 +145,4 @@ resource azurerm_network_watcher_flow_log "flow_log" {
git_repo = "terragoat"
yor_trace = "33a7212e-7f1a-49fc-af73-8e525c5546ec"
}
}
}
Loading