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

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

42
wx
View File

@ -328,32 +328,30 @@ wx-ssh-sign(){
echo -n "$wxNormal"
echo "------------------------------"
NAME=warengroup
ROLE=sysadmin
PRINCIPALS=sysadmin
TTL=3600
if [[ -f "$HOME/.ssh/keys/$NAME-ed25519" ]]
if [[ $ORG == "warengroup" ]]
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" ]]
wx-ssh-sign-create warengroup sysadmin 3600
elif [[ $ORG == "cwinfo" ]]
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
wx-ssh-sign-create cwinfo sysadmin 3600
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
}
NAME=cwchristerw
ROLE=sysadmin
PRINCIPALS=sysadmin
TTL=3600
wx-ssh-sign-create(){
NAME=$1
ROLE=$2
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" ]]
then