From owner-svn-src-stable-10@FreeBSD.ORG Sat Mar 8 03:54:50 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EC9AB4D9; Sat, 8 Mar 2014 03:54:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D7F5B2EB; Sat, 8 Mar 2014 03:54:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s283snaL017671; Sat, 8 Mar 2014 03:54:49 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s283snwc017668; Sat, 8 Mar 2014 03:54:49 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201403080354.s283snwc017668@svn.freebsd.org> From: Eitan Adler Date: Sat, 8 Mar 2014 03:54:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r262922 - stable/10/usr.bin/ssh-copy-id X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Mar 2014 03:54:50 -0000 Author: eadler Date: Sat Mar 8 03:54:49 2014 New Revision: 262922 URL: http://svnweb.freebsd.org/changeset/base/262922 Log: MFC r262645,r262647: ssh-copy-id: avoid sending private keys; add -v option To help avoid confusion: when attempting to send a key file check to see if a file of the same name exists with a '.pub' suffix and send that instead. This mimics the behavior of other ssh-copy-id scripts. Add -v passthrough. ssh-copy-id: add restorecon call In certain situations when creating an authorized_key file on a Linux machine restorecon(1) may need to be called. Therefore, attempt to run it if it exists. Modified: stable/10/usr.bin/ssh-copy-id/ssh-copy-id.1 stable/10/usr.bin/ssh-copy-id/ssh-copy-id.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/ssh-copy-id/ssh-copy-id.1 ============================================================================== --- stable/10/usr.bin/ssh-copy-id/ssh-copy-id.1 Sat Mar 8 03:39:15 2014 (r262921) +++ stable/10/usr.bin/ssh-copy-id/ssh-copy-id.1 Sat Mar 8 03:54:49 2014 (r262922) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 11, 2012 +.Dd Feburary 28, 2014 .Dt SSH-COPY-ID 1 .Os .Sh NAME @@ -33,7 +33,7 @@ .Nd copy public keys to a remote host .Sh SYNOPSIS .Nm -.Op Fl l +.Op Fl lv .Op Fl i Ar keyfile .Op Fl o Ar option .Op Fl p Ar port @@ -48,12 +48,14 @@ file (creating the file and directory, i The following options are available: .Bl -tag -width indent .It Fl i Ar file -Copy the key contained in +Copy the public key contained in .Ar file . This option can be specified multiple times and can be combined with the .Fl l option. +If a private key is specified and a public key is found then the public key +will be used. .It Fl l Copy the keys currently held by .Xr ssh-agent 1 . @@ -67,6 +69,9 @@ This option can be specified multiple ti .It Fl p Ar port Connect to the specified port on the remote host instead of the default. +.It Fl v +Pass -v to +.Xr ssh 1 . .El .Pp The remaining arguments are a list of remote hosts to connect to, Modified: stable/10/usr.bin/ssh-copy-id/ssh-copy-id.sh ============================================================================== --- stable/10/usr.bin/ssh-copy-id/ssh-copy-id.sh Sat Mar 8 03:39:15 2014 (r262921) +++ stable/10/usr.bin/ssh-copy-id/ssh-copy-id.sh Sat Mar 8 03:54:49 2014 (r262922) @@ -28,7 +28,7 @@ # $FreeBSD$ usage() { - echo "usage: ssh-copy-id [-l] [-i keyfile] [-o option] [-p port] [user@]hostname" >&2 + echo "usage: ssh-copy-id [-lv] [-i keyfile] [-o option] [-p port] [user@]hostname" >&2 exit 1 } @@ -46,6 +46,9 @@ sendkey() { printf "$alg $key $comment\n" >> "$keyfile" ; \ fi ; \ done \ + if [ -x /sbin/restorecon ]; then \ + /sbin/restorecon -F "$HOME/.ssh/" "$keyfile" >/dev/null 2>&1 || true ; \ + fi '\' } @@ -64,11 +67,13 @@ options="" IFS=$nl -while getopts 'i:lo:p:' arg; do +while getopts 'i:lo:p:v' arg; do case $arg in i) hasarg="x" - if [ -r "$OPTARG" ]; then + if [ -r "${OPTARG}.pub" ]; then + keys="$(cat -- "${OPTARG}.pub")$nl$keys" + elif [ -r "$OPTARG" ]; then keys="$(cat -- "$OPTARG")$nl$keys" else echo "File $OPTARG not found" >&2 @@ -85,6 +90,9 @@ while getopts 'i:lo:p:' arg; do o) options=$options$nl-o$nl$OPTARG ;; + v) + options="$options$nl-v" + ;; *) usage ;;