summaryrefslogtreecommitdiff
authorMichael Krelin <hacker@klever.net>2007-02-21 01:23:21 (UTC)
committer Michael Krelin <hacker@klever.net>2007-02-21 01:23:21 (UTC)
commit25a40f8b84420e298951cfa163cd96eaf7b7c27f (patch) (unidiff)
tree0ac471e04d3d177ab5ab1416da8c976cfaaea6fb
parentb3277651c9c02a910e384b6633bf4b1915e6302a (diff)
downloadmisc-25a40f8b84420e298951cfa163cd96eaf7b7c27f.zip
misc-25a40f8b84420e298951cfa163cd96eaf7b7c27f.tar.gz
misc-25a40f8b84420e298951cfa163cd96eaf7b7c27f.tar.bz2
propakey
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--profiles/categories1
-rw-r--r--sys-apps/propakey/Manifest11
-rw-r--r--sys-apps/propakey/files/digest-propakey-0.00
-rwxr-xr-xsys-apps/propakey/files/propakey-0.061
-rw-r--r--sys-apps/propakey/propakey-0.0.ebuild15
5 files changed, 88 insertions, 0 deletions
diff --git a/profiles/categories b/profiles/categories
index fa0e69f..c9b98ed 100644
--- a/profiles/categories
+++ b/profiles/categories
@@ -1,2 +1,3 @@
1sys-apps
1www-misc 2www-misc
2x11-plugins 3x11-plugins
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 @@
1AUX propakey-0.0 1530 RMD160 7713dc4c36ba6bff2713b335f7bf9de213a71f39 SHA1 fdce48080a5aaf3c993d413b151fa8fbb6ff89da SHA256 e127ecd8432f071642b4c636689662998f0c8b9d65f8987f3635fe56914b90a5
2MD5 776280fea5e3a6046c68ac7573afdc8c files/propakey-0.0 1530
3RMD160 7713dc4c36ba6bff2713b335f7bf9de213a71f39 files/propakey-0.0 1530
4SHA256 e127ecd8432f071642b4c636689662998f0c8b9d65f8987f3635fe56914b90a5 files/propakey-0.0 1530
5EBUILD propakey-0.0.ebuild 329 RMD160 f87964ae69e7a3fed82b7f5f591da9ad86a96168 SHA1 b91f49f447154dd27cb95d535c11b0666a319c24 SHA256 3809afd746a30847403a24d534fef633f6fca3188eff1f7c237249b76be6be20
6MD5 0a34b80b74dd77960a91da3af93c161f propakey-0.0.ebuild 329
7RMD160 f87964ae69e7a3fed82b7f5f591da9ad86a96168 propakey-0.0.ebuild 329
8SHA256 3809afd746a30847403a24d534fef633f6fca3188eff1f7c237249b76be6be20 propakey-0.0.ebuild 329
9MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-propakey-0.0 0
10RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-propakey-0.0 0
11SHA256 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 @@
1#!/bin/bash
2usage() {
3 echo
4 echo Usage: "${0}" "[options]" "[user@]host" "[identity-file]"
5 echo
6 echo " -h, --help, --usage display this text"
7 echo " -n <[user@]host>, --via <[user@]host>"
8 echo " establish connection via"
9 echo " specified account"
10 exit 1
11}
12gop=`getopt -o n:h --long via:,help,usage -n propakey -- "$@"`
13[ $? = 0 ] || usage
14eval set -- "${gop}"
15via=""
16while true ; do
17 case "$1" in
18 -n|--via) via="$2" ; shift 2 ;;
19 -h|--help|--usage) echo "usage" ; usage ;;
20 --) shift ; break ;;
21 *) echo "Huh" ; usage ;;
22 esac
23done
24
25dest="$1"
26[ -z "${dest}" ] && usage
27
28keyfile="${2}"
29if [ -e "${keyfile}.pub" ] ; then
30 keyfile="${keyfile}.pub"
31else
32 if [ -e "${HOME}/.ssh/${keyfile}.pub" ] ; then
33 keyfile="${HOME}/.ssh/${keyfile}.pub"
34 else
35 if [ ! -z "${keyfile}" ] ; then
36 echo "Identity file not found"
37 exit 2
38 fi
39 for f in ${HOME}/.ssh/{id_dsa,id_rsa,identity}.pub ; do
40 if [ -e $f ] ; then
41 keyfile="$f"; break;
42 fi
43 done
44 fi
45fi
46
47echo "Propagating ssh key to ${dest}"
48[ -z "${via}" ] || echo " via ${via}"
49echo "Using identity file '${keyfile}'"
50read kt k r <"${keyfile}"
51cmd="ssh ${dest} \
52 \"/bin/bash -c '\
53 umask 077 ;\
54 test ! -d .ssh && (mkdir .ssh || exit 1) ;\
55 ( test -r .ssh/authorized_keys && grep -q ${k} .ssh/authorized_keys </dev/null) || ( echo Installing ssh key ; cat >> .ssh/authorized_keys ) \
56 '\"" <"${keyfile}"
57if [ -z "${via}" ] ; then
58 eval ${cmd} <"${keyfile}"
59else
60 ssh ${via} ${cmd} <"${keyfile}"
61fi
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 @@
1# Copyright 1999-2006 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2
3# $Header: $
4
5DESCRIPTION="A script to propagate ssh public identity"
6HOMEPAGE="http://hacker.klever.net/"
7LICENSE="MIT"
8SLOT="0"
9KEYWORDS="~x86 ~amd64"
10IUSE=""
11DEPEND=""
12
13src_install() {
14 newbin ${FILESDIR}/${PF} ${PN}
15}