This commit is contained in:
accel 2022-01-11 21:22:39 +03:00
parent e994994c38
commit 1a05895f73

View File

@ -113,10 +113,10 @@ function zssh_check_pubkeys()
function zssh_install_peers() function zssh_install_peers()
{ {
[[ -n $zssh_host ]] || return 63 [[ -n $zssh_host ]] || return 63
zshlibs_log zssh "installing peers" zshlibs_log zssh_client "installing peers"
for ssh_node in $zssh_nodes for ssh_node in $zssh_nodes
do do
zshlibs_log zssh "installing peer $ssh_node" zshlibs_log zssh_client "installing peer $ssh_node"
zssh_generate_privkey4 $ssh_node zssh_generate_privkey4 $ssh_node
zssh_generate_config4 $ssh_node zssh_generate_config4 $ssh_node
done done
@ -204,15 +204,15 @@ function zssh_generate_config4
function zssh_generate_privkey4 function zssh_generate_privkey4
{ {
ssh_node="$1" ssh_node="$1"
zshlibs_log zssh "checking keys for peer $ssh_node" zshlibs_log zssh_client "checking keys for peer $ssh_node"
local newkey=$zssh_private_keys/$ssh_node.key local newkey=$zssh_private_keys/$ssh_node.key
if ! [[ -s $newkey ]] if ! [[ -s $newkey ]]
then then
zshlibs_log zssh "generate key for $ssh_node" zshlibs_log zssh_client "generate key for $ssh_node"
ssh-keygen -t ed25519 -N '' -C "$ssh_host($USER@$HOST) for $ssh_node" -f $newkey >> "${HOME}/.log/ssh-keygen.log" ssh-keygen -t ed25519 -N '' -C "$ssh_host($USER@$HOST) for $ssh_node" -f $newkey >> "${HOME}/.log/ssh-keygen.log"
if [[ "$ssh_node" == "$zssh_host" ]] if [[ "$ssh_node" == "$zssh_host" ]]
then then
zshlibs_log zssh "Self accepting key: $ssh_node" zshlibs_log zssh_client "Self accepting key: $ssh_node"
cat "$newkey.pub" >> ${HOME}/.ssh/authorized_keys cat "$newkey.pub" >> ${HOME}/.ssh/authorized_keys
fi fi
fi fi
@ -222,7 +222,7 @@ function zssh_generate_privkey4
function zssh_enumeratenodes() function zssh_enumeratenodes()
{ {
typeset -g -a zssh_nodes; typeset -g -a zssh_nodes;
zshlibs_log zssh "enumerating nodes" zshlibs_log zssh_configure "enumerating nodes"
if [[ -d $zssh_global_configs ]] if [[ -d $zssh_global_configs ]]
then then
for __ssh_node in ${zssh_global_configs}/*(/) for __ssh_node in ${zssh_global_configs}/*(/)
@ -230,5 +230,5 @@ function zssh_enumeratenodes()
zssh_nodes+=($(basename $__ssh_node)) zssh_nodes+=($(basename $__ssh_node))
done done
fi fi
zshlibs_log zssh "got ${#zssh_nodes} nodes" zshlibs_log zssh_configure "got ${#zssh_nodes} nodes"
} }