Code Update

This commit is contained in:
Christer Warén 2024-05-18 02:13:48 +03:00
parent 25bf1a9ebc
commit 18d3ed8890
2 changed files with 20 additions and 20 deletions

View File

@ -6,7 +6,7 @@ wx-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Hostname Required" echo "Status: Hostname Required"
wx-stop wx-stop
fi fi
@ -26,7 +26,7 @@ wx-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Organization Required" echo "Status: Organization Required"
wx-stop wx-stop
fi fi
@ -43,7 +43,7 @@ wx-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Organization Unsupported" echo "Status: Organization Unsupported"
wx-stop wx-stop
fi fi
@ -62,7 +62,7 @@ wx-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Hostname Required" echo "Status: Hostname Required"
wx-stop wx-stop
fi fi
@ -75,7 +75,7 @@ wx-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Username Required" echo "Status: Username Required"
wx-stop wx-stop
else else
USER=$LOGNAME USER=$LOGNAME
@ -123,13 +123,13 @@ wx-login(){
if [[ -z $USERNAME || -z $PASSWORD ]] if [[ -z $USERNAME || -z $PASSWORD ]]
then then
echo -n "Status: Username & Password Required" echo "Status: Username & Password Required"
wx-stop wx-stop
else else
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token') 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 ]] if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
then then
echo -n "Status: Login Failed" echo "Status: Login Failed"
wx-stop wx-stop
fi fi
@ -151,14 +151,14 @@ wx-login(){
if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]] if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]]
then then
echo -n "Status: Vault Token Required" echo "Status: Vault Token Required"
wx-stop wx-stop
fi 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') 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: Login Failed" echo "Status: Login Failed"
wx-stop wx-stop
fi fi
@ -175,7 +175,7 @@ wx-login(){
echo $wxBold$ORG$wxNormal echo $wxBold$ORG$wxNormal
echo -n "Status: Vault Offline" echo "Status: Vault Offline"
wx-stop wx-stop
fi fi
} }

20
wx
View File

@ -27,7 +27,7 @@ wx-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Hostname Required" echo "Status: Hostname Required"
wx-stop wx-stop
fi fi
@ -47,7 +47,7 @@ wx-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Organization Required" echo "Status: Organization Required"
wx-stop wx-stop
fi fi
@ -64,7 +64,7 @@ wx-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Organization Unsupported" echo "Status: Organization Unsupported"
wx-stop wx-stop
fi fi
@ -83,7 +83,7 @@ wx-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Hostname Required" echo "Status: Hostname Required"
wx-stop wx-stop
fi fi
@ -96,7 +96,7 @@ wx-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Username Required" echo "Status: Username Required"
wx-stop wx-stop
else else
USER=$LOGNAME USER=$LOGNAME
@ -144,13 +144,13 @@ wx-login(){
if [[ -z $USERNAME || -z $PASSWORD ]] if [[ -z $USERNAME || -z $PASSWORD ]]
then then
echo -n "Status: Username & Password Required" echo "Status: Username & Password Required"
wx-stop wx-stop
else else
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token') 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 ]] if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
then then
echo -n "Status: Login Failed" echo "Status: Login Failed"
wx-stop wx-stop
fi fi
@ -172,14 +172,14 @@ wx-login(){
if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]] if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]]
then then
echo -n "Status: Vault Token Required" echo "Status: Vault Token Required"
wx-stop wx-stop
fi 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') 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: Login Failed" echo "Status: Login Failed"
wx-stop wx-stop
fi fi
@ -196,7 +196,7 @@ wx-login(){
echo $wxBold$ORG$wxNormal echo $wxBold$ORG$wxNormal
echo -n "Status: Vault Offline" echo "Status: Vault Offline"
wx-stop wx-stop
fi fi
} }