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 -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

42
wx
View File

@ -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