From 9851663c1decf9d486e83815f9938ff027309779 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 21 Nov 2010 17:08:22 -0200 Subject: Moving newkeys subcommand to hydra suite --- share/keyringer/newkeys | 61 ------------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100755 share/keyringer/newkeys diff --git a/share/keyringer/newkeys b/share/keyringer/newkeys deleted file mode 100755 index 84d1c27..0000000 --- a/share/keyringer/newkeys +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# Create keys for new nodes. -# - -function newkeys_nodes { - # See http://www.mail-archive.com/puppet-users@googlegroups.com/msg01615.html - grep ^node $* | sed -e 's/^node //' | awk -F, '{for(i=1;i<=NF;i++) {print $i}}' | cut -d "'" -f2 -} - -function newkeys_puppet { - # Generates ssh and gpg keys for new nodes - # GPG keys should be manually imported in the nodes - - if [ -e "$PUPPET/manifests/nodes.pp" ]; then - nodes="`newkeys_nodes $PUPPET/manifests/nodes.pp`" - fi - - if [ -d "$PUPPET/manifests/nodes" ]; then - nodes="$nodes `newkeys_nodes $PUPPET/manifests/nodes/*`" - fi - - for host in $nodes; do - node="`echo $host | cut -d . -f 1`" - privkey="$PUPPET_KEYS/"$node"_id_dsa" - pubkey="$privkey.pub" - if [ ! -e "$privkey" ] || [ ! -e "$pubkey" ]; then - keyringer_exec genpair $BASEDIR ssh $node/ssh/id_dsa $host $privkey - keyringer_exec genpair $BASEDIR gpg $node/gpg/key $host - - # Add key into puppet git repository - ( cd $PUPPET_KEYS && git add $privkey $pubkey ) - fi - done -} - -# Load functions -LIB="`dirname $0`/../../lib/keyringer" -source $LIB/functions || exit 1 - -# Command parser -keyringer_get_command $2 - -source $OPTIONS -keyringer_config_load_preferences - -if [ -z "$PUPPET" ]; then - "Error: you have to setup PUPPET path at your preferences for this keyring." -fi - -if [ -z "$PUPPET_KEYS" ]; then - PUPPET_KEYS="$PUPPET/files/keys" -fi - -# Right now just puppet backend is supported -if [ "$COMMAND" == "puppet" ]; then - newkeys_puppet -else - echo "No such option $COMMAND" - exit 1 -fi -- cgit v1.2.3