summaryrefslogtreecommitdiff
path: root/src/share
diff options
context:
space:
mode:
Diffstat (limited to 'src/share')
-rw-r--r--src/share/common6
-rw-r--r--src/share/ma/setup6
-rw-r--r--src/share/mh/add_revoker2
-rw-r--r--src/share/mh/publish_key2
4 files changed, 11 insertions, 5 deletions
diff --git a/src/share/common b/src/share/common
index c88857e..8e2232d 100644
--- a/src/share/common
+++ b/src/share/common
@@ -484,6 +484,12 @@ get_homedir() {
eval "echo ~${uname}"
}
+# return the primary group of a user
+get_primary_group() {
+ local uname=${1:-`whoami`}
+ groups "$uname" | sed 's/^..* : //' | awk '{ print $1 }'
+}
+
### CONVERSION UTILITIES
# output the ssh key for a given key ID
diff --git a/src/share/ma/setup b/src/share/ma/setup
index 4c87009..0ed0406 100644
--- a/src/share/ma/setup
+++ b/src/share/ma/setup
@@ -16,10 +16,10 @@ setup() {
log debug "checking authentication directory structure..."
mkdir -p "${MADATADIR}"
chmod 0750 "${MADATADIR}"
- chgrp "$MONKEYSPHERE_USER" "${MADATADIR}"
+ chgrp "$MONKEYSPHERE_GROUP" "${MADATADIR}"
mkdir -p "${MATMPDIR}"
chmod 0750 "${MATMPDIR}"
- chgrp "$MONKEYSPHERE_USER" "${MATMPDIR}"
+ chgrp "$MONKEYSPHERE_GROUP" "${MATMPDIR}"
mkdir -p "${GNUPGHOME_CORE}"
chmod 0700 "${GNUPGHOME_CORE}"
mkdir -p "${GNUPGHOME_SPHERE}"
@@ -48,7 +48,7 @@ EOF
# make sure the monkeysphere user owns everything in the sphere
# gnupghome
log debug "fixing sphere gnupg home ownership..."
- chown "$MONKEYSPHERE_USER:$MONKEYSPHERE_USER" "${GNUPGHOME_SPHERE}" "${GNUPGHOME_SPHERE}"/gpg.conf
+ chown "$MONKEYSPHERE_USER:$MONKEYSPHERE_GROUP" "${GNUPGHOME_SPHERE}" "${GNUPGHOME_SPHERE}"/gpg.conf
# get fingerprint of core key. this should be empty on unconfigured systems.
local CORE_FPR=$(core_fingerprint)
diff --git a/src/share/mh/add_revoker b/src/share/mh/add_revoker
index e58995b..89e6fcf 100644
--- a/src/share/mh/add_revoker
+++ b/src/share/mh/add_revoker
@@ -64,7 +64,7 @@ else
# fix permissions and ownership on temporary directory which will
# be used by monkeysphere user for storing the downloaded key
chmod 0700 "$tmpDir"
- chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_USER" "$tmpDir"
+ chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_GROUP" "$tmpDir"
# download the key from the keyserver as the monkeysphere user
log verbose "searching keyserver $KEYSERVER for keyID $keyID..."
diff --git a/src/share/mh/publish_key b/src/share/mh/publish_key
index f6e1c0f..48e4cbb 100644
--- a/src/share/mh/publish_key
+++ b/src/share/mh/publish_key
@@ -30,7 +30,7 @@ fi
# create a temporary gnupg directory from which to publish the key
export GNUPGHOME=$(msmktempdir)
chmod 0700 "$GNUPGHOME"
-chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_USER" "$GNUPGHOME"
+chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_GROUP" "$GNUPGHOME"
# trap to remove tmp dir if break
trap "rm -rf $GNUPGHOME" EXIT