Code Update

This commit is contained in:
Christer Warén 2024-05-18 02:16:27 +03:00
parent 32e79f389c
commit a9e0a77f45
3 changed files with 24 additions and 24 deletions

22
init.sh
View File

@ -58,7 +58,7 @@ wi-init(){
GIT_DOMAIN="git.cwinfo.net" GIT_DOMAIN="git.cwinfo.net"
GIT_PORT="2222" GIT_PORT="2222"
GIT_REPOSITORY="infra-plus" GIT_REPOSITORY="warengroup/infra-plus"
ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts
@ -77,7 +77,7 @@ wi-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Hostname Required" echo "Status: Hostname Required"
wi-stop wi-stop
fi fi
@ -97,7 +97,7 @@ wi-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Organization Required" echo "Status: Organization Required"
wi-stop wi-stop
fi fi
@ -114,7 +114,7 @@ wi-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Organization Unsupported" echo "Status: Organization Unsupported"
wi-stop wi-stop
fi fi
@ -133,7 +133,7 @@ wi-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Hostname Required" echo "Status: Hostname Required"
wi-stop wi-stop
fi fi
@ -146,7 +146,7 @@ wi-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Username Required" echo "Status: Username Required"
wi-stop wi-stop
else else
USER=$LOGNAME USER=$LOGNAME
@ -183,13 +183,13 @@ wi-login(){
if [[ -z $USERNAME || -z $PASSWORD ]] if [[ -z $USERNAME || -z $PASSWORD ]]
then then
echo -n "Status: Username & Password Required" echo "Status: Username & Password Required"
wi-stop wi-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"
wi-stop wi-stop
fi fi
@ -208,14 +208,14 @@ wi-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"
wi-stop wi-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"
wi-stop wi-stop
fi fi
@ -228,7 +228,7 @@ wi-login(){
echo $wiBold$ORG$wiNormal echo $wiBold$ORG$wiNormal
echo -n "Status: Vault Offline" echo "Status: Vault Offline"
wi-stop wi-stop
fi fi
} }

View File

@ -39,7 +39,7 @@ wi-init(){
GIT_DOMAIN="git.cwinfo.net" GIT_DOMAIN="git.cwinfo.net"
GIT_PORT="2222" GIT_PORT="2222"
GIT_REPOSITORY="infra-plus" GIT_REPOSITORY="warengroup/infra-plus"
ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts

View File

@ -6,7 +6,7 @@ wi-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Hostname Required" echo "Status: Hostname Required"
wi-stop wi-stop
fi fi
@ -26,7 +26,7 @@ wi-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Organization Required" echo "Status: Organization Required"
wi-stop wi-stop
fi fi
@ -43,7 +43,7 @@ wi-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Organization Unsupported" echo "Status: Organization Unsupported"
wi-stop wi-stop
fi fi
@ -62,7 +62,7 @@ wi-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Hostname Required" echo "Status: Hostname Required"
wi-stop wi-stop
fi fi
@ -75,7 +75,7 @@ wi-login(){
echo " >> Login << " echo " >> Login << "
echo "------------------------------" echo "------------------------------"
echo -n "Status: Username Required" echo "Status: Username Required"
wi-stop wi-stop
else else
USER=$LOGNAME USER=$LOGNAME
@ -112,13 +112,13 @@ wi-login(){
if [[ -z $USERNAME || -z $PASSWORD ]] if [[ -z $USERNAME || -z $PASSWORD ]]
then then
echo -n "Status: Username & Password Required" echo "Status: Username & Password Required"
wi-stop wi-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"
wi-stop wi-stop
fi fi
@ -137,14 +137,14 @@ wi-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"
wi-stop wi-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"
wi-stop wi-stop
fi fi
@ -157,7 +157,7 @@ wi-login(){
echo $wiBold$ORG$wiNormal echo $wiBold$ORG$wiNormal
echo -n "Status: Vault Offline" echo "Status: Vault Offline"
wi-stop wi-stop
fi fi
} }