diff options
Diffstat (limited to 'geo-replication')
-rw-r--r-- | geo-replication/src/Makefile.am | 2 | ||||
-rw-r--r-- | geo-replication/src/peer_add_secret_pub.in | 71 | ||||
-rwxr-xr-x | geo-replication/src/set_geo_rep_pem_keys.sh | 2 |
3 files changed, 2 insertions, 73 deletions
diff --git a/geo-replication/src/Makefile.am b/geo-replication/src/Makefile.am index 512128dfd2d..e9d6bc1a27e 100644 --- a/geo-replication/src/Makefile.am +++ b/geo-replication/src/Makefile.am @@ -1,6 +1,6 @@ gsyncddir = $(libexecdir)/glusterfs -gsyncd_SCRIPTS = gverify.sh peer_add_secret_pub peer_gsec_create \ +gsyncd_SCRIPTS = gverify.sh peer_gsec_create \ set_geo_rep_pem_keys.sh peer_mountbroker # peer_gsec_create and peer_add_secret_pub are not added to diff --git a/geo-replication/src/peer_add_secret_pub.in b/geo-replication/src/peer_add_secret_pub.in deleted file mode 100644 index 1fc31642c8a..00000000000 --- a/geo-replication/src/peer_add_secret_pub.in +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -user=$1 -mastervol=$2 -slavevol=$3 - -if [ "$user" == "" ]; then - echo "Invalid User"; - exit 1; -fi - -if [ "$mastervol" == "" ]; then - echo "Invalid master volume"; - exit 1; -fi - -if [ "$slavevol" == "" ]; then - echo "Invalid slave volume"; - exit 1; -fi - -home_dir=`getent passwd $user | cut -d ':' -f 6`; - -if [ "$home_dir" == "" ]; then - echo "Invalid home dir"; - exit 1; -fi - -authorized_keys_file=$(cat /etc/ssh/sshd_config | \ - grep -e "^AuthorizedKeysFile" | \ - awk '{print $2}' | tail -1); - -# If not set, use default location -if [ "x$authorized_keys_file" == "x" ]; then - authorized_keys_file="%h/.ssh/authorized_keys" -fi - -# If default location -if [ "$authorized_keys_file" == ".ssh/authorized_keys" ]; then - authorized_keys_file="%h/$authorized_keys_file" -fi - -# Replace %u with user name (ex: /etc/ssh/keys/%u/authorized_keys) -authorized_keys_file="${authorized_keys_file//%u/$user}"; - -# Replace %h with home dir (ex: %h/.ssh/authorized_keys) -authorized_keys_file="${authorized_keys_file//%h/$home_dir}"; -ssh_dir=$(dirname $authorized_keys_file); - -if [ ! -d $ssh_dir ]; then - mkdir $ssh_dir; - chmod 700 $ssh_dir; - chown $user: $ssh_dir; -fi - -if [ ! -d $authorized_keys_file ]; then - touch $authorized_keys_file; - chmod 600 $authorized_keys_file; - chown $user: $authorized_keys_file; -fi - -pub_file=${mastervol}_${slavevol}_common_secret.pem.pub - -# Add to authorized_keys file only if not exists already -while read line -do - grep -Fxq "$line" $authorized_keys_file; - [ $? -ne 0 ] && echo "$line" >> $authorized_keys_file; -done < "$GLUSTERD_WORKDIR"/geo-replication/$pub_file; - -exit 0; diff --git a/geo-replication/src/set_geo_rep_pem_keys.sh b/geo-replication/src/set_geo_rep_pem_keys.sh index c7cbdf36e4b..4f613da28df 100755 --- a/geo-replication/src/set_geo_rep_pem_keys.sh +++ b/geo-replication/src/set_geo_rep_pem_keys.sh @@ -45,7 +45,7 @@ function main() if [ -f $home_dir/${COMMON_SECRET_PEM_PUB} ]; then cp $home_dir/${COMMON_SECRET_PEM_PUB} ${GLUSTERD_WORKDIR}/geo-replication/ gluster system:: copy file /geo-replication/${COMMON_SECRET_PEM_PUB} - gluster system:: execute add_secret_pub $user ${master_vol} ${slave_vol} + gluster system:: execute add_secret_pub $user geo-replication/${master_vol}_${slave_vol}_common_secret.pem.pub else echo "$home_dir/common_secret.pem.pub not present. Please run geo-replication command on master with push-pem option to generate the file" exit 1; |