CLI: Update

This commit is contained in:
Christer Waren
2026-09-20 05:02:02 +03:00
parent 6be628de5a
commit 9e38b6dc84
+5 -50
View File
@@ -160,7 +160,6 @@ wxi-restricted(){
then then
wxi-content status "Command" "Restricted" wxi-content status "Command" "Restricted"
wxi-content text "It's not permitted to execute this command with root or local user." wxi-content text "It's not permitted to execute this command with root or local user."
wxi-footer
wxi-repeat "\n" 3 wxi-repeat "\n" 3
exit 1 exit 1
fi fi
@@ -179,7 +178,6 @@ wxi-restricted(){
;; ;;
*) *)
wxi-content status "Organization" "Unsupported" wxi-content status "Organization" "Unsupported"
wxi-footer
wxi-stop wxi-stop
;; ;;
esac esac
@@ -206,13 +204,11 @@ wxi-restricted(){
;; ;;
*) *)
wxi-content status "Organization" "Unsupported" wxi-content status "Organization" "Unsupported"
wxi-footer
wxi-stop wxi-stop
;; ;;
esac esac
else else
wxi-content status "Organization" "Required" wxi-content status "Organization" "Required"
wxi-footer
wxi-stop wxi-stop
fi fi
fi fi
@@ -222,7 +218,6 @@ wxi-restricted(){
if [[ -z $VAULT_DOMAIN ]] if [[ -z $VAULT_DOMAIN ]]
then then
wxi-content status "Vault" "Unavailable" wxi-content status "Vault" "Unavailable"
wxi-footer
wxi-repeat "\n" 3 wxi-repeat "\n" 3
exit 1 exit 1
fi fi
@@ -231,7 +226,6 @@ wxi-restricted(){
if [[ ! $VAULT_STATUS -eq 200 ]] if [[ ! $VAULT_STATUS -eq 200 ]]
then then
wxi-content status "Vault" "Offline" wxi-content status "Vault" "Offline"
wxi-footer
wxi-repeat "\n" 3 wxi-repeat "\n" 3
exit 1 exit 1
fi fi
@@ -250,6 +244,11 @@ wxi-start(){
chmod 700 -R $HOME/.ssh/keys chmod 700 -R $HOME/.ssh/keys
mkdir -p $HOME/.ssh/multiplex mkdir -p $HOME/.ssh/multiplex
chmod 700 -R $HOME/.ssh/multiplex chmod 700 -R $HOME/.ssh/multiplex
echo -n "$wxiBold"
echo "Designed by"
echo -n "$wxiNormal"
wxiLink "Warén Group™" "https://waren.io"
} }
wxi-stop(){ wxi-stop(){
@@ -288,14 +287,6 @@ wxi-content(){
fi fi
} }
wxi-footer(){
echo ""
echo -n "$wxiBold"
echo "Designed by"
echo -n "$wxiNormal"
wxiLink "Warén Group™" "https://waren.io"
}
wxiRed=$(tput setaf 196) wxiRed=$(tput setaf 196)
wxiGreen=$(tput setaf 46) wxiGreen=$(tput setaf 46)
wxiYellow=$(tput setaf 226) wxiYellow=$(tput setaf 226)
@@ -409,8 +400,6 @@ Maintenance Commands:
uninstall Uninstall uninstall Uninstall
"; ";
wxi-footer
} }
wx-infra(){ wx-infra(){
@@ -450,7 +439,6 @@ wx-infra(){
;; ;;
*) *)
wxi-content status "User" "Unsupported" wxi-content status "User" "Unsupported"
wxi-footer
wxi-stop wxi-stop
INFRA_PATH="$HOME/.warengroup/infra" INFRA_PATH="$HOME/.warengroup/infra"
INFRA_VAULT="--vault-id warengroup@$HOME/.warengroup/credentials/ansible-vault/warengroup" INFRA_VAULT="--vault-id warengroup@$HOME/.warengroup/credentials/ansible-vault/warengroup"
@@ -501,7 +489,6 @@ wx-infra(){
fi fi
cd "$OLDPWD" cd "$OLDPWD"
fi fi
wxi-footer
} }
wx-ssh(){ wx-ssh(){
@@ -517,7 +504,6 @@ wx-ssh(){
*) *)
wxi-header "SSH" wxi-header "SSH"
wxi-restricted wxi-restricted
wxi-footer
;; ;;
esac esac
} }
@@ -533,8 +519,6 @@ wx-welcome(){
wxi-header "Useful Links" h3 wxi-header "Useful Links" h3
wxi-content link "Infra" "https://infra.waren.io" wxi-content link "Infra" "https://infra.waren.io"
wxi-content link "Status" "https://status.waren.io" wxi-content link "Status" "https://status.waren.io"
wxi-footer
} }
wx-login(){ wx-login(){
@@ -592,7 +576,6 @@ wx-login(){
if [[ -z $USERNAME || -z $PASSWORD ]] if [[ -z $USERNAME || -z $PASSWORD ]]
then then
wxi-content status "Username & Password" "Required" wxi-content status "Username & Password" "Required"
wxi-footer
wxi-stop wxi-stop
fi fi
@@ -600,7 +583,6 @@ wx-login(){
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]] if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
then then
wxi-content status "Login" "Failed" wxi-content status "Login" "Failed"
wxi-footer
wxi-stop wxi-stop
fi fi
@@ -630,14 +612,12 @@ wx-login(){
if [[ -z $TOKEN ]] if [[ -z $TOKEN ]]
then then
wxi-content status "Token" "Required" wxi-content status "Token" "Required"
wxi-footer
wxi-stop wxi-stop
fi fi
if [[ ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]] if [[ ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]]
then then
wxi-content status "Token" "Invalid" wxi-content status "Token" "Invalid"
wxi-footer
wxi-stop wxi-stop
fi fi
@@ -645,7 +625,6 @@ wx-login(){
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]] if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
then then
wxi-content status "Login" "Failed" wxi-content status "Login" "Failed"
wxi-footer
if [[ $(wxi-config-legacy login read) ]] if [[ $(wxi-config-legacy login read) ]]
then then
@@ -661,7 +640,6 @@ wx-login(){
;; ;;
*) *)
wxi-content status "Login Type" "Unsupported" wxi-content status "Login Type" "Unsupported"
wxi-footer
wxi-stop wxi-stop
;; ;;
esac esac
@@ -683,8 +661,6 @@ wx-login(){
then then
USERNAME=${VAULT_USERNAME#oidc-} USERNAME=${VAULT_USERNAME#oidc-}
fi fi
wxi-footer
} }
wx-logout(){ wx-logout(){
@@ -704,7 +680,6 @@ wx-logout(){
wxi-header "$ORG_HEADER" h3 wxi-header "$ORG_HEADER" h3
echo "Logging Out..." echo "Logging Out..."
wxi-config-legacy login erase wxi-config-legacy login erase
wxi-footer
fi fi
} }
@@ -731,8 +706,6 @@ wx-install(){
then then
(crontab -l ; echo "$CRONJOB_NAME" ; echo "$CRONJOB_TASK") | grep -Fv "no crontab" | crontab - (crontab -l ; echo "$CRONJOB_NAME" ; echo "$CRONJOB_TASK") | grep -Fv "no crontab" | crontab -
fi fi
wxi-footer
} }
wx-uninstall(){ wx-uninstall(){
@@ -757,7 +730,6 @@ wx-uninstall(){
rm "$HOME/bin/wx" -rf rm "$HOME/bin/wx" -rf
fi fi
wxi-footer
wxi-repeat "\n" 3 wxi-repeat "\n" 3
exit 1 exit 1
} }
@@ -769,7 +741,6 @@ wx-update(){
wx-install &> /dev/null wx-install &> /dev/null
echo "Updates Completed" echo "Updates Completed"
wxi-footer
} }
wx-auto(){ wx-auto(){
@@ -777,7 +748,6 @@ wx-auto(){
wxi-header "Auto" wxi-header "Auto"
wxi-restricted wxi-restricted
wxi-footer
wxi-ssh-config-sync wxi-ssh-config-sync
wxi-ssh-keys-sign wxi-ssh-keys-sign
@@ -787,7 +757,6 @@ wx-auto(){
wx-clean(){ wx-clean(){
wxi-header "Clean" wxi-header "Clean"
wxi-restricted --user wxi-restricted --user
wxi-footer
wxi-ssh-config-clean wxi-ssh-config-clean
wxi-ssh-keys-clean wxi-ssh-keys-clean
@@ -799,7 +768,6 @@ wx-settings(){
wxi-header "Settings" wxi-header "Settings"
wxi-restricted --user wxi-restricted --user
wxi-footer
} }
wxi-ssh-config(){ wxi-ssh-config(){
@@ -848,7 +816,6 @@ wxi-ssh-keys(){
;; ;;
*) *)
wxi-header "SSH / Keys" wxi-header "SSH / Keys"
wxi-footer
;; ;;
esac esac
} }
@@ -862,7 +829,6 @@ wxi-ssh-config-clean(){
then then
rm "$HOME/.ssh/config" rm "$HOME/.ssh/config"
fi fi
wxi-footer
} }
wxi-ssh-config-edit(){ wxi-ssh-config-edit(){
@@ -870,7 +836,6 @@ wxi-ssh-config-edit(){
wxi-restricted wxi-restricted
nano ~/.ssh/config nano ~/.ssh/config
wxi-footer
} }
wxi-ssh-config-save(){ wxi-ssh-config-save(){
@@ -881,7 +846,6 @@ wxi-ssh-config-save(){
then then
curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X POST --header "X-Vault-Token: $TOKEN" -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: $TOKEN" -d "{ \"data\": { \"data\": \"$(cat ~/.ssh/config | base64 -w 0)\" } }" -s &> /dev/null
fi fi
wxi-footer
} }
wxi-ssh-config-sync(){ wxi-ssh-config-sync(){
@@ -900,7 +864,6 @@ wxi-ssh-config-sync(){
chmod 700 ~/.ssh/config chmod 700 ~/.ssh/config
fi fi
fi fi
wxi-footer
} }
wxi-ssh-keys-clean(){ wxi-ssh-keys-clean(){
@@ -932,8 +895,6 @@ wxi-ssh-keys-clean(){
fi fi
done done
fi fi
wxi-footer
} }
wxi-ssh-keys-generate(){ wxi-ssh-keys-generate(){
@@ -947,7 +908,6 @@ wxi-ssh-keys-generate(){
ssh-keygen -t ed25519 -f $HOME/.ssh/keys/$1 -q -N "" -C "$USERNAME" &> /dev/null ssh-keygen -t ed25519 -f $HOME/.ssh/keys/$1 -q -N "" -C "$USERNAME" &> /dev/null
fi fi
fi fi
wxi-footer
} }
wxi-ssh-keys-retrieve(){ wxi-ssh-keys-retrieve(){
@@ -965,8 +925,6 @@ wxi-ssh-keys-retrieve(){
chmod 700 ~/.ssh/keys/$1.pub chmod 700 ~/.ssh/keys/$1.pub
fi fi
fi fi
wxi-footer
} }
wxi-ssh-keys-save(){ wxi-ssh-keys-save(){
@@ -980,7 +938,6 @@ wxi-ssh-keys-save(){
curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/keys/$1 -X POST --header "X-Vault-Token: $TOKEN" -d "{ \"data\": { \"private\": \"$(cat ~/.ssh/keys/$1 | base64 -w 0)\", \"public\": \"$(cat ~/.ssh/keys/$1.pub | base64 -w 0)\" } }" -s &> /dev/null curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/keys/$1 -X POST --header "X-Vault-Token: $TOKEN" -d "{ \"data\": { \"private\": \"$(cat ~/.ssh/keys/$1 | base64 -w 0)\", \"public\": \"$(cat ~/.ssh/keys/$1.pub | base64 -w 0)\" } }" -s &> /dev/null
fi fi
fi fi
wxi-footer
} }
wxi-ssh-keys-sign(){ wxi-ssh-keys-sign(){
@@ -994,7 +951,6 @@ wxi-ssh-keys-sign(){
else else
wxi-ssh-keys-sign-create $ORG sysadmin 3600 wxi-ssh-keys-sign-create $ORG sysadmin 3600
fi fi
wxi-footer
} }
wxi-ssh-keys-sign-create(){ wxi-ssh-keys-sign-create(){
@@ -1024,7 +980,6 @@ wxi-ssh-keys-sync(){
wxi-ssh-keys-retrieve $name &> /dev/null wxi-ssh-keys-retrieve $name &> /dev/null
done done
fi fi
wxi-footer
} }