Source Update
This commit is contained in:
parent
963770b974
commit
6619193dc6
@ -91,43 +91,104 @@ wx-login(){
|
|||||||
VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/sys/health)
|
VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/sys/health)
|
||||||
if [[ $VAULT_STATUS -eq 200 ]]
|
if [[ $VAULT_STATUS -eq 200 ]]
|
||||||
then
|
then
|
||||||
IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$IDM_DOMAIN)
|
if [[ -f "$HOME/.config/warengroup/login.json" ]]
|
||||||
if [[ $IDM_STATUS -eq 301 ]]
|
then
|
||||||
|
TOKEN="$(cat $HOME/.config/warengroup/login.json | jq -r .$ORG)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token')
|
||||||
|
if [[ ! -z $VAULT_LOGIN && ${#VAULT_LOGIN} == 95 ]]
|
||||||
then
|
then
|
||||||
echo -n $wxBold
|
echo -n $wxBold
|
||||||
echo -n $ORG
|
echo -n $ORG
|
||||||
echo $wxNormal
|
echo $wxNormal
|
||||||
|
|
||||||
if [[ -z $USER || $USER == "root" || $USER == "local" ]]
|
echo -n "Username: "
|
||||||
then
|
|
||||||
echo -n "Username: "
|
|
||||||
echo -n $wxItalic
|
|
||||||
read USERNAME
|
|
||||||
echo -n $wxNormal
|
|
||||||
else
|
|
||||||
echo -n "Username: "
|
|
||||||
echo -n $wxItalic
|
|
||||||
echo -n $USER
|
|
||||||
echo $wxNormal
|
|
||||||
USERNAME=$USER
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -n "Password: "
|
|
||||||
echo -n $wxItalic
|
echo -n $wxItalic
|
||||||
read -s PASSWORD
|
echo -n $(curl https://$VAULT_DOMAIN/v1/auth/token/lookup-self -X GET --header "X-Vault-Token: $VAULT_LOGIN" -s | jq -r '.data.meta.username')
|
||||||
echo -n "****************"
|
|
||||||
echo $wxNormal
|
echo $wxNormal
|
||||||
|
|
||||||
if [[ -z $USERNAME || -z $PASSWORD ]]
|
config[${ORG}]=$VAULT_LOGIN
|
||||||
then
|
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||||
echo -n "Status: "
|
|
||||||
echo -n $wxItalic
|
|
||||||
echo -n "Username & Password Required"
|
|
||||||
echo -n $wxNormal
|
|
||||||
|
|
||||||
wx-stop
|
wx-start
|
||||||
|
else
|
||||||
|
IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$IDM_DOMAIN)
|
||||||
|
if [[ $IDM_STATUS -eq 301 ]]
|
||||||
|
then
|
||||||
|
echo -n $wxBold
|
||||||
|
echo -n $ORG
|
||||||
|
echo $wxNormal
|
||||||
|
|
||||||
|
if [[ -z $USER || $USER == "root" || $USER == "local" ]]
|
||||||
|
then
|
||||||
|
echo -n "Username: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
read USERNAME
|
||||||
|
echo -n $wxNormal
|
||||||
|
else
|
||||||
|
echo -n "Username: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n $USER
|
||||||
|
echo $wxNormal
|
||||||
|
USERNAME=$USER
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Password: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
read -s PASSWORD
|
||||||
|
echo -n "****************"
|
||||||
|
echo $wxNormal
|
||||||
|
|
||||||
|
if [[ -z $USERNAME || -z $PASSWORD ]]
|
||||||
|
then
|
||||||
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Username & Password Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
|
wx-stop
|
||||||
|
else
|
||||||
|
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token')
|
||||||
|
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
|
||||||
|
then
|
||||||
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Login Failed"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
|
wx-stop
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
config[${ORG}]=$VAULT_LOGIN
|
||||||
|
|
||||||
|
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||||
|
touch $HOME/.config/warengroup/login.json &> /dev/null
|
||||||
|
|
||||||
|
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||||
|
|
||||||
|
wx-start
|
||||||
else
|
else
|
||||||
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token')
|
echo -n $wxBold
|
||||||
|
echo -n $ORG
|
||||||
|
echo $wxNormal
|
||||||
|
|
||||||
|
echo -n "Token: "
|
||||||
|
read -s TOKEN
|
||||||
|
echo "****************"
|
||||||
|
|
||||||
|
if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]]
|
||||||
|
then
|
||||||
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Vault Token Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
|
wx-stop
|
||||||
|
fi
|
||||||
|
|
||||||
|
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token')
|
||||||
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
|
||||||
echo -n "Status: "
|
echo -n "Status: "
|
||||||
@ -137,42 +198,16 @@ wx-login(){
|
|||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
config[${ORG}]=$VAULT_LOGIN
|
||||||
|
|
||||||
|
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||||
|
touch $HOME/.config/warengroup/login.json &> /dev/null
|
||||||
|
|
||||||
|
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||||
|
|
||||||
|
wx-start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config[${ORG}]=$VAULT_LOGIN
|
|
||||||
wx-start
|
|
||||||
else
|
|
||||||
echo -n $wxBold
|
|
||||||
echo -n $ORG
|
|
||||||
echo $wxNormal
|
|
||||||
|
|
||||||
echo -n "Token: "
|
|
||||||
read -s TOKEN
|
|
||||||
echo "****************"
|
|
||||||
|
|
||||||
if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]]
|
|
||||||
then
|
|
||||||
echo -n "Status: "
|
|
||||||
echo -n $wxItalic
|
|
||||||
echo -n "Vault Token Required"
|
|
||||||
echo -n $wxNormal
|
|
||||||
|
|
||||||
wx-stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token')
|
|
||||||
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
|
|
||||||
then
|
|
||||||
echo -n "Status: "
|
|
||||||
echo -n $wxItalic
|
|
||||||
echo -n "Login Failed"
|
|
||||||
echo -n $wxNormal
|
|
||||||
|
|
||||||
wx-stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
config[${ORG}]=$VAULT_LOGIN
|
|
||||||
wx-start
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -n $wxBold
|
echo -n $wxBold
|
||||||
|
159
wx
159
wx
@ -113,43 +113,104 @@ wx-login(){
|
|||||||
VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/sys/health)
|
VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/sys/health)
|
||||||
if [[ $VAULT_STATUS -eq 200 ]]
|
if [[ $VAULT_STATUS -eq 200 ]]
|
||||||
then
|
then
|
||||||
IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$IDM_DOMAIN)
|
if [[ -f "$HOME/.config/warengroup/login.json" ]]
|
||||||
if [[ $IDM_STATUS -eq 301 ]]
|
then
|
||||||
|
TOKEN="$(cat $HOME/.config/warengroup/login.json | jq -r .$ORG)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token')
|
||||||
|
if [[ ! -z $VAULT_LOGIN && ${#VAULT_LOGIN} == 95 ]]
|
||||||
then
|
then
|
||||||
echo -n $wxBold
|
echo -n $wxBold
|
||||||
echo -n $ORG
|
echo -n $ORG
|
||||||
echo $wxNormal
|
echo $wxNormal
|
||||||
|
|
||||||
if [[ -z $USER || $USER == "root" || $USER == "local" ]]
|
echo -n "Username: "
|
||||||
then
|
|
||||||
echo -n "Username: "
|
|
||||||
echo -n $wxItalic
|
|
||||||
read USERNAME
|
|
||||||
echo -n $wxNormal
|
|
||||||
else
|
|
||||||
echo -n "Username: "
|
|
||||||
echo -n $wxItalic
|
|
||||||
echo -n $USER
|
|
||||||
echo $wxNormal
|
|
||||||
USERNAME=$USER
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -n "Password: "
|
|
||||||
echo -n $wxItalic
|
echo -n $wxItalic
|
||||||
read -s PASSWORD
|
echo -n $(curl https://$VAULT_DOMAIN/v1/auth/token/lookup-self -X GET --header "X-Vault-Token: $VAULT_LOGIN" -s | jq -r '.data.meta.username')
|
||||||
echo -n "****************"
|
|
||||||
echo $wxNormal
|
echo $wxNormal
|
||||||
|
|
||||||
if [[ -z $USERNAME || -z $PASSWORD ]]
|
config[${ORG}]=$VAULT_LOGIN
|
||||||
then
|
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||||
echo -n "Status: "
|
|
||||||
echo -n $wxItalic
|
|
||||||
echo -n "Username & Password Required"
|
|
||||||
echo -n $wxNormal
|
|
||||||
|
|
||||||
wx-stop
|
wx-start
|
||||||
|
else
|
||||||
|
IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$IDM_DOMAIN)
|
||||||
|
if [[ $IDM_STATUS -eq 301 ]]
|
||||||
|
then
|
||||||
|
echo -n $wxBold
|
||||||
|
echo -n $ORG
|
||||||
|
echo $wxNormal
|
||||||
|
|
||||||
|
if [[ -z $USER || $USER == "root" || $USER == "local" ]]
|
||||||
|
then
|
||||||
|
echo -n "Username: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
read USERNAME
|
||||||
|
echo -n $wxNormal
|
||||||
|
else
|
||||||
|
echo -n "Username: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n $USER
|
||||||
|
echo $wxNormal
|
||||||
|
USERNAME=$USER
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Password: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
read -s PASSWORD
|
||||||
|
echo -n "****************"
|
||||||
|
echo $wxNormal
|
||||||
|
|
||||||
|
if [[ -z $USERNAME || -z $PASSWORD ]]
|
||||||
|
then
|
||||||
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Username & Password Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
|
wx-stop
|
||||||
|
else
|
||||||
|
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token')
|
||||||
|
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
|
||||||
|
then
|
||||||
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Login Failed"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
|
wx-stop
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
config[${ORG}]=$VAULT_LOGIN
|
||||||
|
|
||||||
|
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||||
|
touch $HOME/.config/warengroup/login.json &> /dev/null
|
||||||
|
|
||||||
|
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||||
|
|
||||||
|
wx-start
|
||||||
else
|
else
|
||||||
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token')
|
echo -n $wxBold
|
||||||
|
echo -n $ORG
|
||||||
|
echo $wxNormal
|
||||||
|
|
||||||
|
echo -n "Token: "
|
||||||
|
read -s TOKEN
|
||||||
|
echo "****************"
|
||||||
|
|
||||||
|
if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]]
|
||||||
|
then
|
||||||
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Vault Token Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
|
wx-stop
|
||||||
|
fi
|
||||||
|
|
||||||
|
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token')
|
||||||
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
|
||||||
echo -n "Status: "
|
echo -n "Status: "
|
||||||
@ -159,42 +220,16 @@ wx-login(){
|
|||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
config[${ORG}]=$VAULT_LOGIN
|
||||||
|
|
||||||
|
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||||
|
touch $HOME/.config/warengroup/login.json &> /dev/null
|
||||||
|
|
||||||
|
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||||
|
|
||||||
|
wx-start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config[${ORG}]=$VAULT_LOGIN
|
|
||||||
wx-start
|
|
||||||
else
|
|
||||||
echo -n $wxBold
|
|
||||||
echo -n $ORG
|
|
||||||
echo $wxNormal
|
|
||||||
|
|
||||||
echo -n "Token: "
|
|
||||||
read -s TOKEN
|
|
||||||
echo "****************"
|
|
||||||
|
|
||||||
if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]]
|
|
||||||
then
|
|
||||||
echo -n "Status: "
|
|
||||||
echo -n $wxItalic
|
|
||||||
echo -n "Vault Token Required"
|
|
||||||
echo -n $wxNormal
|
|
||||||
|
|
||||||
wx-stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token')
|
|
||||||
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
|
|
||||||
then
|
|
||||||
echo -n "Status: "
|
|
||||||
echo -n $wxItalic
|
|
||||||
echo -n "Login Failed"
|
|
||||||
echo -n $wxNormal
|
|
||||||
|
|
||||||
wx-stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
config[${ORG}]=$VAULT_LOGIN
|
|
||||||
wx-start
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -n $wxBold
|
echo -n $wxBold
|
||||||
|
Loading…
Reference in New Issue
Block a user