author | Michael Krelin <hacker@klever.net> | 2007-02-21 01:23:21 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-02-21 01:23:21 (UTC) |
commit | 25a40f8b84420e298951cfa163cd96eaf7b7c27f (patch) (side-by-side diff) | |
tree | 0ac471e04d3d177ab5ab1416da8c976cfaaea6fb /sys-apps | |
parent | b3277651c9c02a910e384b6633bf4b1915e6302a (diff) | |
download | misc-25a40f8b84420e298951cfa163cd96eaf7b7c27f.zip misc-25a40f8b84420e298951cfa163cd96eaf7b7c27f.tar.gz misc-25a40f8b84420e298951cfa163cd96eaf7b7c27f.tar.bz2 |
propakey
-rw-r--r-- | sys-apps/propakey/Manifest | 11 | ||||
-rw-r--r-- | sys-apps/propakey/files/digest-propakey-0.0 | 0 | ||||
-rwxr-xr-x | sys-apps/propakey/files/propakey-0.0 | 61 | ||||
-rw-r--r-- | sys-apps/propakey/propakey-0.0.ebuild | 15 |
4 files changed, 87 insertions, 0 deletions
diff --git a/sys-apps/propakey/Manifest b/sys-apps/propakey/Manifest new file mode 100644 index 0000000..649455b --- a/dev/null +++ b/sys-apps/propakey/Manifest @@ -0,0 +1,11 @@ +AUX propakey-0.0 1530 RMD160 7713dc4c36ba6bff2713b335f7bf9de213a71f39 SHA1 fdce48080a5aaf3c993d413b151fa8fbb6ff89da SHA256 e127ecd8432f071642b4c636689662998f0c8b9d65f8987f3635fe56914b90a5 +MD5 776280fea5e3a6046c68ac7573afdc8c files/propakey-0.0 1530 +RMD160 7713dc4c36ba6bff2713b335f7bf9de213a71f39 files/propakey-0.0 1530 +SHA256 e127ecd8432f071642b4c636689662998f0c8b9d65f8987f3635fe56914b90a5 files/propakey-0.0 1530 +EBUILD propakey-0.0.ebuild 329 RMD160 f87964ae69e7a3fed82b7f5f591da9ad86a96168 SHA1 b91f49f447154dd27cb95d535c11b0666a319c24 SHA256 3809afd746a30847403a24d534fef633f6fca3188eff1f7c237249b76be6be20 +MD5 0a34b80b74dd77960a91da3af93c161f propakey-0.0.ebuild 329 +RMD160 f87964ae69e7a3fed82b7f5f591da9ad86a96168 propakey-0.0.ebuild 329 +SHA256 3809afd746a30847403a24d534fef633f6fca3188eff1f7c237249b76be6be20 propakey-0.0.ebuild 329 +MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-propakey-0.0 0 +RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-propakey-0.0 0 +SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 files/digest-propakey-0.0 0 diff --git a/sys-apps/propakey/files/digest-propakey-0.0 b/sys-apps/propakey/files/digest-propakey-0.0 new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/sys-apps/propakey/files/digest-propakey-0.0 diff --git a/sys-apps/propakey/files/propakey-0.0 b/sys-apps/propakey/files/propakey-0.0 new file mode 100755 index 0000000..fc4ee16 --- a/dev/null +++ b/sys-apps/propakey/files/propakey-0.0 @@ -0,0 +1,61 @@ +#!/bin/bash +usage() { + echo + echo Usage: "${0}" "[options]" "[user@]host" "[identity-file]" + echo + echo " -h, --help, --usage display this text" + echo " -n <[user@]host>, --via <[user@]host>" + echo " establish connection via" + echo " specified account" + exit 1 +} +gop=`getopt -o n:h --long via:,help,usage -n propakey -- "$@"` +[ $? = 0 ] || usage +eval set -- "${gop}" +via="" +while true ; do + case "$1" in + -n|--via) via="$2" ; shift 2 ;; + -h|--help|--usage) echo "usage" ; usage ;; + --) shift ; break ;; + *) echo "Huh" ; usage ;; + esac +done + +dest="$1" +[ -z "${dest}" ] && usage + +keyfile="${2}" +if [ -e "${keyfile}.pub" ] ; then + keyfile="${keyfile}.pub" +else + if [ -e "${HOME}/.ssh/${keyfile}.pub" ] ; then + keyfile="${HOME}/.ssh/${keyfile}.pub" + else + if [ ! -z "${keyfile}" ] ; then + echo "Identity file not found" + exit 2 + fi + for f in ${HOME}/.ssh/{id_dsa,id_rsa,identity}.pub ; do + if [ -e $f ] ; then + keyfile="$f"; break; + fi + done + fi +fi + +echo "Propagating ssh key to ${dest}" +[ -z "${via}" ] || echo " via ${via}" +echo "Using identity file '${keyfile}'" +read kt k r <"${keyfile}" +cmd="ssh ${dest} \ + \"/bin/bash -c '\ + umask 077 ;\ + test ! -d .ssh && (mkdir .ssh || exit 1) ;\ + ( test -r .ssh/authorized_keys && grep -q ${k} .ssh/authorized_keys </dev/null) || ( echo Installing ssh key ; cat >> .ssh/authorized_keys ) \ + '\"" <"${keyfile}" +if [ -z "${via}" ] ; then + eval ${cmd} <"${keyfile}" +else + ssh ${via} ${cmd} <"${keyfile}" +fi diff --git a/sys-apps/propakey/propakey-0.0.ebuild b/sys-apps/propakey/propakey-0.0.ebuild new file mode 100644 index 0000000..3261d47 --- a/dev/null +++ b/sys-apps/propakey/propakey-0.0.ebuild @@ -0,0 +1,15 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +DESCRIPTION="A script to propagate ssh public identity" +HOMEPAGE="http://hacker.klever.net/" +LICENSE="MIT" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="" +DEPEND="" + +src_install() { + newbin ${FILESDIR}/${PF} ${PN} +} |