SOURCES: secpanel-distkeys_with_port.patch (NEW) - added distkey_with_port ...

blues blues at pld-linux.org
Fri Apr 10 10:39:15 CEST 2009


Author: blues                        Date: Fri Apr 10 08:39:15 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- added distkey_with_port patch - allow distribute keys when ssh port is
  not standard

---- Files affected:
SOURCES:
   secpanel-distkeys_with_port.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/secpanel-distkeys_with_port.patch
diff -u /dev/null SOURCES/secpanel-distkeys_with_port.patch:1.1
--- /dev/null	Fri Apr 10 10:39:16 2009
+++ SOURCES/secpanel-distkeys_with_port.patch	Fri Apr 10 10:39:09 2009
@@ -0,0 +1,83 @@
+--- ./usr/local/bin/secpanel.org	2009-04-10 10:34:38.274315429 +0200
++++ ./usr/local/bin/secpanel	2009-04-10 10:33:00.667776587 +0200
+@@ -977,7 +977,7 @@ proc distkey {key connectionprofiles} {
+ 	    }
+ 	}
+     
+-	set singleactstring "$libdir/secpanel.dist $host $user $key $configs(sshbin)"
++	set singleactstring "$libdir/secpanel.dist $host $port $user $key $configs(sshbin)"
+ 	set connstring "$connstring $singleactstring"
+ 	set connstring "$connstring \n\n\necho ==============================================================\n\n"
+ 
+--- ./usr/local/lib/secpanel/secpanel.dist.org	2009-04-10 10:34:59.994672725 +0200
++++ ./usr/local/lib/secpanel/secpanel.dist	2009-04-10 10:35:21.017525894 +0200
+@@ -8,23 +8,30 @@
+ # Author: Steffen Leich <steffen.leich _at_ gmail.com>
+ ##########################################################################
+ 
++function do_exit {
++	echo
++	echo -e "Key-Distribution finished\nPress <Return> to continue"
++	read
++	exit
++}
+ 
+-if [ -z $4 ]
++if [ -z $5 ]
+ then
+ cat <<EOF
+ 
+ 	SecPanel
+ 	Shellscript for distributing public keys to remote hosts
+-	Usage: secpanel_distkey.sh <host> <user> <keyfile> <sshbin>
++	Usage: secpanel_distkey.sh <host> <port> <user> <keyfile> <sshbin>
+ 
+ EOF
+     exit 2
+ fi
+ 
+ HOST=$1
+-USER=$2
+-IDENTITY=$3
+-SSHBIN=$4
++PORT=$2
++USER=$3
++IDENTITY=$4
++SSHBIN=$5
+ 
+ if [ ! -s $IDENTITY ]
+ then
+@@ -38,14 +45,14 @@ cat <<EOF
+     SecPanel - Distribution of public keys to remote hosts
+     ------------------------------------------------------
+ 
+-    Connecting to $HOST as $USER
++    Connecting to $HOST:$PORT as $USER
+     with key $IDENTITY
+ 
+     First we try to check if the key is already on the target host.
+ 
+ EOF
+ 
+-$SSHBIN -l $USER $HOST "mkdir \$HOME/.ssh 2>/dev/null; grep '$(cat $IDENTITY)' \$HOME/.ssh/authorized_keys > /dev/null 2>&1"
++$SSHBIN -l $USER -p $PORT $HOST "mkdir \$HOME/.ssh 2>/dev/null; grep '$(cat $IDENTITY)' \$HOME/.ssh/authorized_keys > /dev/null 2>&1"
+ 
+ DISTRET=$?
+ 
+@@ -58,7 +65,7 @@ elif [ $DISTRET = 255 ]
+ then
+     echo
+     echo "There was an error connecting to the remote site"
+-    echo -e "Parameters:\n\tHost:\t$HOST\n\tUser:\t$USER"
++    echo -e "Parameters:\n\tHost:\t$HOST:$PORT\n\tUser:\t$USER"
+     echo
+     echo "Canceling the key-transfer"
+     do_exit
+@@ -67,6 +74,6 @@ else
+     echo "    The key could not be found on this host"
+     echo "    -> Transfering your public key to remote host"
+     echo
+-    $SSHBIN -l $USER $HOST "cat >> \$HOME/.ssh/authorized_keys; chmod 600 \$HOME/.ssh/authorized_keys; chmod 700 \$HOME/.ssh" < $IDENTITY
++    $SSHBIN -l $USER -p $PORT $HOST "cat >> \$HOME/.ssh/authorized_keys; chmod 600 \$HOME/.ssh/authorized_keys; chmod 700 \$HOME/.ssh" < $IDENTITY
+ fi
+ 
================================================================


More information about the pld-cvs-commit mailing list