projects
/
monkeysphere.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'dkg/master'
[monkeysphere.git]
/
src
/
subcommands
/
ma
/
update-users
diff --git
a/src/subcommands/ma/update-users
b/src/subcommands/ma/update-users
old mode 100755
(executable)
new mode 100644
(file)
index
a26d3fb
..
73685f6
--- a/
src/subcommands/ma/update-users
+++ b/
src/subcommands/ma/update-users
@@
-1,14
+1,22
@@
-#!/usr/bin/env bash
+# -*-shell-script-*-
+# This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
# Monkeysphere authentication update-users subcommand
#
# The monkeysphere scripts are written by:
# Monkeysphere authentication update-users subcommand
#
# The monkeysphere scripts are written by:
-# Jameson Rollins <jrollins@fi
fthhorseman
.net>
+# Jameson Rollins <jrollins@fi
nestructure
.net>
# Jamie McClelland <jm@mayfirst.org>
# Daniel Kahn Gillmor <dkg@fifthhorseman.net>
#
# Jamie McClelland <jm@mayfirst.org>
# Daniel Kahn Gillmor <dkg@fifthhorseman.net>
#
-# They are Copyright 2008, and are all released under the GPL, version 3
-# or later.
+# They are Copyright 2008-2009, and are all released under the GPL,
+# version 3 or later.
+
+update_users() {
+
+local unames
+local uname
+local authorizedKeysDir
+local authorizedUserIDs
if [ "$1" ] ; then
# get users from command line
if [ "$1" ] ; then
# get users from command line
@@
-18,13
+26,16
@@
else
unames=$(getent passwd | cut -d: -f1)
fi
unames=$(getent passwd | cut -d: -f1)
fi
-RET
CODE
=0
+RET
URN
=0
# set mode
MODE="authorized_keys"
# set gnupg home
# set mode
MODE="authorized_keys"
# set gnupg home
-GNUPGHOME="$GNUPGHOME_AUTHENTICATION"
+GNUPGHOME="$GNUPGHOME_SPHERE"
+
+# the authorized_keys directory
+authorizedKeysDir="${SYSDATADIR}/authentication/authorized_keys"
# check to see if the gpg trust database has been initialized
if [ ! -s "${GNUPGHOME}/trustdb.gpg" ] ; then
# check to see if the gpg trust database has been initialized
if [ ! -s "${GNUPGHOME}/trustdb.gpg" ] ; then
@@
-32,7
+43,7
@@
if [ ! -s "${GNUPGHOME}/trustdb.gpg" ] ; then
fi
# make sure the authorized_keys directory exists
fi
# make sure the authorized_keys directory exists
-mkdir -p "${
SYSDATADIR}/authorized_keys
"
+mkdir -p "${
authorizedKeysDir}
"
# loop over users
for uname in $unames ; do
# loop over users
for uname in $unames ; do
@@
-45,7
+56,7
@@
for uname in $unames ; do
log verbose "----- user: $uname -----"
# make temporary directory
log verbose "----- user: $uname -----"
# make temporary directory
- TMPLOC=$(mktemp -d ${M
S
TMPDIR}/tmp.XXXXXXXXXX) || failure "Could not create temporary directory!"
+ TMPLOC=$(mktemp -d ${M
A
TMPDIR}/tmp.XXXXXXXXXX) || failure "Could not create temporary directory!"
# trap to delete temporary directory on exit
trap "rm -rf $TMPLOC" EXIT
# trap to delete temporary directory on exit
trap "rm -rf $TMPLOC" EXIT
@@
-125,15
+136,15
@@
for uname in $unames ; do
chown $(whoami) "$AUTHORIZED_KEYS" && \
chgrp $(id -g "$uname") "$AUTHORIZED_KEYS" && \
chmod g+r "$AUTHORIZED_KEYS" && \
chown $(whoami) "$AUTHORIZED_KEYS" && \
chgrp $(id -g "$uname") "$AUTHORIZED_KEYS" && \
chmod g+r "$AUTHORIZED_KEYS" && \
- mv -f "$AUTHORIZED_KEYS" "${
SYSDATADIR}/authorized_keys
/${uname}" || \
+ mv -f "$AUTHORIZED_KEYS" "${
authorizedKeysDir}
/${uname}" || \
{
log error "Failed to install authorized_keys for '$uname'!"
{
log error "Failed to install authorized_keys for '$uname'!"
- rm -f "${
SYSDATADIR}/authorized_keys
/${uname}"
+ rm -f "${
authorizedKeysDir}
/${uname}"
# indicate that there has been a failure:
RETURN=1
}
else
# indicate that there has been a failure:
RETURN=1
}
else
- rm -f "${
SYSDATADIR}/authorized_keys
/${uname}"
+ rm -f "${
authorizedKeysDir}
/${uname}"
fi
# unset the trap
fi
# unset the trap
@@
-141,4
+152,6
@@
for uname in $unames ; do
# destroy temporary directory
rm -rf "$TMPLOC"
# destroy temporary directory
rm -rf "$TMPLOC"
- done
+done
+
+}