From 8edbcfacdffec0ce21b42cf38108cbf357d2d6bb Mon Sep 17 00:00:00 2001 From: sthope Date: Mon, 6 Sep 2021 15:32:20 +0200 Subject: [PATCH] Add 'yq/ha_faking_secrets_with_docker.sh' --- yq/ha_faking_secrets_with_docker.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 yq/ha_faking_secrets_with_docker.sh diff --git a/yq/ha_faking_secrets_with_docker.sh b/yq/ha_faking_secrets_with_docker.sh new file mode 100644 index 0000000..f6603f7 --- /dev/null +++ b/yq/ha_faking_secrets_with_docker.sh @@ -0,0 +1,27 @@ +################################### +############ by Sthope ############ +################################### + +## nano ~/.bashrc +## and add this to the end of the file: export PATH=$PATH:~/bin +## sudo chmod +x ~/bin/*;su -l $USER + +#### USAGE +# +# + +yq() { + docker run --rm -i -v "${PWD}":/workdir mikefarah/yq "$@" +} + +### fake passwords +yq eval '.[] = "fake_password"' secrets.yaml > fake_pwds.yaml + +### fake ips +yq eval '(.[] | select(. == "*.*.*.*")) |= "127.0.0.1"' secrets.yaml > fake_ips.yaml + +### merging all into one +yq eval-all 'select(fi == 0) * select(filename == "fake_ips.yaml")' fake_pwds.yaml fake_ips.yaml > fake_secrets.yaml + +### clean up.. +rm fake_pwds.yaml fake_ips.yaml \ No newline at end of file