1 |
for secret_name in `aws secretsmanager list-secrets --region eu-central-1 --output json | jq -r '.SecretList[].Name'`; do echo "=============" && echo "" && echo $secret_name && aws secretsmanager get-secret-value --secret-id $secret_name --region eu-central-1 --output json | jq -r '.SecretString | fromjson | keys_unsorted[]'; done |
результат такой:
Thank you for reading this post, don't forget to subscribe!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
stage/service/block DB_PASSWORD API_KEY BASE64_API_PRIVATE_KEY SCAN_API_KEY SCAN_API_KEY ============= stage/service/account DB_PASSWORD VAULT_API_TOKEN FIREBASE_PRIVATE_KEY_ID FIREBASE_PRIVATE_KEY ============= stage/service/auth AWS_SNS_ACCESS_KEY_ID AWS_SNS_SECRET_ACCESS_KEY API_KEY API_SECRET JWT_SECRET DB_PASSWORD VAULT_API_TOKEN ============= stage/service/api-gateway API_KEY BASE64_API_PRIVATE_KEY |
Посмотреть все секреты и их значения с нормальным выводом:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
max_key_length=0 for secret_name in $(aws secretsmanager list-secrets --region eu-central-1 --output json | jq -r '.SecretList[].Name'); do echo "====================" echo "Secret Name: $secret_name" secret_value=$(aws secretsmanager get-secret-value --secret-id $secret_name --region eu-central-1 --output json | jq -r '.SecretString | fromjson') for key in $(echo "$secret_value" | jq -r 'keys_unsorted[]'); do value=$(echo "$secret_value" | jq -r ".$key") key_length=${#key} if [ $key_length -gt $max_key_length ]; then max_key_length=$key_length fi done for key in $(echo "$secret_value" | jq -r 'keys_unsorted[]'); do value=$(echo "$secret_value" | jq -r ".$key") printf "%-${max_key_length}s %s\n" "$key" "$value" done echo "" done |
вот результат:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
==================== Secret Name: dev/service/indexer API_HOST !!!https://thr URL !!!https://dim DB_PASSWORD GyY08iymg CLICKHOUSE_DATABASE default CLICKHOUSE_HOST ppi1lf CLICKHOUSE_PORT 8443 CLICKHOUSE_USER default CLICKHOUSE_PROTOCOL HTTPS CLICKHOUSE_PASSWORD OsdwK CH_MIGRATIONS_HOST https://ppi1 CH_MIGRATIONS_USER default CH_MIGRATIONS_PASSWORD OsdwK ==================== Secret Name: dev/jaeger elastic b8LAVSvX ==================== Secret Name: dev/service/reports DB_PASSWORD hXM6p3jCd8dHZ RMQ_PASSWORD akjhk AWS_ACCESS_KEY_ID AKIAL AWS_SECRET_ACCESS_KEY dO1zS |