Skip to content

Commit a163b36

Browse files
authored
Merge pull request #153 from OWASP/migrate-1513
Migrate to 1.5.13 of WrongSecrets
2 parents 7c3a4cb + 2422996 commit a163b36

7 files changed

+42
-10
lines changed

aws/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The terraform code is loosely based on [this EKS managed Node Group TF example](
4545
1. export your AWS credentials (`export AWS_PROFILE=awsuser`)
4646
2. check whether you have the right profile by doing `aws sts get-caller-identity` and make sure you have enough rights with the caller its identity and that the actual accountnumber displayed is the account designated for you to apply this TF to.
4747
3. Do `terraform init` (if required, use tfenv to select TF 0.13.1 or higher )
48-
4. The bucket ARN will be asked for in the next 2 steps. Take the one provided to you and add `arn:aws:s3:::` to the start. e.g. ``arn:aws:s3:::terraform-20221208123456789100000001`
48+
4. The bucket ARN will be asked for in the next 2 steps. Take the one provided to you and add `arn:aws:s3:::` to the start. e.g. ``arn:aws:s3:::terraform-20230102231352749300000001`
4949
5. Do `terraform plan`
5050
6. Do `terraform apply`. Note: the apply will take 10 to 20 minutes depending on the speed of the AWS backplane.
5151
7. When creation is done, do `aws eks update-kubeconfig --region eu-west-1 --name wrongsecrets-exercise-cluster --kubeconfig ~/.kube/wrongsecrets`

aws/build-an-deploy-aws.sh

+18
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,24 @@ helm upgrade --install mj ../helm/wrongsecrets-ctf-party \
139139

140140
# Install CTFd
141141

142+
echo "Installing EBS CSI driver"
143+
eksctl create iamserviceaccount \
144+
--name ebs-csi-controller-sa \
145+
--namespace kube-system \
146+
--cluster $CLUSTERNAME \
147+
--attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy \
148+
--approve \
149+
--role-only \
150+
--role-name AmazonEKS_EBS_CSI_DriverRole
151+
--region $AWS_REGION
152+
153+
echo "managing EBS CSI Driver as a separate eks addon"
154+
eksctl create addon --name aws-ebs-csi-driver \
155+
--cluster $CLUSTERNAME \
156+
--service-account-role-arn arn:aws:iam::${ACCOUNT_ID}:role/AmazonEKS_EBS_CSI_DriverRole \
157+
--force \
158+
--region $AWS_REGION
159+
142160
export HELM_EXPERIMENTAL_OCI=1
143161
kubectl create namespace ctfd
144162
helm -n ctfd install ctfd oci://ghcr.io/bman46/ctfd/ctfd \

aws/cleanup-aws-autoscaling-and-helm.sh

+9
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,12 @@ sleep 5 # Prevents race condition - command below may error out because it's sti
5050

5151
aws iam delete-policy \
5252
--policy-arn arn:aws:iam::${ACCOUNT_ID}:policy/AmazonEKSClusterAutoscalerPolicy
53+
54+
55+
echo "Cleanup CSI driver SA"
56+
57+
eksctl delete iamserviceaccount \
58+
--cluster $CLUSTERNAME \
59+
--name ebs-csi-controller-sa \
60+
--namespace kube-system \
61+
--region $AWS_REGION

aws/cluster-autoscaler-policy.json

+9-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"Effect": "Allow",
77
"Action": [
88
"autoscaling:SetDesiredCapacity",
9-
"autoscaling:TerminateInstanceInAutoScalingGroup"
9+
"autoscaling:TerminateInstanceInAutoScalingGroup",
10+
"ec2:DescribeImages",
11+
"ec2:GetInstanceTypesFromInstanceRequirements",
12+
"eks:DescribeNodegroup"
1013
],
1114
"Resource": "*",
1215
"Condition": {
@@ -19,11 +22,13 @@
1922
"Sid": "VisualEditor1",
2023
"Effect": "Allow",
2124
"Action": [
22-
"autoscaling:DescribeAutoScalingInstances",
2325
"autoscaling:DescribeAutoScalingGroups",
24-
"ec2:DescribeLaunchTemplateVersions",
26+
"autoscaling:DescribeAutoScalingInstances",
27+
"autoscaling:DescribeLaunchConfigurations",
28+
"autoscaling:DescribeScalingActivities",
2529
"autoscaling:DescribeTags",
26-
"autoscaling:DescribeLaunchConfigurations"
30+
"ec2:DescribeInstanceTypes",
31+
"ec2:DescribeLaunchTemplateVersions"
2732
],
2833
"Resource": "*"
2934
}

aws/s3-user.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resource "aws_iam_access_key" "state_user_key" {
77
}
88

99
resource "aws_iam_user_policy" "state_user_policy" {
10-
user = aws_iam_user.state_user.id
10+
user = aws_iam_user.state_user.name
1111
policy = data.aws_iam_policy_document.state_user_policy.json
1212
}
1313

aws/terraform.tfvars

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
cluster_version = "1.22"
1+
cluster_version = "1.23"
22
region = "eu-west-1"
3-
# state_bucket_arn = "...."
3+
# state_bucket_arn = "..."

helm/wrongsecrets-ctf-party/values.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ wrongsecrets:
9797
maxInstances: 500
9898
# -- Juice Shop Image to use
9999
image: jeroenwillemsen/wrongsecrets
100-
tag: 1.5.12-no-vault
100+
tag: 1.5.13-no-vault
101101
# -- Change the key when hosting a CTF event. This key gets used to generate the challenge flags. See: https://github.com/OWASP/wrongsecrets#ctf
102102
ctfKey: "[email protected]!9uR_K!NfkkTr"
103103
# -- Specify a custom Juice Shop config.yaml. See the JuiceShop Config Docs for more detail: https://pwning.owasp-juice.shop/part1/customization.html#yaml-configuration-file
@@ -184,7 +184,7 @@ virtualdesktop:
184184
maxInstances: 500
185185
# -- Juice Shop Image to use
186186
image: jeroenwillemsen/wrongsecrets-desktop-k8s
187-
tag: ctf-party1
187+
tag: 1.5.13
188188
repository: commjoenie/wrongSecrets
189189
resources:
190190
request:

0 commit comments

Comments
 (0)