Source Update
This commit is contained in:
parent
824ca7168c
commit
28aed09fd1
@ -18,6 +18,8 @@ wxItalic=$(tput sitm)
|
||||
wxBold=$(tput bold)
|
||||
wxNormal=$(tput sgr0)
|
||||
|
||||
declare -Ax config
|
||||
|
||||
{{ FUNCTIONS }}
|
||||
{{ COMMANDS }}
|
||||
|
||||
|
@ -1,8 +1,20 @@
|
||||
wx-ssh() {
|
||||
wx-login
|
||||
|
||||
echo -n "$wxItalic"
|
||||
echo " >> SSH << "
|
||||
echo -n "$wxNormal";
|
||||
echo "------------------------------"
|
||||
case $1 in
|
||||
sign)
|
||||
wx-ssh-sign
|
||||
;;
|
||||
config)
|
||||
wx-ssh-config
|
||||
;;
|
||||
*)
|
||||
echo -n "$wxItalic"
|
||||
echo " >> SSH << "
|
||||
echo -n "$wxNormal";
|
||||
echo "------------------------------"
|
||||
|
||||
wx-stop
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
wx-ssh-config(){
|
||||
echo -n "$wxItalic"
|
||||
echo " >> SSH : Config << "
|
||||
echo -n "$wxNormal"
|
||||
echo " >> SSH << "
|
||||
echo " Config "
|
||||
echo -n "$wxNormal";
|
||||
echo "------------------------------"
|
||||
}
|
||||
|
@ -1,6 +1,40 @@
|
||||
wx-ssh-sign(){
|
||||
echo -n "$wxItalic"
|
||||
echo " >> SSH : Certificates << "
|
||||
echo " >> SSH << "
|
||||
echo " Sign "
|
||||
echo -n "$wxNormal"
|
||||
echo "------------------------------"
|
||||
|
||||
NAME=warengroup
|
||||
ROLE=sysadmin
|
||||
PRINCIPALS=sysadmin
|
||||
TTL=3600
|
||||
|
||||
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
|
||||
then
|
||||
echo "$NAME/$ROLE"
|
||||
echo $(curl https://$VAULT_DOMAIN/v1/ssh/sign/$ROLE -X POST --header "X-Vault-Token: ${config[$ORG]}" -d "{ \"public_key\": \"$(cat $HOME/.ssh/keys/$NAME-ed25519.pub)\", \"valid_principals\": \"$PRINCIPALS,$USER\", \"ttl\": \"$TTL\" }" -s | jq -r '.data.signed_key') > ~/.ssh/keys/$NAME-ed25519.sig 2>&1
|
||||
fi
|
||||
|
||||
NAME=cwinfo
|
||||
ROLE=sysadmin
|
||||
PRINCIPALS=sysadmin
|
||||
TTL=3600
|
||||
|
||||
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
|
||||
then
|
||||
echo "$NAME/$ROLE"
|
||||
echo $(curl https://$VAULT_DOMAIN/v1/ssh/sign/$ROLE -X POST --header "X-Vault-Token: ${config[$ORG]}" -d "{ \"public_key\": \"$(cat $HOME/.ssh/keys/$NAME-ed25519.pub)\", \"valid_principals\": \"$PRINCIPALS,$USER\", \"ttl\": \"$TTL\" }" -s | jq -r '.data.signed_key') > ~/.ssh/keys/$NAME-ed25519.sig 2>&1
|
||||
fi
|
||||
|
||||
NAME=cwchristerw
|
||||
ROLE=sysadmin
|
||||
PRINCIPALS=sysadmin
|
||||
TTL=3600
|
||||
|
||||
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
|
||||
then
|
||||
echo "$NAME/$ROLE"
|
||||
echo $(curl https://$VAULT_DOMAIN/v1/ssh/sign/$ROLE -X POST --header "X-Vault-Token: ${config[$ORG]}" -d "{ \"public_key\": \"$(cat $HOME/.ssh/keys/$NAME-ed25519.pub)\", \"valid_principals\": \"$PRINCIPALS,$USER\", \"ttl\": \"$TTL\" }" -s | jq -r '.data.signed_key') > ~/.ssh/keys/$NAME-ed25519.sig 2>&1
|
||||
fi
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ wx-login() {
|
||||
echo -n "$wxNormal";
|
||||
echo "------------------------------"
|
||||
|
||||
ORG=$2
|
||||
ORG=$1
|
||||
|
||||
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]; then
|
||||
wx-stop
|
||||
@ -92,7 +92,7 @@ wx-login() {
|
||||
if [[ $VAULT_STATUS -eq 200 ]]
|
||||
then
|
||||
IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$IDM_DOMAIN)
|
||||
if [[ $IDM_STATUS -eq 302 ]]
|
||||
if [[ $IDM_STATUS -eq 301 ]]
|
||||
then
|
||||
echo -n $wxBold
|
||||
echo -n $ORG
|
||||
@ -138,8 +138,8 @@ wx-login() {
|
||||
wx-stop
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
|
||||
config[${ORG}]=$VAULT_LOGIN
|
||||
wx-start
|
||||
else
|
||||
echo -n $wxBold
|
||||
@ -171,6 +171,7 @@ wx-login() {
|
||||
wx-stop
|
||||
fi
|
||||
|
||||
config[${ORG}]=$VAULT_LOGIN
|
||||
wx-start
|
||||
fi
|
||||
else
|
||||
|
70
wx
70
wx
@ -18,13 +18,15 @@ wxItalic=$(tput sitm)
|
||||
wxBold=$(tput bold)
|
||||
wxNormal=$(tput sgr0)
|
||||
|
||||
declare -Ax config
|
||||
|
||||
wx-login() {
|
||||
echo -n "$wxItalic"
|
||||
echo " >> Login << "
|
||||
echo -n "$wxNormal";
|
||||
echo "------------------------------"
|
||||
|
||||
ORG=$2
|
||||
ORG=$1
|
||||
|
||||
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]; then
|
||||
wx-stop
|
||||
@ -112,7 +114,7 @@ wx-login() {
|
||||
if [[ $VAULT_STATUS -eq 200 ]]
|
||||
then
|
||||
IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$IDM_DOMAIN)
|
||||
if [[ $IDM_STATUS -eq 302 ]]
|
||||
if [[ $IDM_STATUS -eq 301 ]]
|
||||
then
|
||||
echo -n $wxBold
|
||||
echo -n $ORG
|
||||
@ -158,8 +160,8 @@ wx-login() {
|
||||
wx-stop
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
|
||||
config[${ORG}]=$VAULT_LOGIN
|
||||
wx-start
|
||||
else
|
||||
echo -n $wxBold
|
||||
@ -191,6 +193,7 @@ wx-login() {
|
||||
wx-stop
|
||||
fi
|
||||
|
||||
config[${ORG}]=$VAULT_LOGIN
|
||||
wx-start
|
||||
fi
|
||||
else
|
||||
@ -282,10 +285,22 @@ wx-settings() {
|
||||
wx-ssh() {
|
||||
wx-login
|
||||
|
||||
echo -n "$wxItalic"
|
||||
echo " >> SSH << "
|
||||
echo -n "$wxNormal";
|
||||
echo "------------------------------"
|
||||
case $1 in
|
||||
sign)
|
||||
wx-ssh-sign
|
||||
;;
|
||||
config)
|
||||
wx-ssh-config
|
||||
;;
|
||||
*)
|
||||
echo -n "$wxItalic"
|
||||
echo " >> SSH << "
|
||||
echo -n "$wxNormal";
|
||||
echo "------------------------------"
|
||||
|
||||
wx-stop
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
wx-welcome() {
|
||||
@ -297,16 +312,51 @@ wx-welcome() {
|
||||
|
||||
wx-ssh-config(){
|
||||
echo -n "$wxItalic"
|
||||
echo " >> SSH : Config << "
|
||||
echo -n "$wxNormal"
|
||||
echo " >> SSH << "
|
||||
echo " Config "
|
||||
echo -n "$wxNormal";
|
||||
echo "------------------------------"
|
||||
}
|
||||
|
||||
wx-ssh-sign(){
|
||||
echo -n "$wxItalic"
|
||||
echo " >> SSH : Certificates << "
|
||||
echo " >> SSH << "
|
||||
echo " Sign "
|
||||
echo -n "$wxNormal"
|
||||
echo "------------------------------"
|
||||
|
||||
NAME=warengroup
|
||||
ROLE=sysadmin
|
||||
PRINCIPALS=sysadmin
|
||||
TTL=3600
|
||||
|
||||
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
|
||||
then
|
||||
echo "$NAME/$ROLE"
|
||||
echo $(curl https://$VAULT_DOMAIN/v1/ssh/sign/$ROLE -X POST --header "X-Vault-Token: ${config[$ORG]}" -d "{ \"public_key\": \"$(cat $HOME/.ssh/keys/$NAME-ed25519.pub)\", \"valid_principals\": \"$PRINCIPALS,$USER\", \"ttl\": \"$TTL\" }" -s | jq -r '.data.signed_key') > ~/.ssh/keys/$NAME-ed25519.sig 2>&1
|
||||
fi
|
||||
|
||||
NAME=cwinfo
|
||||
ROLE=sysadmin
|
||||
PRINCIPALS=sysadmin
|
||||
TTL=3600
|
||||
|
||||
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
|
||||
then
|
||||
echo "$NAME/$ROLE"
|
||||
echo $(curl https://$VAULT_DOMAIN/v1/ssh/sign/$ROLE -X POST --header "X-Vault-Token: ${config[$ORG]}" -d "{ \"public_key\": \"$(cat $HOME/.ssh/keys/$NAME-ed25519.pub)\", \"valid_principals\": \"$PRINCIPALS,$USER\", \"ttl\": \"$TTL\" }" -s | jq -r '.data.signed_key') > ~/.ssh/keys/$NAME-ed25519.sig 2>&1
|
||||
fi
|
||||
|
||||
NAME=cwchristerw
|
||||
ROLE=sysadmin
|
||||
PRINCIPALS=sysadmin
|
||||
TTL=3600
|
||||
|
||||
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
|
||||
then
|
||||
echo "$NAME/$ROLE"
|
||||
echo $(curl https://$VAULT_DOMAIN/v1/ssh/sign/$ROLE -X POST --header "X-Vault-Token: ${config[$ORG]}" -d "{ \"public_key\": \"$(cat $HOME/.ssh/keys/$NAME-ed25519.pub)\", \"valid_principals\": \"$PRINCIPALS,$USER\", \"ttl\": \"$TTL\" }" -s | jq -r '.data.signed_key') > ~/.ssh/keys/$NAME-ed25519.sig 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user