Last active
July 23, 2021 00:30
-
-
Save glennschler/1bae837a85fd43e322abd217e9fd75a5 to your computer and use it in GitHub Desktop.
Algo VPN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# Get secrets from ansible vault | |
ec2credentials=$(ansible-vault view ./aws-secrets.vault.yml | sed -E "s/aws_access_key = ([^ ]+)|aws_secret_key = ([^ ]+)|aws_mfa_serial = ([^ ]+)/\1\2\3/g") | |
export AWS_ACCESS_KEY_ID=$(echo $ec2credentials | cut -d' ' -f1) | |
export AWS_SECRET_ACCESS_KEY=$(echo $ec2credentials | cut -d' ' -f2) | |
exec ./algo $1 -e "aws_mfa_serial=$(echo $ec2credentials | cut -d' ' -f3)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# have the algo playbook prompt for the vault password | |
# vault should store the aws secrets | |
./algo --vault-id @prompt -e @vars/aws_secrets.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment