Skip to content

Commit f7f3c7b

Browse files
committed
added some more fixes, now for AWS as well
1 parent 800f2c2 commit f7f3c7b

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

aws/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ The terraform code is loosely based on [this EKS managed Node Group TF example](
4848
5. Do `terraform apply`. Note: the apply will take 10 to 20 minutes depending on the speed of the AWS backplane.
4949
6. When creation is done, do `aws eks update-kubeconfig --region eu-west-1 --name wrongsecrets-exercise-cluster --kubeconfig ~/.kube/wrongsecrets`
5050
7. Do `export KUBECONFIG=~/.kube/wrongsecrets`
51-
8. Run `cd .. && ./build-an-deploy-aws.sh` to install the helm chart for the wrongsecrets-ctf-party.
51+
8. Run `cd ..`
52+
9. Run `./build-an-deploy-aws.sh` to install the helm chart for the wrongsecrets-ctf-party.
5253

5354
Your EKS cluster should be visible in [EU-West-1](https://eu-west-1.console.aws.amazon.com/eks/home?region=eu-west-1#/clusters) by default. Want a different region? You can modify `terraform.tfvars` or input it directly using the `region` variable in plan/apply.
5455

aws/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ module "eks" {
7777

7878
enable_irsa = true
7979

80+
# apply when available: iam_role_permissions_boundary = "arn:aws:iam::${local.account_id}:policy/service-user-creation-permission-boundary"
8081
eks_managed_node_group_defaults = {
8182
disk_size = 50
8283
disk_type = "gp3"
8384
disk_throughput = 150
8485
disk_iops = 3000
8586
instance_types = ["t3a.xlarge"]
8687

87-
#todo: ADD iam_role_permissions_boundary = "arn"
8888
iam_role_additional_policies = [
8989
"arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy",
9090
"arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy",

build-an-deploy-aws.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ echo "Usage: ./build-and-deploy-aws.sh"
1010
version="$(uuidgen)"
1111
AWS_REGION="eu-west-1"
1212

13-
helm install -n kube-system csi-secrets-store secrets-store-csi-driver/secrets-store-csi-driver --set enableSecretRotation=true --set rotationPollInterval=60s
13+
helm upgrade -n kube-system csi-secrets-store secrets-store-csi-driver/secrets-store-csi-driver --set enableSecretRotation=true --set rotationPollInterval=60s
1414
echo "Install ACSP"
1515
kubectl apply -f https://raw.githubusercontent.com/aws/secrets-store-csi-driver-provider-aws/main/deployment/aws-provider-installer.yaml
1616

17+
echo "preparing calico via Helm"
18+
helm repo add projectcalico https://docs.projectcalico.org/charts
19+
helm upgrade calico projectcalico/tigera-operator --version v3.21.4
20+
21+
1722
echo "Generate secrets manager challenge secret 2"
1823
aws secretsmanager put-secret-value --secret-id wrongsecret-2 --secret-string "$(openssl rand -base64 24)" --region $AWS_REGION --output json --no-cli-pager
1924

@@ -24,4 +29,4 @@ aws ssm put-parameter --name wrongsecretvalue --overwrite --type SecureString --
2429
wait
2530

2631
#TODO: REWRITE ABOVE, REWRITE THE HARDCODED DEPLOYMENT VALS INTO VALUES AND OVERRIDE THEM HERE!
27-
helm upgrade --install mj ./helm/wrongsecrets-ctf-party --set="imagePullPolicy=Always" --set="balancer.env.K8S_ENV=aws" --set="balancer.repository=jeroenwillemsen/wrongsecrets-balancer" --set="balancer.tag=0.74aws" --set="wrongsecretsCleanup.repository=jeroenwillemsen/wrongsecrets-ctf-cleaner" --set="wrongsecretsCleanup.tag=0.2"
32+
helm upgrade --install mj ./helm/wrongsecrets-ctf-party --set="imagePullPolicy=Always" --set="balancer.env.K8S_ENV=aws" --set="balancer.repository=jeroenwillemsen/wrongsecrets-balancer" --set="balancer.tag=0.76aws" --set="wrongsecretsCleanup.repository=jeroenwillemsen/wrongsecrets-ctf-cleaner" --set="wrongsecretsCleanup.tag=0.2"

helm/wrongsecrets-ctf-party/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ balancer:
3535
# -- Set this to a fixed random alpa-numeric string (recommended length 24 chars). If not set this get randomly generated with every helm upgrade, each rotation invalidates all active cookies / sessions requirering users to login again.
3636
cookieParserSecret: null
3737
repository: jeroenwillemsen/wrongsecrets-balancer
38-
tag: 0.74aws
38+
tag: 0.76aws
3939
# -- Number of replicas of the wrongsecrets-balancer deployment
4040
replicas: 1
4141
service:

wrongsecrets-balancer/src/teams/teams.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,17 @@ async function createAWSTeam(req, res) {
387387
);
388388
res.status(500).send({ message: 'Failed to Create Instance' });
389389
}
390+
391+
try {
392+
logger.info(`Creating network security policies for team '${team}'`);
393+
await createNSPsforTeam(team);
394+
395+
logger.info(`Created network security policies for team '${team}'`);
396+
} catch (error) {
397+
logger.error(`Error while network security policies for team ${team}: ${error}`);
398+
res.status(500).send({ message: 'Failed to Create Instance' });
399+
}
400+
390401
try {
391402
loginCounter.inc({ type: 'registration', userType: 'user' }, 1);
392403

0 commit comments

Comments
 (0)