Skip to content

Commit 41f8627

Browse files
committed
Edit balancer ui
Signed-off-by: osamamagdy <[email protected]>
1 parent 447f858 commit 41f8627

File tree

9 files changed

+46
-16
lines changed

9 files changed

+46
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ db.zip
2020
*.auto.tfvars
2121
node_modules
2222
.npm
23+
gcp/k8s/secret-volume.yml

azure/build-and-deploy-azure.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export AZ_VAULT_URI="$(terraform output -raw vault_uri)"
5757
export AZ_KEY_VAULT_TENANT_ID="$(terraform output -raw tenant_id)"
5858
export AZ_KEY_VAULT_NAME="$(terraform output -raw vault_name)"
5959

60+
export AZ_STORAGE_ACCOUNT="$(terraform output -chdir=./shared-state -raw storage_account_name)"
61+
6062
# Set the kubeconfig
6163
az aks get-credentials --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME
6264

@@ -150,6 +152,7 @@ echo "You can find the app password in password.txt"
150152

151153
helm upgrade --install mj ../helm/wrongsecrets-ctf-party \
152154
--set="balancer.env.K8S_ENV=azure" \
155+
--set="balancer.env.REACT_APP_AZ_BLOB_URL=https://${AZ_STORAGE_ACCOUNT}.blob.core.windows.net/tfstate" \
153156
--set="balancer.env.REACT_APP_ACCESS_PASSWORD=${APP_PASSWORD}" \
154157
--set="balancer.env.REACT_APP_CREATE_TEAM_HMAC_KEY=${CREATE_TEAM_HMAC}" \
155158
--set="balancer.env.AZ_KEY_VAULT_NAME=${AZ_KEY_VAULT_NAME}" \

azure/shared-state/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ terraform {
33
required_providers {
44
azurerm = {
55
version = "~> 3.0"
6+
source = "hashicorp/azurerm"
67
}
78
random = {
89
version = "~> 3.0"
10+
source = "hashicorp/random"
911
}
1012
}
1113
}
@@ -16,7 +18,7 @@ provider "azurerm" {
1618
}
1719

1820
# If you're using an existing resource group, modify this part. That'll definitely be the case if you're using shared state!
19-
# Note that you'll need to find/replace references to "arurerm_resource_group.default" to "data.azurerm_resource_group.default"
21+
# Note that you'll need to find/replace references to "azurerm_resource_group.default" to "data.azurerm_resource_group.default"
2022
#data "azurerm_resource_group" "default" {
2123
# name = "owasp-wrongsecrets"
2224
#}

gcp/build-and-deploy-gcp.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ echo "This is a script to bootstrap the configuration. You need to have installe
3535

3636
export GCP_PROJECT=$(gcloud config list --format 'value(core.project)' 2>/dev/null)
3737

38+
export GCP_BUCKET_NAME="$(terraform -chdir=./shared-state output -raw bucket)"
39+
3840
# Patch the default namespace to use the secrets store CSI driver
3941

4042
echo "Setting up workspace PSA to restricted for default"
@@ -102,11 +104,12 @@ echo "You can find the app password in password.txt"
102104

103105
helm upgrade --install mj ../helm/wrongsecrets-ctf-party \
104106
--set="balancer.env.K8S_ENV=gcp" \
107+
--set="balancer.env.REACT_APP_GCP_BUCKET_URL=https://console.cloud.google.com/storage/browser/${GCP_BUCKET_NAME}" \
105108
--set="balancer.env.REACT_APP_ACCESS_PASSWORD=${APP_PASSWORD}" \
106109
--set="balancer.env.REACT_APP_CREATE_TEAM_HMAC_KEY=${CREATE_TEAM_HMAC}" \
107110
--set="balancer.cookie.cookieParserSecret=${COOKIE_PARSER_SECRET}" \
108111
--set="balancer.env.GCP_PROJECT_ID=${GCP_PROJECT}" \
109-
--set="balancer.repository=osamamagdy/wrongsecrets-balancer" \
112+
110113

111114
kubectl annotate serviceaccount \
112115
--namespace default wrongsecrets-balancer \

gcp/k8s/secret-volume.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

helm/wrongsecrets-ctf-party/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ Run Multi User "Capture the Flags" or Security Trainings with OWASP Wrongsecrets
8484
| balancer.env.IRSA_ROLE | string | `"arn:aws:iam::233483431651:role/wrongsecrets-secret-manager"` | |
8585
| balancer.env.K8S_ENV | string | `"k8s"` | |
8686
| balancer.env.REACT_APP_ACCESS_PASSWORD | string | `""` | |
87+
| balancer.env.REACT_APP_AZ_BLOB_URL | string | `"az://funstuff"` | |
8788
| balancer.env.REACT_APP_CREATE_TEAM_HMAC_KEY | string | `"hardcodedkey"` | |
8889
| balancer.env.REACT_APP_CTFD_URL | string | `"https://ctfd.io"` | |
90+
| balancer.env.REACT_APP_GCP_BUCKET_URL | string | `"gs://funstuff"` | |
8991
| balancer.env.REACT_APP_HEROKU_WRONGSECRETS_URL | string | `"https://wrongsecrets-ctf.herokuapp.com"` | |
9092
| balancer.env.REACT_APP_MOVING_GIF_LOGO | string | `"https://i.gifer.com/9kGQ.gif"` | |
9193
| balancer.env.REACT_APP_S3_BUCKET_URL | string | `"s3://funstuff"` | |

