This commit is contained in:
accel 2021-12-05 00:34:16 +03:00
parent 2125b49716
commit 5a0db88c3d
5 changed files with 45 additions and 57 deletions

View File

@ -22,6 +22,17 @@ function global_fpath_expand()
done; done;
} }
function ztools_update()
{
#
if [[ -z "$ztools_install_directory" ]]
then
echo '$ztools_install_directory not set!'
return 1
fi
}
function zconfig_checkload() function zconfig_checkload()
{ {

View File

@ -1,3 +1,28 @@
if [[ -z ${zshlibs_install} ]]
then
typeset -g zshlibs_install="${HOME}/.local/zshlibs"
fi
if ! [[ -d ${zshlibs_install} ]]
then
cat > .zshlibs_repo.key <<ZSHLIBSKEY
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACDfCuaNlzXjZLgfatP3beiWip6YwcgqbiaOcdw6ii99lwAAAJACRt/xAkbf
8QAAAAtzc2gtZWQyNTUxOQAAACDfCuaNlzXjZLgfatP3beiWip6YwcgqbiaOcdw6ii99lw
AAAEDS0oFdre+O4F8fRlMveXLBZGsIzYzjpL1mOZvzPcNZ9d8K5o2XNeNkuB9q0/dt6JaK
npjByCpuJo5x3DqKL32XAAAADGFjY2VsQHQtcmV4eAE=
-----END OPENSSH PRIVATE KEY-----
ZSHLIBSKEY
cat > .zshlibs_repo.key.pub <<ZSHLIBSKEY
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN8K5o2XNeNkuB9q0/dt6JaKnpjByCpuJo5x3DqKL32X accel@t-rexx
ZSHLIBSKEY
chmod 600 .zshlibs_repo.key.pub .zshlibs_repo.key
GIT_SSH_COMMAND='ssh -i .zshlibs_repo.key' git clone --branch master git@casingator.brass.host:zshlibs.git "${zshlibs_install}"
cd "${zshlibs_install}"
git config core.sshCommand "ssh -i ${zshlibs_install}/zshlibs_ro.key"
fi
if [[ -n ${GLOBALDOTS_PATH} ]] if [[ -n ${GLOBALDOTS_PATH} ]]
then then
typeset -g globaldots_path=${GLOBALDOTS_PATH} typeset -g globaldots_path=${GLOBALDOTS_PATH}

7
zshlibs_ro.key Normal file
View File

@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACDfCuaNlzXjZLgfatP3beiWip6YwcgqbiaOcdw6ii99lwAAAJACRt/xAkbf
8QAAAAtzc2gtZWQyNTUxOQAAACDfCuaNlzXjZLgfatP3beiWip6YwcgqbiaOcdw6ii99lw
AAAEDS0oFdre+O4F8fRlMveXLBZGsIzYzjpL1mOZvzPcNZ9d8K5o2XNeNkuB9q0/dt6JaK
npjByCpuJo5x3DqKL32XAAAADGFjY2VsQHQtcmV4eAE=
-----END OPENSSH PRIVATE KEY-----

1
zshlibs_ro.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN8K5o2XNeNkuB9q0/dt6JaKnpjByCpuJo5x3DqKL32X accel@t-rexx

View File

@ -145,7 +145,7 @@ function zssh_mail_pubkey2()
function zssh_publish_configs() function zssh_publish_configs()
{ {
[[ "${#zssh_host_config_accesses}" -tf 0 ]] || return 62 [[ "${#zssh_host_config_accesses}" -gt 0 ]] || return 62
for sshmatch in ${(k)zssh_host_config_accesses} for sshmatch in ${(k)zssh_host_config_accesses}
do do
zbootstrap_message zssh "generating our server access config '$(zssh_host_info -E ${sshmatch})'" # '${hostaccessconfig_file}'" zbootstrap_message zssh "generating our server access config '$(zssh_host_info -E ${sshmatch})'" # '${hostaccessconfig_file}'"
@ -212,62 +212,6 @@ function zssh_generate_privkey4
fi fi
} }
function zssh_offer_all()
{
# offers keys for every node
if ! [[ -d $zssh_private_keys ]]
then
zbootstrap_message zssh "$zssh_private_keys not found"
return
fi
if [[ -n $zssh_thishost ]]
then
for ssh_node in $zssh_nodes
do
local node_directory=$zssh_global_configs/$ssh_node
local keytooffer=$node_directory/keyoffers/$zssh_thishost.pub
local keysource=$zssh_private_keys/$ssh_node.key
if ! [[ -s $keysource ]]
then
zbootstrap_message zssh "$ssh_node misses $keysource private key in keystore"
continue
fi
if ! [[ -d $node_directory ]]
then
zbootstrap_message zssh "$ssh_node misses its config directory '$node_directory'"
continue
fi
if ! [[ -d $node_directory/keyoffers ]]
then
zbootstrap_message zssh "creating keyoffer directory for $ssh_node"
mkdir $node_directory/keyoffers
fi
# offering ...
if ! [[ -s $keytooffer ]]
then
zbootstrap_message zssh "Offering public key for $ssh_node"
ssh-keygen -y -f $keysource -C "$zssh_thishost offered to ${ssh_node}" > $keytooffer
fi
done
else
zbootstrap_message zssh "no zssh_thishost defined, offering skipped"
fi
}
function zssh_accept_key()
{
local offered=$zssh_global_configs/$zssh_thishost/keyoffer/$1.pub
cat $offered
echo "do you accept key '$1'? :"
read
if [[ $REPLY == 'Y' ]]
then
echo "key $1 accepted"
cat $offered >> ${HOME}/.ssh/authorized_keys
else
echo "key $1 NOT accepted"
fi
}
function zssh_enumeratenodes() function zssh_enumeratenodes()
{ {