8000 GitHub - ethan-1106/wrongsecrets: Examples with how to not use secrets · GitHub
[go: up one dir, main page]

Skip to content

About

Examples with how to not use secrets

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

144 Commits

Folders and files

Repository files navigation

Wrong Secrets

Java checkstyle and testing Terraform FMT Test minikube script

Welcome to the Wrong Secrets p0wnable app. With this app we have packed various ways of how to not store your secrets. These can help you to realize whether your secret management is ok. The challenge is to find all the different secrets by means of various tools and techniques.

Can you solve all the challenges?

Basic docker exercises

For the basic docker exercises you currently require:

You can install it by doing:

docker run -p 8080:8080 jeroenwillemsen/addo-example:0.0.1-no-vault

Now you can try to find the secrets by means of solving the challenge offered at:

Note that these challenges are still very basic, and so are their explanations. Feel free to file a PR to make them look better ;-).

Basic K8s exercise

Minikube based

Make sure you have the following installed:

The K8S setup currently is based on using Minikube for local fun:

    minikube start
    kubectl apply -f k8s/secrets-config.yml
    kubectl apply -f k8s/secrets-secret.yml
    kubectl apply -f k8s/secret-challe
8000
nge-deployment.yml
    while [[ $(kubectl get pods -l app=secret-challenge -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for secret-challenge" && sleep 2; done
    kubectl expose deployment secret-challenge --type=LoadBalancer --port=8080
    minikube service secret-challenge

now you can use the provided ip-address and port to further play with the K8s variant (instead of localhost).

EKS Based

Follow the steps in the README in the AWS subfolder.

k8s based

Want to run vanilla on your own k8s? Use the commands below:

    kubectl apply -f k8s/secrets-config.yml
    kubectl apply -f k8s/secrets-secret.yml
    kubectl apply -f k8s/secret-challenge-deployment.yml
    while [[ $(kubectl get pods -l app=secret-challenge -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for secret-challenge" && sleep 2; done
    kubectl port-forward \
        $(kubectl get pod -l app=secret-challenge -o jsonpath="{.items[0].metadata.name}") \
        8080:8080

Vault exercises with minikube

Make sure you have the following installed:

Run ./k8s-vault-minkube-start.sh, when the script is done, then the challenge will wait for you at http://localhost:8080

Cloud based exercise

Have a look at the aws folder, Note that we are not done yet.

Special thanks & Contributors

With thanks to @madhuakula for motivating me to setup the project, and thanks to @bendehaan & @nbaars for contributing to the project.

Help Wanted

Ofcourse we can always use your help to getmore flavors of "wrongly" configured secrets in to spread awareness! We would love to get some help with a Google Cloud or Azure integration for instance. Do you miss something else than a cloud-provider as an example? File an issue or create a PR!

Notes on development

If you want to test against vault without K8s: start vault locally with

 export VAULT_ADDR='http://127.0.0.1:8200'
 export VAULT_API_ADDR='http://127.0.0.1:8200'
 vault server -dev

and in your next terminal, do (with the token from the previous commands):

export VAULT_ADDR='http://127.0.0.1:8200'
export VAULT_TOKEN='<TOKENHERE>'
vault token create -id="00000000-0000-0000-0000-000000000000" -policy="root"
vault kv put secret/secret-challenge vaultpassword.password="$(openssl rand -base64 16)"

Now use the local-vault profile to do you development.

If you want to dev without a Vault instance, use the without-vault profile to do your development.

Want to push a container? See .github/scripts/docker-create-and-push.sh for a script that generates and pushes all containers. Do not forget to rebuild the app before composing the container

About

Examples with how to not use secrets

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0