aboutsummaryrefslogtreecommitdiff
path: root/security/ssh-copy-id
diff options
context:
space:
mode:
authorEmanuel Haupt <ehaupt@FreeBSD.org>2011-01-14 17:32:37 +0000
committerEmanuel Haupt <ehaupt@FreeBSD.org>2011-01-14 17:32:37 +0000
commit134ed538c22a44cc3dae9289a080540f0c256599 (patch)
tree60841894458eeb8e1d476972b65cf9e3919e4a46 /security/ssh-copy-id
parent9440723061329f10db7418260e3a2ae63dd93b1a (diff)
downloadports-134ed538c22a44cc3dae9289a080540f0c256599.tar.gz
ports-134ed538c22a44cc3dae9289a080540f0c256599.zip
Notes
Diffstat (limited to 'security/ssh-copy-id')
-rw-r--r--security/ssh-copy-id/Makefile31
-rw-r--r--security/ssh-copy-id/files/ssh-copy-id54
-rw-r--r--security/ssh-copy-id/files/ssh-copy-id.175
-rw-r--r--security/ssh-copy-id/pkg-descr4
4 files changed, 164 insertions, 0 deletions
diff --git a/security/ssh-copy-id/Makefile b/security/ssh-copy-id/Makefile
new file mode 100644
index 000000000000..9ad57e35e474
--- /dev/null
+++ b/security/ssh-copy-id/Makefile
@@ -0,0 +1,31 @@
+# New ports collection makefile for: ssh-copy-id
+# Date created: 14 Jan 2011
+# Whom: Emanuel Haupt <ehaupt@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= ssh-copy-id
+PORTVERSION= 5.6p1
+CATEGORIES= security
+MASTER_SITES= # none
+DISTFILES= # none
+
+MAINTAINER= ehaupt@FreeBSD.org
+COMMENT= Small script which copy your ssh public-key to a remote host
+
+NO_BUILD= yes
+
+MAN1= ssh-copy-id.1
+PLIST_FILES= bin/ssh-copy-id
+
+pre-patch:
+.for f in ssh-copy-id ssh-copy-id.1
+ @${CP} ${FILESDIR}/${f} ${WRKDIR}
+.endfor
+
+do-install:
+ ${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME} ${PREFIX}/bin
+ ${INSTALL_MAN} ${WRKDIR}/${MAN1} ${MANPREFIX}/man/man1
+
+.include <bsd.port.mk>
diff --git a/security/ssh-copy-id/files/ssh-copy-id b/security/ssh-copy-id/files/ssh-copy-id
new file mode 100644
index 000000000000..368645cb4fc7
--- /dev/null
+++ b/security/ssh-copy-id/files/ssh-copy-id
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# Shell script to install your public key on a remote machine
+# Takes the remote machine name as an argument.
+# Obviously, the remote machine must accept password authentication,
+# or one of the other keys in your ssh-agent, for this to work.
+
+ID_FILE="${HOME}/.ssh/id_rsa.pub"
+
+if [ "-i" = "$1" ]; then
+ shift
+ # check if we have 2 parameters left, if so the first is the new ID file
+ if [ -n "$2" ]; then
+ if expr "$1" : ".*\.pub" > /dev/null ; then
+ ID_FILE="$1"
+ else
+ ID_FILE="$1.pub"
+ fi
+ shift # and this should leave $1 as the target name
+ fi
+else
+ if [ x$SSH_AUTH_SOCK != x ] && ssh-add -L >/dev/null 2>&1; then
+ GET_ID="$GET_ID ssh-add -L"
+ fi
+fi
+
+if [ -z "`eval $GET_ID`" ] && [ -r "${ID_FILE}" ] ; then
+ GET_ID="cat ${ID_FILE}"
+fi
+
+if [ -z "`eval $GET_ID`" ]; then
+ echo "$0: ERROR: No identities found" >&2
+ exit 1
+fi
+
+if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+ echo "Usage: $0 [-i [identity_file]] [user@]machine" >&2
+ exit 1
+fi
+
+# strip any trailing colon
+host=`echo $1 | sed 's/:$//'`
+
+{ eval "$GET_ID" ; } | ssh $host "umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys" || exit 1
+
+cat <<EOF
+Now try logging into the machine, with "ssh '$host'", and check in:
+
+ ~/.ssh/authorized_keys
+
+to make sure we haven't added extra keys that you weren't expecting.
+
+EOF
+
diff --git a/security/ssh-copy-id/files/ssh-copy-id.1 b/security/ssh-copy-id/files/ssh-copy-id.1
new file mode 100644
index 000000000000..cb15ab24dbc4
--- /dev/null
+++ b/security/ssh-copy-id/files/ssh-copy-id.1
@@ -0,0 +1,75 @@
+.ig \" -*- nroff -*-
+Copyright (c) 1999 Philip Hands Computing <http://www.hands.com/>
+
+Permission is granted to make and distribute verbatim copies of
+this manual provided the copyright notice and this permission notice
+are preserved on all copies.
+
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided that the
+entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be included in
+translations approved by the Free Software Foundation instead of in
+the original English.
+..
+.TH SSH-COPY-ID 1 "14 November 1999" "OpenSSH"
+.SH NAME
+ssh-copy-id \- install your public key in a remote machine's authorized_keys
+.SH SYNOPSIS
+.B ssh-copy-id [-i [identity_file]]
+.I "[user@]machine"
+.br
+.SH DESCRIPTION
+.BR ssh-copy-id
+is a script that uses ssh to log into a remote machine and
+append the indicated identity file to that machine's
+.B ~/.ssh/authorized_keys
+file.
+.PP
+If the
+.B -i
+option is given then the identity file (defaults to
+.BR ~/.ssh/id_rsa.pub )
+is used, regardless of whether there are any keys in your
+.BR ssh-agent .
+Otherwise, if this:
+.PP
+.B " ssh-add -L"
+.PP
+provides any output, it uses that in preference to the identity file.
+.PP
+If the
+.B -i
+option is used, or the
+.B ssh-add
+produced no output, then it uses the contents of the identity
+file. Once it has one or more fingerprints (by whatever means) it
+uses ssh to append them to
+.B ~/.ssh/authorized_keys
+on the remote machine (creating the file, and directory, if necessary.)
+
+.SH NOTES
+This program does not modify the permissions of any
+pre-existing files or directories. Therefore, if the remote
+.B sshd
+has
+.B StrictModes
+set in its
+configuration, then the user's home,
+.B ~/.ssh
+folder, and
+.B ~/.ssh/authorized_keys
+file may need to have group writability disabled manually, e.g. via
+
+.B " chmod go-w ~ ~/.ssh ~/.ssh/authorized_keys"
+
+on the remote machine.
+
+.SH "SEE ALSO"
+.BR ssh (1),
+.BR ssh-agent (1),
+.BR sshd (8)
diff --git a/security/ssh-copy-id/pkg-descr b/security/ssh-copy-id/pkg-descr
new file mode 100644
index 000000000000..9f90f8efd4e9
--- /dev/null
+++ b/security/ssh-copy-id/pkg-descr
@@ -0,0 +1,4 @@
+ssh-copy-id is a small script which copy your ssh public-key to a remote host;
+appending it to your remote authorized_keys.
+
+WWW: http://www.openssh.com/portable.html