__ssh_authorized_key has been superseeded by __ssh_authorized_keys

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-11-30 14:41:47 +01:00
parent 1ef5bcaa74
commit f37f3d201c
4 changed files with 0 additions and 129 deletions

View File

@ -1,15 +0,0 @@
#!/bin/sh
# Get option dstuser if defined
if [ -f "$__object/parameter/dstuser" ]; then
dstuser=`cat "$__object/parameter/dstuser"`
else
dstuser="root"
fi
if id $dstuser >/dev/null 2>&1 ; then
id -ng $dstuser
else
echo "$__object_id: Destination user $dstuser does not exist" >&2
exit 1
fi

View File

@ -1,46 +0,0 @@
cdist-type__ssh_authorized_key(7)
=================================
Aurélien Bondis <aurelien.bondis--@--gmail-DOT-com>
NAME
----
cdist-type__ssh_authorized_key - Sends a user's public key to another user's authorized_keys
DESCRIPTION
-----------
This type sends a rsa key. By default uses root's key and sends it to root's authorized_keys
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
srcuser:: the user to take the rsa public key from
dstuser:: the user to give the rsa public key to
EXAMPLES
--------
--------------------------------------------------------------------------------
#deploy root's public key
__ssh_authorized_key admin
#deploy bob's public key to alice's authorized_keys
__ssh_authorized_key --srcuser bob --dstuser alice
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View File

@ -1,66 +0,0 @@
#!/bin/sh
#
# 2011 Aurélien Bondis aurelien.bondis AT gmail DOT com
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# This type allows to send a public ssh key from a user to the
# authorized_keys of another
#
#require="__package openssh-server --state present"
# Get option srcuser if defined
if [ -f "$__object/parameter/srcuser" ]; then
srcuser=`cat "$__object/parameter/srcuser"`
fi
# Get option dstuser if defined
if [ -f "$__object/parameter/dstuser" ]; then
dstuser=`cat "$__object/parameter/dstuser"`
else
dstuser="root"
fi
# retrieve destination group
dstgroup=$(cat "$__object/explorer/dstuser_group")
# if a source user is defined, use it's public key
if [ "$srcuser" ]; then
srcrsa="/home/${srcuser}/.ssh/id_rsa.pub"
# if no source user is defined we use root's public key
else
srcrsa="/root/.ssh/id_rsa.pub"
fi
# if a destination user is defined, insert in it's authorized_keys
if [ "$dstuser" ]; then
sshpath="/home/$dstuser/.ssh"
# if no destination user is defined we use root's home
else
sshpath="/root/.ssh"
fi
rsa=`cat $srcrsa`
__directory $sshpath \
--owner $dstuser \
--group $dstgroup \
--mode 700
# the file authorized_keys depends on the .ssh folder
require="__directory${sshpath}" \
__file "$sshpath/authorized_keys" \
--mode 640 \
--owner $dstuser \
--group $dstgroup
# the line added depends on authorized_keys existence
require="__file${sshpath}/authorized_keys" __addifnosuchline sshkey --file \
"$sshpath/authorized_keys" --line "$rsa"

View File

@ -1,2 +0,0 @@
srcuser
dstuser