aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-01-07 13:26:08 +0000
committerNicolas Vigier <boklm@mageia.org>2011-01-07 13:26:08 +0000
commit17ed43f2e80a4e94297665b6a9c5ac5d9dfd6a8d (patch)
treee0d5937e2381d60b6289af3ed19d0a24a94dccb3 /modules/buildsystem
parent0917b4f89f2f2b189b6d532301973d2f0e9590a1 (diff)
downloadpuppet-17ed43f2e80a4e94297665b6a9c5ac5d9dfd6a8d.tar
puppet-17ed43f2e80a4e94297665b6a9c5ac5d9dfd6a8d.tar.gz
puppet-17ed43f2e80a4e94297665b6a9c5ac5d9dfd6a8d.tar.bz2
puppet-17ed43f2e80a4e94297665b6a9c5ac5d9dfd6a8d.tar.xz
puppet-17ed43f2e80a4e94297665b6a9c5ac5d9dfd6a8d.zip
add script to help adding ssh keys
Diffstat (limited to 'modules/buildsystem')
-rw-r--r--modules/buildsystem/manifests/init.pp12
-rwxr-xr-xmodules/buildsystem/templates/mgacreatehome27
2 files changed, 39 insertions, 0 deletions
diff --git a/modules/buildsystem/manifests/init.pp b/modules/buildsystem/manifests/init.pp
index 916c43c2..0e60c289 100644
--- a/modules/buildsystem/manifests/init.pp
+++ b/modules/buildsystem/manifests/init.pp
@@ -241,4 +241,16 @@ class buildsystem {
content => template("buildsystem/sudoers.iurt")
}
}
+
+ # temporary script to create home dir with ssh key
+ # taking login and url as arguments
+ class mgacreatehome {
+ file { "/usr/local/sbin/mgacreatehome":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 700,
+ content => template("buildsystem/mgacreatehome")
+ }
+ }
}
diff --git a/modules/buildsystem/templates/mgacreatehome b/modules/buildsystem/templates/mgacreatehome
new file mode 100755
index 00000000..3c0fc140
--- /dev/null
+++ b/modules/buildsystem/templates/mgacreatehome
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# script to create home directory with ssh key
+# takes two arguments :
+# - login
+# - URL for ssh key
+
+test $# -eq 2 || exit 1
+login="$1"
+sshkeyurl="$2"
+sshkeyfile=`mktemp`
+homeroot='/home'
+
+id "$login" || exit 2
+wget -O "$sshkeyfile" "$sshkeyurl" || exit 2
+cat "$sshkeyfile"
+echo "Press enter to validate"
+read z
+
+test ! -d "$homeroot/$login" && cp -a /etc/skel "$homeroot/$login"
+mkdir "$homeroot/$login/.ssh"
+cat "$sshkeyfile" >> "$homeroot/$login/.ssh/authorized_keys"
+rm -f "$sshkeyfile"
+chmod 700 "$homeroot/$login/.ssh"
+chmod 600 "$homeroot/$login/.ssh/authorized_keys"
+chown -R "$login":mga-users "$homeroot/$login"
+