17 lines
551 B
Plaintext
17 lines
551 B
Plaintext
function zssh_generate_privkey4
|
|
{
|
|
ssh_node="$1"
|
|
zshlibs_log zssh_client "checking keys for peer $ssh_node …"
|
|
local newkey=$zssh_private_keys/$ssh_node.key
|
|
if ! [[ -s $newkey ]]
|
|
then
|
|
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"
|
|
if [[ "$ssh_node" == "$zssh_host" ]]
|
|
then
|
|
zshlibs_log zssh_client "Self accepting key: $ssh_node"
|
|
cat "$newkey.pub" >> ${HOME}/.ssh/authorized_keys
|
|
fi
|
|
fi
|
|
}
|