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) (unidiff) | |
tree | 0ac471e04d3d177ab5ab1416da8c976cfaaea6fb | |
parent | b3277651c9c02a910e384b6633bf4b1915e6302a (diff) | |
download | misc-25a40f8b84420e298951cfa163cd96eaf7b7c27f.zip misc-25a40f8b84420e298951cfa163cd96eaf7b7c27f.tar.gz misc-25a40f8b84420e298951cfa163cd96eaf7b7c27f.tar.bz2 |
propakey
-rw-r--r-- | profiles/categories | 1 | ||||
-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 |
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 @@ | |||
1 | sys-apps | ||
1 | www-misc | 2 | www-misc |
2 | x11-plugins | 3 | x11-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 @@ | |||
1 | AUX propakey-0.0 1530 RMD160 7713dc4c36ba6bff2713b335f7bf9de213a71f39 SHA1 fdce48080a5aaf3c993d413b151fa8fbb6ff89da SHA256 e127ecd8432f071642b4c636689662998f0c8b9d65f8987f3635fe56914b90a5 | ||
2 | MD5 776280fea5e3a6046c68ac7573afdc8c files/propakey-0.0 1530 | ||
3 | RMD160 7713dc4c36ba6bff2713b335f7bf9de213a71f39 files/propakey-0.0 1530 | ||
4 | SHA256 e127ecd8432f071642b4c636689662998f0c8b9d65f8987f3635fe56914b90a5 files/propakey-0.0 1530 | ||
5 | EBUILD propakey-0.0.ebuild 329 RMD160 f87964ae69e7a3fed82b7f5f591da9ad86a96168 SHA1 b91f49f447154dd27cb95d535c11b0666a319c24 SHA256 3809afd746a30847403a24d534fef633f6fca3188eff1f7c237249b76be6be20 | ||
6 | MD5 0a34b80b74dd77960a91da3af93c161f propakey-0.0.ebuild 329 | ||
7 | RMD160 f87964ae69e7a3fed82b7f5f591da9ad86a96168 propakey-0.0.ebuild 329 | ||
8 | SHA256 3809afd746a30847403a24d534fef633f6fca3188eff1f7c237249b76be6be20 propakey-0.0.ebuild 329 | ||
9 | MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-propakey-0.0 0 | ||
10 | RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-propakey-0.0 0 | ||
11 | 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 @@ | |||
1 | #!/bin/bash | ||
2 | usage() { | ||
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 | } | ||
12 | gop=`getopt -o n:h --long via:,help,usage -n propakey -- "$@"` | ||
13 | [ $? = 0 ] || usage | ||
14 | eval set -- "${gop}" | ||
15 | via="" | ||
16 | while 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 | ||
23 | done | ||
24 | |||
25 | dest="$1" | ||
26 | [ -z "${dest}" ] && usage | ||
27 | |||
28 | keyfile="${2}" | ||
29 | if [ -e "${keyfile}.pub" ] ; then | ||
30 | keyfile="${keyfile}.pub" | ||
31 | else | ||
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 | ||
45 | fi | ||
46 | |||
47 | echo "Propagating ssh key to ${dest}" | ||
48 | [ -z "${via}" ] || echo " via ${via}" | ||
49 | echo "Using identity file '${keyfile}'" | ||
50 | read kt k r <"${keyfile}" | ||
51 | cmd="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}" | ||
57 | if [ -z "${via}" ] ; then | ||
58 | eval ${cmd} <"${keyfile}" | ||
59 | else | ||
60 | ssh ${via} ${cmd} <"${keyfile}" | ||
61 | 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 @@ | |||
1 | # Copyright 1999-2006 Gentoo Foundation | ||
2 | # Distributed under the terms of the GNU General Public License v2 | ||
3 | # $Header: $ | ||
4 | |||
5 | DESCRIPTION="A script to propagate ssh public identity" | ||
6 | HOMEPAGE="http://hacker.klever.net/" | ||
7 | LICENSE="MIT" | ||
8 | SLOT="0" | ||
9 | KEYWORDS="~x86 ~amd64" | ||
10 | IUSE="" | ||
11 | DEPEND="" | ||
12 | |||
13 | src_install() { | ||
14 | newbin ${FILESDIR}/${PF} ${PN} | ||
15 | } | ||