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