Source Update
This commit is contained in:
parent
b2d3908d6f
commit
0da7c1ade1
@ -21,7 +21,11 @@ wx-login() {
|
|||||||
ORG=cwchristerw
|
ORG=cwchristerw
|
||||||
elif [[ -z $ORG ]]
|
elif [[ -z $ORG ]]
|
||||||
then
|
then
|
||||||
echo "Organization: Required"
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Organization Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -35,7 +39,11 @@ wx-login() {
|
|||||||
then
|
then
|
||||||
DOMAIN=christerwaren.fi
|
DOMAIN=christerwaren.fi
|
||||||
else
|
else
|
||||||
echo "Organization: Unsupported"
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Organization Unsupported"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -52,7 +60,11 @@ wx-login() {
|
|||||||
then
|
then
|
||||||
HOSTNAME="$2.$DEVICE_DOMAIN"
|
HOSTNAME="$2.$DEVICE_DOMAIN"
|
||||||
else
|
else
|
||||||
echo "Hostname: Required"
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Hostname Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -62,7 +74,11 @@ wx-login() {
|
|||||||
then
|
then
|
||||||
if [[ -z LOGNAME ]]
|
if [[ -z LOGNAME ]]
|
||||||
then
|
then
|
||||||
echo "Username: Required"
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Username Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
else
|
else
|
||||||
USER=$LOGNAME
|
USER=$LOGNAME
|
||||||
@ -76,73 +92,97 @@ wx-login() {
|
|||||||
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)
|
IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$IDM_DOMAIN)
|
||||||
if [[ $IDM_STATUS -eq 301 ]]
|
if [[ $IDM_STATUS -eq 302 ]]
|
||||||
then
|
then
|
||||||
echo "Organization: $ORG"
|
echo -n $wxBold
|
||||||
|
echo -n $ORG
|
||||||
|
echo $wxNormal
|
||||||
|
|
||||||
if [[ -z $USER || $USER == "root" || $USER == "local" ]]
|
if [[ -z $USER || $USER == "root" || $USER == "local" ]]
|
||||||
then
|
then
|
||||||
echo -n "Username: "
|
echo -n "Username: "
|
||||||
|
echo -n $wxItalic
|
||||||
read USERNAME
|
read USERNAME
|
||||||
|
echo -n $wxNormal
|
||||||
else
|
else
|
||||||
echo "Username: $USER"
|
echo -n "Username: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n $USER
|
||||||
|
echo $wxNormal
|
||||||
USERNAME=$USER
|
USERNAME=$USER
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Password: "
|
echo -n "Password: "
|
||||||
|
echo -n $wxItalic
|
||||||
read -s PASSWORD
|
read -s PASSWORD
|
||||||
echo "****************"
|
echo -n "****************"
|
||||||
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token')
|
echo $wxNormal
|
||||||
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]; then
|
|
||||||
echo "Status: Login Failed"
|
if [[ -z $USERNAME || -z $PASSWORD ]]
|
||||||
|
then
|
||||||
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Username & Password Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
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
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
wx-start
|
wx-start
|
||||||
else
|
else
|
||||||
echo "Organization: $ORG"
|
echo -n $wxBold
|
||||||
echo "Status: IDM Offline"
|
echo -n $ORG
|
||||||
wx-stop
|
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
|
||||||
|
|
||||||
|
wx-start
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Organization: $ORG"
|
echo -n $wxBold
|
||||||
echo "Status: Vault Offline"
|
echo -n $ORG
|
||||||
|
echo $wxNormal
|
||||||
|
|
||||||
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Vault Offline"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://vault.$DOMAIN/v1/sys/health)
|
|
||||||
# if [[ $VAULT_STATUS -eq 200 ]]; then
|
|
||||||
# export VAULT_ADDR="https://vault.$DOMAIN"
|
|
||||||
# VAULT_LOGIN=$(vault token lookup -address=https://vault.$DOMAIN 2> /dev/null)
|
|
||||||
# if [[ -z $VAULT_LOGIN ]]; then
|
|
||||||
# IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://idm.$DOMAIN)
|
|
||||||
# if [[ $IDM_STATUS -eq 301 ]]; then
|
|
||||||
# echo "vault.$DOMAIN - Login"
|
|
||||||
# echo "Username: $USER"
|
|
||||||
# echo -n "Password: "
|
|
||||||
# export VAULT_ADDR="https://vault.$DOMAIN"
|
|
||||||
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=ldap username=$USER 2> /dev/null)
|
|
||||||
# echo ""
|
|
||||||
# if [[ -z $VAULT_LOGIN ]]; then
|
|
||||||
# wx-stop
|
|
||||||
# fi
|
|
||||||
# else
|
|
||||||
# echo "vault.$DOMAIN - Login"
|
|
||||||
# echo -n "Token: "
|
|
||||||
# export VAULT_ADDR="https://vault.$DOMAIN"
|
|
||||||
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=token 2> /dev/null)
|
|
||||||
# echo ""
|
|
||||||
# if [[ -z $VAULT_LOGIN || ${#VAULT_TOKEN} -lt 95 || ${#VAULT_TOKEN} -gt 95 ]]; then
|
|
||||||
# wx-stop
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
|
|
||||||
|
|
||||||
# if [[ $USER == "root" || $USER == "local" ]]
|
|
||||||
# then
|
|
||||||
# echo "Status: Login Failed"
|
|
||||||
# fi
|
|
||||||
}
|
}
|
||||||
|
146
wx
146
wx
@ -41,7 +41,11 @@ wx-login() {
|
|||||||
ORG=cwchristerw
|
ORG=cwchristerw
|
||||||
elif [[ -z $ORG ]]
|
elif [[ -z $ORG ]]
|
||||||
then
|
then
|
||||||
echo "Organization: Required"
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Organization Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -55,7 +59,11 @@ wx-login() {
|
|||||||
then
|
then
|
||||||
DOMAIN=christerwaren.fi
|
DOMAIN=christerwaren.fi
|
||||||
else
|
else
|
||||||
echo "Organization: Unsupported"
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Organization Unsupported"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -72,7 +80,11 @@ wx-login() {
|
|||||||
then
|
then
|
||||||
HOSTNAME="$2.$DEVICE_DOMAIN"
|
HOSTNAME="$2.$DEVICE_DOMAIN"
|
||||||
else
|
else
|
||||||
echo "Hostname: Required"
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Hostname Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -82,7 +94,11 @@ wx-login() {
|
|||||||
then
|
then
|
||||||
if [[ -z LOGNAME ]]
|
if [[ -z LOGNAME ]]
|
||||||
then
|
then
|
||||||
echo "Username: Required"
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Username Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
else
|
else
|
||||||
USER=$LOGNAME
|
USER=$LOGNAME
|
||||||
@ -96,75 +112,99 @@ wx-login() {
|
|||||||
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)
|
IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$IDM_DOMAIN)
|
||||||
if [[ $IDM_STATUS -eq 301 ]]
|
if [[ $IDM_STATUS -eq 302 ]]
|
||||||
then
|
then
|
||||||
echo "Organization: $ORG"
|
echo -n $wxBold
|
||||||
|
echo -n $ORG
|
||||||
|
echo $wxNormal
|
||||||
|
|
||||||
if [[ -z $USER || $USER == "root" || $USER == "local" ]]
|
if [[ -z $USER || $USER == "root" || $USER == "local" ]]
|
||||||
then
|
then
|
||||||
echo -n "Username: "
|
echo -n "Username: "
|
||||||
|
echo -n $wxItalic
|
||||||
read USERNAME
|
read USERNAME
|
||||||
|
echo -n $wxNormal
|
||||||
else
|
else
|
||||||
echo "Username: $USER"
|
echo -n "Username: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n $USER
|
||||||
|
echo $wxNormal
|
||||||
USERNAME=$USER
|
USERNAME=$USER
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Password: "
|
echo -n "Password: "
|
||||||
|
echo -n $wxItalic
|
||||||
read -s PASSWORD
|
read -s PASSWORD
|
||||||
echo "****************"
|
echo -n "****************"
|
||||||
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token')
|
echo $wxNormal
|
||||||
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]; then
|
|
||||||
echo "Status: Login Failed"
|
if [[ -z $USERNAME || -z $PASSWORD ]]
|
||||||
|
then
|
||||||
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Username & Password Required"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
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
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
echo $VAULT_LOGIN
|
||||||
wx-start
|
wx-start
|
||||||
else
|
else
|
||||||
echo "Organization: $ORG"
|
echo -n $wxBold
|
||||||
echo "Status: IDM Offline"
|
echo -n $ORG
|
||||||
wx-stop
|
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
|
||||||
|
|
||||||
|
wx-start
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Organization: $ORG"
|
echo -n $wxBold
|
||||||
echo "Status: Vault Offline"
|
echo -n $ORG
|
||||||
|
echo $wxNormal
|
||||||
|
|
||||||
|
echo -n "Status: "
|
||||||
|
echo -n $wxItalic
|
||||||
|
echo -n "Vault Offline"
|
||||||
|
echo -n $wxNormal
|
||||||
|
|
||||||
wx-stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://vault.$DOMAIN/v1/sys/health)
|
|
||||||
# if [[ $VAULT_STATUS -eq 200 ]]; then
|
|
||||||
# export VAULT_ADDR="https://vault.$DOMAIN"
|
|
||||||
# VAULT_LOGIN=$(vault token lookup -address=https://vault.$DOMAIN 2> /dev/null)
|
|
||||||
# if [[ -z $VAULT_LOGIN ]]; then
|
|
||||||
# IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://idm.$DOMAIN)
|
|
||||||
# if [[ $IDM_STATUS -eq 301 ]]; then
|
|
||||||
# echo "vault.$DOMAIN - Login"
|
|
||||||
# echo "Username: $USER"
|
|
||||||
# echo -n "Password: "
|
|
||||||
# export VAULT_ADDR="https://vault.$DOMAIN"
|
|
||||||
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=ldap username=$USER 2> /dev/null)
|
|
||||||
# echo ""
|
|
||||||
# if [[ -z $VAULT_LOGIN ]]; then
|
|
||||||
# wx-stop
|
|
||||||
# fi
|
|
||||||
# else
|
|
||||||
# echo "vault.$DOMAIN - Login"
|
|
||||||
# echo -n "Token: "
|
|
||||||
# export VAULT_ADDR="https://vault.$DOMAIN"
|
|
||||||
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=token 2> /dev/null)
|
|
||||||
# echo ""
|
|
||||||
# if [[ -z $VAULT_LOGIN || ${#VAULT_TOKEN} -lt 95 || ${#VAULT_TOKEN} -gt 95 ]]; then
|
|
||||||
# wx-stop
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
|
|
||||||
|
|
||||||
# if [[ $USER == "root" || $USER == "local" ]]
|
|
||||||
# then
|
|
||||||
# echo "Status: Login Failed"
|
|
||||||
# fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wx-start() {
|
wx-start() {
|
||||||
|
Loading…
Reference in New Issue
Block a user