From 09e9775127c7def49202e68c923e36a6032a3628 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Mon, 12 May 2014 00:06:32 +0000 Subject: glusterd/geo-rep: Allow gverify.sh and S56glusterd-geo-rep-create-post.sh to operate for non-root privileged slave volume Mounting the slave-volume on local node, to perform disk checks in order to allow gverify.sh to operate for non-root privileged slave volume Allowing the hook script S56glusterd-geo-rep-create-post.sh to operate for non-root privileged slave volume Modified peer_add_secret_pub.in to accept username as argument and add the pem keys to the users's_home_dir/.ssh/authorized_keys Wrote set_geo_rep_pem_keys.sh which accepts username as argument and copies the pem keys from the user's home directory to $GLUSTERD_WORKING_DIR/geo-replication/ and then copies the keys to other nodes in the cluster and add them to the respective authorized keys. The script takes as argument the user name and assumes that the user will be present in all the nodes in the cluster. It is not needed for root. To summarize: For a privileged slave user, execute the following on master node as super user: gluster system:: execute gsec_create gluster volume geo-replication [root@]:: create push_pem For a non-privileged slave user execute the following on master node as super user: gluster system:: execute gsec_create gluster volume geo-replication @:: create push_pem then on the slave node execute the following as super user: /usr/local/libexec/glusterfs/set_geo_rep_pem_keys.sh BUG: 1077452 Change-Id: I88020968aa5b13a2c2ab86b1d6661b60071f6f5e Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7744 Tested-by: Gluster Build System Reviewed-by: Venky Shankar Tested-by: Venky Shankar --- geo-replication/src/peer_add_secret_pub.in | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'geo-replication/src/peer_add_secret_pub.in') diff --git a/geo-replication/src/peer_add_secret_pub.in b/geo-replication/src/peer_add_secret_pub.in index c036cf3341..04dee1b1ea 100644 --- a/geo-replication/src/peer_add_secret_pub.in +++ b/geo-replication/src/peer_add_secret_pub.in @@ -1,9 +1,20 @@ #!/bin/bash -if [ ! -d ~/.ssh ]; then - mkdir ~/.ssh; - chmod 700 ~/.ssh - chown root:root ~/.ssh +if [ "$1" == "" ]; then + home_dir=`echo $HOME` +else + home_dir=`getent passwd | grep $1 | cut -d ':' -f 6`; fi -cat "$GLUSTERD_WORKING_DIR"/geo-replication/common_secret.pem.pub >> ~/.ssh/authorized_keys +if [ "$home_dir" == "" ]; then + echo "Invalid User"; + exit 1; +fi + +if [ ! -d $home_dir/.ssh ]; then + mkdir $home_dir/.ssh; + chmod 700 $home_dir/.ssh; + chown root:root $home_dir/.ssh; +fi + +cat "$GLUSTERD_WORKING_DIR"/geo-replication/common_secret.pem.pub >> $home_dir/.ssh/authorized_keys; -- cgit