helm/wrongsecrets-ctf-party/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ balancer:
9191
REACT_APP_MOVING_GIF_LOGO: "https://i.gifer.com/9kGQ.gif" #displayed at the frontend when you enter the CTF
9292
REACT_APP_HEROKU_WRONGSECRETS_URL: "https://wrongsecrets-ctf.herokuapp.com" #required for 3 domain setup
9393
REACT_APP_CTFD_URL: "https://ctfd.io" #requierd for 2 and 3 domain setup
94-
REACT_APP_S3_BUCKET_URL: "s3://funstuff" #the s3 bucket you use for teh aws challenges, don't forget to make it accessible!
94+
REACT_APP_S3_BUCKET_URL: "s3://funstuff" #the s3 bucket you use for the aws challenges, don't forget to make it accessible!
95+
REACT_APP_GCP_BUCKET_URL: "gs://funstuff" #the gcp bucket you use for the gcp challenges, don't forget to make it accessible!
96+
REACT_APP_AZ_BLOB_URL: "az://funstuff" #the azure blob storage you use for the azure challenges, don't forget to make it accessible!
9597
K8S_ENV: "k8s" #or 'aws', 'azure', or 'gcp'
9698
REACT_APP_ACCESS_PASSWORD: "" #DEFAULT NO PASSWORD, PLAYING THIS IN PUBLIC? PUT A FANCY STRING HERE, BUT BE GENTLE: USERS NEED TO BE ABLE TO COPY THAT STUFF...
9799
REACT_APP_CREATE_TEAM_HMAC_KEY: "hardcodedkey"

wrongsecrets-balancer/src/app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,12 @@ app.get('/balancer/dynamics', (req, res) => {
6363
}
6464
res.json({
6565
react_gif_logo: process.env['REACT_APP_MOVING_GIF_LOGO'],
66+
k8s_env: process.env['K8S_ENV'],
6667
heroku_wrongsecret_ctf_url: process.env['REACT_APP_HEROKU_WRONGSECRETS_URL'],
6768
ctfd_url: process.env['REACT_APP_CTFD_URL'],
6869
s3_bucket_url: process.env['REACT_APP_S3_BUCKET_URL'],
70+
azure_blob_url: process.env['REACT_APP_AZ_BLOB_URL'],
71+
gcp_bucket_url: process.env['REACT_APP_GCP_BUCKET_URL'],
6972
hmac_key: process.env['REACT_APP_CREATE_TEAM_HMAC_KEY'] || 'hardcodedkey',
7073
enable_password: usePassword,
7174
});

wrongsecrets-balancer/ui/src/pages/JoinPage.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ export const JoinPage = injectIntl(({ intl }) => {
9696
const initialDynamics = {
9797
// type all the fields you need
9898
react_gif_logo: 'https://i.gifer.com/9kGQ.gif',
99+
k8s_env: process.env['K8S_ENV'],
99100
heroku_wrongsecret_ctf_url: process.env['REACT_APP_HEROKU_WRONGSECRETS_URL'],
100101
ctfd_url: process.env['REACT_APP_CTFD_URL'],
101102
s3_bucket_url: process.env['REACT_APP_S3_BUCKET_URL'],
103+
azure_blob_url: process.env['REACT_APP_AZ_BLOB_URL'],
104+
gcp_bucket_url: process.env['REACT_APP_GCP_BUCKET_URL'],
102105
hmac_key: process.env['REACT_APP_CREATE_TEAM_HMAC_KEY'],
103106
enable_password: false,
104107
};
@@ -156,14 +159,37 @@ export const JoinPage = injectIntl(({ intl }) => {
156159
{dynamics.ctfd_url}
157160
</a>
158161
</li>
162+
{dynamics.k8s_env === 'aws' ? (
159163
<li>
160-
Optionally: the storage bucket with Terraform state for the cloud challenges:{' '}
164+
Optionally: the aws storage bucket with Terraform state for the cloud challenges:{' '}
161165
<a href={dynamics.s3_bucket_url}>
162166
{dynamics.s3_bucket_url}
163167
</a>
164168
. For this you will need credentials that will be provided to you as part of the CTF
165169
instructions.
166170
</li>
171+
) : null }
172+
{dynamics.k8s_env === 'azure' ? (
173+
<li>
174+
Optionally: the azure storage bucket with Terraform state for the cloud challenges:{' '}
175+
<a href={dynamics.azure_blob_url}>
176+
{dynamics.azure_blob_url}
177+
</a>
178+
. For this you will need credentials that will be provided to you as part of the CTF
179+
instructions.
180+
</li>
181+
) : null }
182+
{dynamics.k8s_env === 'gcp' ? (
183+
<li>
184+
Optionally: the gcp storage bucket with Terraform state for the cloud challenges:{' '}
185+
<a href={dynamics.gcp_bucket_url}>
186+
{dynamics.gcp_bucket_url}
187+
</a>
188+
. For this you will need credentials that will be provided to you as part of the CTF
189+
instructions.
190+
</li>
191+
) : null }
192+
167193
</ul>
168194
<FormattedMessage
169195
id="welcome_text_2"

0 commit comments

Comments
 (0)