diff --git a/src/commands/auto.sh b/src/commands/auto.sh index ccc4957..e0bd444 100644 --- a/src/commands/auto.sh +++ b/src/commands/auto.sh @@ -2,7 +2,7 @@ wx-auto(){ wx-login wx-header "Auto" - wx-ssh-config sync - wx-ssh-keys sync + wx-ssh-config-sync + wx-ssh-keys-sync wx-ssh-sign } diff --git a/src/commands/ssh/config.sh b/src/commands/ssh/config.sh index 98aa0e1..2a0516c 100644 --- a/src/commands/ssh/config.sh +++ b/src/commands/ssh/config.sh @@ -1,5 +1,4 @@ wx-ssh-config(){ - wx-header "SSH / Config" wx-restricted case $1 in @@ -22,16 +21,19 @@ wx-ssh-config(){ } wx-ssh-config-edit(){ + wx-header "SSH / Config" wx-restricted nano ~/.ssh/config } wx-ssh-config-save(){ + wx-header "SSH / Config" wx-restricted curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X POST --header "X-Vault-Token: ${config["login",$ORG]}" -d "{ \"data\": { \"data\": \"$(cat ~/.ssh/config | base64 -w 0)\" } }" -s &> /dev/null } wx-ssh-config-sync(){ + wx-header "SSH / Config" wx-restricted VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}") if [[ $VAULT_STATUS -eq 200 ]] diff --git a/src/commands/ssh/keys.sh b/src/commands/ssh/keys.sh index de023b7..5234727 100644 --- a/src/commands/ssh/keys.sh +++ b/src/commands/ssh/keys.sh @@ -1,5 +1,5 @@ wx-ssh-keys(){ - wx-header "SSH / Keys" + wx-restricted case $1 in generate) @@ -27,6 +27,7 @@ wx-ssh-keys(){ } wx-ssh-keys-generate(){ + wx-header "SSH / Keys" wx-restricted if [[ ! -z $1 ]] then @@ -38,6 +39,7 @@ wx-ssh-keys-generate(){ } wx-ssh-keys-retrieve(){ + wx-header "SSH / Keys" wx-restricted if [[ ! -z $1 ]] then @@ -51,6 +53,7 @@ wx-ssh-keys-retrieve(){ } wx-ssh-keys-save(){ + wx-header "SSH / Keys" wx-restricted if [[ ! -z $1 ]] then @@ -62,6 +65,7 @@ wx-ssh-keys-save(){ } wx-ssh-keys-sync(){ + wx-header "SSH / Keys" wx-restricted echo "" } diff --git a/wx b/wx index d6f9f7c..10f8326 100755 --- a/wx +++ b/wx @@ -89,8 +89,8 @@ wx-auto(){ wx-login wx-header "Auto" - wx-ssh-config sync - wx-ssh-keys sync + wx-ssh-config-sync + wx-ssh-keys-sync wx-ssh-sign } @@ -408,7 +408,6 @@ wx-welcome(){ } wx-ssh-config(){ - wx-header "SSH / Config" wx-restricted case $1 in @@ -431,16 +430,19 @@ wx-ssh-config(){ } wx-ssh-config-edit(){ + wx-header "SSH / Config" wx-restricted nano ~/.ssh/config } wx-ssh-config-save(){ + wx-header "SSH / Config" wx-restricted curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X POST --header "X-Vault-Token: ${config["login",$ORG]}" -d "{ \"data\": { \"data\": \"$(cat ~/.ssh/config | base64 -w 0)\" } }" -s &> /dev/null } wx-ssh-config-sync(){ + wx-header "SSH / Config" wx-restricted VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}") if [[ $VAULT_STATUS -eq 200 ]] @@ -450,7 +452,7 @@ wx-ssh-config-sync(){ } wx-ssh-keys(){ - wx-header "SSH / Keys" + wx-restricted case $1 in generate) @@ -478,6 +480,7 @@ wx-ssh-keys(){ } wx-ssh-keys-generate(){ + wx-header "SSH / Keys" wx-restricted if [[ ! -z $1 ]] then @@ -489,6 +492,7 @@ wx-ssh-keys-generate(){ } wx-ssh-keys-retrieve(){ + wx-header "SSH / Keys" wx-restricted if [[ ! -z $1 ]] then @@ -502,6 +506,7 @@ wx-ssh-keys-retrieve(){ } wx-ssh-keys-save(){ + wx-header "SSH / Keys" wx-restricted if [[ ! -z $1 ]] then @@ -513,6 +518,7 @@ wx-ssh-keys-save(){ } wx-ssh-keys-sync(){ + wx-header "SSH / Keys" wx-restricted echo "" }