git alias and ansible-vault hack

- git alias to push to all remote whatever their name is
- ansible-vault hack to print all secret strings from a ansible file
  with a mix of secrets and cleartext informations
This commit is contained in:
MorganGeek 2020-06-24 16:59:50 +02:00
parent 409b3695f8
commit f1e6fe7c0f
3 changed files with 18 additions and 3 deletions

View File

@ -13,6 +13,7 @@ alias lzd='lazydocker'
alias setorigin='grset origin' alias setorigin='grset origin'
alias neworigin='setorigin' alias neworigin='setorigin'
alias origin='setorigin' alias origin='setorigin'
alias gpar='gitpushallremote'
# Jira # Jira
alias jirasearch='issues' alias jirasearch='issues'
@ -73,8 +74,8 @@ alias m='mgmt'
alias tunnel='ssh -D 8000 -N $(whoami)@$PROXY_HOST -i ~/.ssh/id_ed25519' alias tunnel='ssh -D 8000 -N $(whoami)@$PROXY_HOST -i ~/.ssh/id_ed25519'
alias sshpub='cat ~/.ssh/id_ed25519.pub' alias sshpub='cat ~/.ssh/id_ed25519.pub'
alias ssla="openssl x509 -alias -noout -in" # Usage : ssla <cert> alias ssla="openssl x509 -alias -noout -in" # Usage : ssla <cert>
alias encrypt='ansible-vault encrypt **/vault.yml --vault-password-file=~/.vaultpass' alias encrypt='ansible-vault encrypt **/vault.yml --vault-password-file=$VAULT_PASSWORD_FILE'
alias decrypt='ansible-vault decrypt **/vault.yml --vault-password-file=~/.vaultpass' alias decrypt='ansible-vault decrypt **/vault.yml --vault-password-file=$VAULT_PASSWORD_FILE'
alias newpass='bw generate --special --uppercase --lowercase --number --length 30' alias newpass='bw generate --special --uppercase --lowercase --number --length 30'
# Network # Network

View File

@ -283,7 +283,20 @@ function passwords {
bw list items --search "$1" | jq -c '.[] | .name + " " + .login.username + ":" + .login.password + " " + .login.uris[0].uri' bw list items --search "$1" | jq -c '.[] | .name + " " + .login.username + ":" + .login.password + " " + .login.uris[0].uri'
} }
function password { function password {
bw get password "$1" bw get password "$1"
}
function vaultgetsecret {
local secret=$(grep -A 500 "ANSIBLE_VAULT" "$1" | awk '{$1=$1;print}' | \grep -Eo "^[0-9a-z^ ]+$")
local secret_string=$(echo "\$ANSIBLE_VAULT;1.1;AES256\n$secret")
echo "$secret_string" | awk '{$1=$1;print}' | ansible-vault decrypt --vault-password-file=$VAULT_PASSWORD_FILE
}
function gitpushallremote {
grv
grv | grep push | awk '{print $1}' | while read -r remote
do
echo "$remote"
git push --all "$remote"
done
} }
function colorpic { function colorpic {
local picture_url="$1" local picture_url="$1"

View File

@ -130,6 +130,7 @@ export JENKINS_SECRET=""
export JIRA_URL="" export JIRA_URL=""
export PROXY_HOST="" export PROXY_HOST=""
export COLORPIC_APIKEY="" export COLORPIC_APIKEY=""
export VAULT_PASSWORD_FILE=""
if test -f "$HOME/.secrets"; then if test -f "$HOME/.secrets"; then
chmod +x "$HOME/.secrets" chmod +x "$HOME/.secrets"