pgpool2.git / summary / log / commit / refs
commit 6da130cf2bd407742e8de15c1972dde5f8308f9e
Author: Yugo Nagata <nagata@sraoss.co.jp>
Commit: Muhammad Usama <m.usama@gmail.com>
Date: Thu Dec 12 09:29:39 2013 +0000
Fix to set up passwordless SSH from apache@localhost to postgres@localhost
src/redhat/rpm_installer/install.sh | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/src/redhat/rpm_installer/install.sh b/src/redhat/rpm_installer/install.sh
index da003ee31..467b07e71 100644
--- a/src/redhat/rpm_installer/install.sh
+++ b/src/redhat/rpm_installer/install.sh
@@ -825,19 +825,23 @@ function copySbin()
function sshWithoutPass()
{
local _THIS_USER=$1
+ local _REMOTE_HOST=$2
local _HOME=`eval echo ~$_THIS_USER`
local _SSH_DIR=$_HOME/.ssh
- rm $_SSH_DIR/id_rsa* >/dev/null 2>&1
- su - $_THIS_USER -c "ssh-keygen -q -t rsa -P '' -f $_SSH_DIR/id_rsa << EOF
+ if [ ! -e $_SSH_DIR/id_rsa ]; then
+ rm $_SSH_DIR/id_rsa* >/dev/null 2>&1
+ su - $_THIS_USER -c "ssh-keygen -q -t rsa -P '' -f $_SSH_DIR/id_rsa << EOF
EOF"
+ fi
+
if [ $? -ne 0 ]; then return 1; fi
- ssh-copy-id -i $_SSH_DIR/id_rsa.pub $PG_SUPER_USER@$DEST_HOST > /dev/null 2>&1
+ ssh-copy-id -i $_SSH_DIR/id_rsa.pub $PG_SUPER_USER@$_REMOTE_HOST > /dev/null 2>&1
if [ $? -ne 0 ]; then return 1; fi
- su - $_THIS_USER -c "ssh -o StrictHostKeyChecking=no $PG_SUPER_USER@$DEST_HOST exit" > /dev/null 2>&1
+ su - $_THIS_USER -c "ssh -o StrictHostKeyChecking=no $PG_SUPER_USER@$_REMOTE_HOST exit" > /dev/null 2>&1
if [ $? -ne 0 ]; then return 1; fi
return 0
@@ -1048,7 +1052,7 @@ echo
echo "* Setup password-less access over ssh"
echo
echo "Try ssh: $PG_SUPER_USER@$THIS_HOST (this host) -> $PG_SUPER_USER@$DEST_HOST (another host)"
-sshWithoutPass $PG_SUPER_USER
+sshWithoutPass $PG_SUPER_USER $DEST_HOST
if [ $? -ne 0 ]; then
echo "Failed to ssh $PG_SUPER_USER@$DEST_HOST (another host)."
exit 1
@@ -1063,7 +1067,7 @@ if [ $? -ne 0 ]; then
echo "Failed to make apache loginable. For configuring apache user, httpd must be stopped."
exit 1
fi
-sshWithoutPass $APACHE_USER
+sshWithoutPass $APACHE_USER $DEST_HOST
if [ $? -ne 0 ]; then
echo "Failed to ssh $PG_SUPER_USER@$DEST_HOST."
exit 1
@@ -1071,6 +1075,21 @@ else
echo "OK."
fi
+echo
+echo "Try ssh: $APACHE_USER@$THIS_HOST (this host) -> $PG_SUPER_USER@$THIS_HOST (this host)"
+makeApacheLoginable
+if [ $? -ne 0 ]; then
+ echo "Failed to make apache loginable. For configuring apache user, httpd must be stopped."
+ exit 1
+fi
+sshWithoutPass $APACHE_USER $THIS_HOST
+if [ $? -ne 0 ]; then
+ echo "Failed to ssh $PG_SUPER_USER@$THIS_HOST."
+ exit 1
+else
+ echo "OK."
+fi
+
# -------------------------------------------------------------------
# 4. netmask (in only node 0)
[parent: 7095e4d686d2]