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 " >> Help << "
echo -n "$wxNormal";

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

58
wx
View File

@ -20,7 +20,7 @@ wxNormal=$(tput sgr0)
declare -Ax config
wx-login() {
wx-login(){
echo -n "$wxItalic"
echo " >> Login << "
echo -n "$wxNormal";
@ -210,7 +210,7 @@ wx-login() {
fi
}
wx-start() {
wx-start(){
echo ""
echo ""
echo ""
@ -221,7 +221,7 @@ wx-start() {
echo "=============================="
}
wx-stop () {
wx-stop (){
echo " "
echo " "
echo " "
@ -239,7 +239,7 @@ wx-stop () {
exit 1
}
wx-help() {
wx-help(){
echo -n "$wxItalic"
echo " >> Help << "
echo -n "$wxNormal";
@ -258,7 +258,7 @@ Management Commands:
";
}
wx-init () {
wx-init(){
wx-login
echo -n "$wxItalic"
@ -276,7 +276,7 @@ wx-init () {
}
wx-settings() {
wx-settings(){
wx-login
echo -n "$wxItalic"
@ -285,7 +285,7 @@ wx-settings() {
echo "------------------------------"
}
wx-ssh() {
wx-ssh(){
wx-login
case $1 in
@ -306,7 +306,7 @@ wx-ssh() {
esac
}
wx-welcome() {
wx-welcome(){
echo -n "$wxItalic"
echo " >> Welcome << "
echo -n "$wxNormal"
@ -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