copie de la bonne clef sur les noeuds

This commit is contained in:
Emmanuel Garette 2019-02-22 17:05:11 +01:00
parent a640384c5b
commit f945e19efb

View File

@ -7,23 +7,23 @@
. /usr/lib/eole/ihm.sh . /usr/lib/eole/ihm.sh
# #
# NAME: copy_ssh_id # NAME: copy_ssh_id
# AIM: Copy the ssh key on the host # AIM: Copy the ssh key on the host
# PARAM: the hostname of the node # PARAM: the hostname of the node
# #
function copy_ssh_id() function copy_ssh_id()
{ {
local ip=${1} local host=${1}
ssh ${ip} bash -s <<EOF CLEF=$(cat ~oneadmin/.ssh/id_rsa.pub)
echo $(cat ~oneadmin/.ssh/id_rsa.pub) > /tmp/one-master.key.pub ssh ${host} bash -s <<EOF
if ! grep -qs /tmp/one-master.key.pub ~oneadmin/.ssh/authorized_keys if ! grep -qs $CLEF ~oneadmin/.ssh/authorized_keys
then then
cat /tmp/one-master.key.pub >> ~oneadmin/.ssh/authorized_keys echo $CLEF >> ~oneadmin/.ssh/authorized_keys
chown oneadmin:oneadmin ~oneadmin/.ssh/authorized_keys chown oneadmin:oneadmin ~oneadmin/.ssh/authorized_keys
fi fi
rm -f /tmp/one-master.key.pub
EOF EOF
su - oneadmin -c "ssh-keyscan $host"
return ${?} return ${?}
} }
@ -42,7 +42,7 @@ function register_node()
# #
# NAME: wait_node_ok # NAME: wait_node_ok
# AIM: Wait until the node is OK or ERROR # AIM: Wait until the node is OK or ERROR
# PARAM: The node name # PARAM: The node name
# #
function wait_node_ok() function wait_node_ok()
{ {