Source Update

This commit is contained in:
Christer Warén 2024-04-29 06:00:07 +03:00
parent d54100edf8
commit 963770b974
10 changed files with 56 additions and 60 deletions

View File

@ -1,4 +1,4 @@
wx-help() { wx-help(){
echo -n "$wxItalic" echo -n "$wxItalic"
echo " >> Help << " echo " >> Help << "
echo -n "$wxNormal"; echo -n "$wxNormal";

View File

@ -1,4 +1,4 @@
wx-init () { wx-init(){
wx-login wx-login
echo -n "$wxItalic" echo -n "$wxItalic"

View File

@ -1,4 +1,4 @@
wx-settings() { wx-settings(){
wx-login wx-login
echo -n "$wxItalic" echo -n "$wxItalic"

View File

@ -1,4 +1,4 @@
wx-ssh() { wx-ssh(){
wx-login wx-login
case $1 in case $1 in

View File

@ -5,32 +5,30 @@ wx-ssh-sign(){
echo -n "$wxNormal" echo -n "$wxNormal"
echo "------------------------------" echo "------------------------------"
NAME=warengroup if [[ $ORG == "warengroup" ]]
ROLE=sysadmin
PRINCIPALS=sysadmin
TTL=3600
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
then then
echo "$NAME/$ROLE" wx-ssh-sign-create warengroup sysadmin 3600
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 elif [[ $ORG == "cwinfo" ]]
fi
NAME=cwinfo
ROLE=sysadmin
PRINCIPALS=sysadmin
TTL=3600
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
then then
echo "$NAME/$ROLE" wx-ssh-sign-create cwinfo sysadmin 3600
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 elif [[ $ORG == "cwchristerw" ]]
then
wx-ssh-sign-create warengroup sysadmin 3600
wx-ssh-sign-create cwinfo sysadmin 3600
wx-ssh-sign-create cwchristew sysadmin 3600
fi fi
}
NAME=cwchristerw wx-ssh-sign-create(){
ROLE=sysadmin NAME=$1
PRINCIPALS=sysadmin ROLE=$2
TTL=3600 PRINCIPALS=$2
TTL=$3
if [[ ! -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
then
ssh-keygen -t ed25519 -f $HOME/.ssh/keys/$NAME-ed25519 -q -N "" &> /dev/null
fi
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]] if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
then then

View File

@ -1,4 +1,4 @@
wx-welcome() { wx-welcome(){
echo -n "$wxItalic" echo -n "$wxItalic"
echo " >> Welcome << " echo " >> Welcome << "
echo -n "$wxNormal" echo -n "$wxNormal"

View File

@ -1,4 +1,4 @@
wx-login() { wx-login(){
echo -n "$wxItalic" echo -n "$wxItalic"
echo " >> Login << " echo " >> Login << "
echo -n "$wxNormal"; echo -n "$wxNormal";

View File

@ -1,4 +1,4 @@
wx-start() { wx-start(){
echo "" echo ""
echo "" echo ""
echo "" echo ""

View File

@ -1,4 +1,4 @@
wx-stop () { wx-stop (){
echo " " echo " "
echo " " echo " "
echo " " echo " "

58
wx
View File

@ -20,7 +20,7 @@ wxNormal=$(tput sgr0)
declare -Ax config declare -Ax config
wx-login() { wx-login(){
echo -n "$wxItalic" echo -n "$wxItalic"
echo " >> Login << " echo " >> Login << "
echo -n "$wxNormal"; echo -n "$wxNormal";
@ -210,7 +210,7 @@ wx-login() {
fi fi
} }
wx-start() { wx-start(){
echo "" echo ""
echo "" echo ""
echo "" echo ""
@ -221,7 +221,7 @@ wx-start() {
echo "==============================" echo "=============================="
} }
wx-stop () { wx-stop (){
echo " " echo " "
echo " " echo " "
echo " " echo " "
@ -239,7 +239,7 @@ wx-stop () {
exit 1 exit 1
} }
wx-help() { wx-help(){
echo -n "$wxItalic" echo -n "$wxItalic"
echo " >> Help << " echo " >> Help << "
echo -n "$wxNormal"; echo -n "$wxNormal";
@ -258,7 +258,7 @@ Management Commands:
"; ";
} }
wx-init () { wx-init(){
wx-login wx-login
echo -n "$wxItalic" echo -n "$wxItalic"
@ -276,7 +276,7 @@ wx-init () {
} }
wx-settings() { wx-settings(){
wx-login wx-login
echo -n "$wxItalic" echo -n "$wxItalic"
@ -285,7 +285,7 @@ wx-settings() {
echo "------------------------------" echo "------------------------------"
} }
wx-ssh() { wx-ssh(){
wx-login wx-login
case $1 in case $1 in
@ -306,7 +306,7 @@ wx-ssh() {
esac esac
} }
wx-welcome() { wx-welcome(){
echo -n "$wxItalic" echo -n "$wxItalic"
echo " >> Welcome << " echo " >> Welcome << "
echo -n "$wxNormal" echo -n "$wxNormal"
@ -328,32 +328,30 @@ wx-ssh-sign(){
echo -n "$wxNormal" echo -n "$wxNormal"
echo "------------------------------" echo "------------------------------"
NAME=warengroup if [[ $ORG == "warengroup" ]]
ROLE=sysadmin
PRINCIPALS=sysadmin
TTL=3600
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
then then
echo "$NAME/$ROLE" wx-ssh-sign-create warengroup sysadmin 3600
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 elif [[ $ORG == "cwinfo" ]]
fi
NAME=cwinfo
ROLE=sysadmin
PRINCIPALS=sysadmin
TTL=3600
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
then then
echo "$NAME/$ROLE" wx-ssh-sign-create cwinfo sysadmin 3600
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 elif [[ $ORG == "cwchristerw" ]]
then
wx-ssh-sign-create warengroup sysadmin 3600
wx-ssh-sign-create cwinfo sysadmin 3600
wx-ssh-sign-create cwchristew sysadmin 3600
fi fi
}
NAME=cwchristerw wx-ssh-sign-create(){
ROLE=sysadmin NAME=$1
PRINCIPALS=sysadmin ROLE=$2
TTL=3600 PRINCIPALS=$2
TTL=$3
if [[ ! -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
then
ssh-keygen -t ed25519 -f $HOME/.ssh/keys/$NAME-ed25519 -q -N "" &> /dev/null
fi
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]] if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
then then