/usr/share/secpanel/spdistkey is in secpanel 1:0.6.1-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #!/bin/bash
##########################################################################
# SecPanel.dist - Key-Distribution
# Shellscript for distributing public keys to remote hosts
#
# Version SecPanel 0.6.0
# Author: Steffen Leich-Nienhaus <steffen.leich _at_ gmail.com>
##########################################################################
if [ -z $4 ]
then
cat <<EOF
SecPanel 0.6.0 - key distribution
Shellscript for distributing public keys to remote hosts
Usage: spdistkey.sh <host> <port> <user> <keyfile> <sshbin>
EOF
exit 2
fi
HOST=$1
PORT=$2
USER=$3
IDENTITY=$4
SSHBIN=$5
if [ ! -s $IDENTITY ]
then
echo "Keyfile $IDENTITY does not exist or has size zero"
do_exit
fi
cat <<EOF
SecPanel - Distribution of public keys to remote hosts
------------------------------------------------------
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 -p $PORT $HOST "mkdir \$HOME/.ssh 2>/dev/null; grep '$(cat $IDENTITY)' \$HOME/.ssh/authorized_keys > /dev/null 2>&1"
DISTRET=$?
if [ $DISTRET = 0 ]
then
echo
echo " Your public key is already on the remote host"
echo
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
echo "Canceling the key-transfer"
do_exit
else
echo
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
fi
|