Code Update

This commit is contained in:
Christer Warén 2024-06-01 02:09:21 +03:00
parent e1b05fbc51
commit 90414af2dc
4 changed files with 20 additions and 8 deletions

View File

@ -2,7 +2,7 @@ wx-auto(){
wx-login wx-login
wx-header "Auto" wx-header "Auto"
wx-ssh-config sync wx-ssh-config-sync
wx-ssh-keys sync wx-ssh-keys-sync
wx-ssh-sign wx-ssh-sign
} }

View File

@ -1,5 +1,4 @@
wx-ssh-config(){ wx-ssh-config(){
wx-header "SSH / Config"
wx-restricted wx-restricted
case $1 in case $1 in
@ -22,16 +21,19 @@ wx-ssh-config(){
} }
wx-ssh-config-edit(){ wx-ssh-config-edit(){
wx-header "SSH / Config"
wx-restricted wx-restricted
nano ~/.ssh/config nano ~/.ssh/config
} }
wx-ssh-config-save(){ wx-ssh-config-save(){
wx-header "SSH / Config"
wx-restricted 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 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-ssh-config-sync(){
wx-header "SSH / Config"
wx-restricted 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]}") 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 ]] if [[ $VAULT_STATUS -eq 200 ]]

View File

@ -1,5 +1,5 @@
wx-ssh-keys(){ wx-ssh-keys(){
wx-header "SSH / Keys" wx-restricted
case $1 in case $1 in
generate) generate)
@ -27,6 +27,7 @@ wx-ssh-keys(){
} }
wx-ssh-keys-generate(){ wx-ssh-keys-generate(){
wx-header "SSH / Keys"
wx-restricted wx-restricted
if [[ ! -z $1 ]] if [[ ! -z $1 ]]
then then
@ -38,6 +39,7 @@ wx-ssh-keys-generate(){
} }
wx-ssh-keys-retrieve(){ wx-ssh-keys-retrieve(){
wx-header "SSH / Keys"
wx-restricted wx-restricted
if [[ ! -z $1 ]] if [[ ! -z $1 ]]
then then
@ -51,6 +53,7 @@ wx-ssh-keys-retrieve(){
} }
wx-ssh-keys-save(){ wx-ssh-keys-save(){
wx-header "SSH / Keys"
wx-restricted wx-restricted
if [[ ! -z $1 ]] if [[ ! -z $1 ]]
then then
@ -62,6 +65,7 @@ wx-ssh-keys-save(){
} }
wx-ssh-keys-sync(){ wx-ssh-keys-sync(){
wx-header "SSH / Keys"
wx-restricted wx-restricted
echo "" echo ""
} }

14
wx
View File

@ -89,8 +89,8 @@ wx-auto(){
wx-login wx-login
wx-header "Auto" wx-header "Auto"
wx-ssh-config sync wx-ssh-config-sync
wx-ssh-keys sync wx-ssh-keys-sync
wx-ssh-sign wx-ssh-sign
} }
@ -408,7 +408,6 @@ wx-welcome(){
} }
wx-ssh-config(){ wx-ssh-config(){
wx-header "SSH / Config"
wx-restricted wx-restricted
case $1 in case $1 in
@ -431,16 +430,19 @@ wx-ssh-config(){
} }
wx-ssh-config-edit(){ wx-ssh-config-edit(){
wx-header "SSH / Config"
wx-restricted wx-restricted
nano ~/.ssh/config nano ~/.ssh/config
} }
wx-ssh-config-save(){ wx-ssh-config-save(){
wx-header "SSH / Config"
wx-restricted 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 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-ssh-config-sync(){
wx-header "SSH / Config"
wx-restricted 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]}") 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 ]] if [[ $VAULT_STATUS -eq 200 ]]
@ -450,7 +452,7 @@ wx-ssh-config-sync(){
} }
wx-ssh-keys(){ wx-ssh-keys(){
wx-header "SSH / Keys" wx-restricted
case $1 in case $1 in
generate) generate)
@ -478,6 +480,7 @@ wx-ssh-keys(){
} }
wx-ssh-keys-generate(){ wx-ssh-keys-generate(){
wx-header "SSH / Keys"
wx-restricted wx-restricted
if [[ ! -z $1 ]] if [[ ! -z $1 ]]
then then
@ -489,6 +492,7 @@ wx-ssh-keys-generate(){
} }
wx-ssh-keys-retrieve(){ wx-ssh-keys-retrieve(){
wx-header "SSH / Keys"
wx-restricted wx-restricted
if [[ ! -z $1 ]] if [[ ! -z $1 ]]
then then
@ -502,6 +506,7 @@ wx-ssh-keys-retrieve(){
} }
wx-ssh-keys-save(){ wx-ssh-keys-save(){
wx-header "SSH / Keys"
wx-restricted wx-restricted
if [[ ! -z $1 ]] if [[ ! -z $1 ]]
then then
@ -513,6 +518,7 @@ wx-ssh-keys-save(){
} }
wx-ssh-keys-sync(){ wx-ssh-keys-sync(){
wx-header "SSH / Keys"
wx-restricted wx-restricted
echo "" echo ""
} }