diff options
Diffstat (limited to 'sys-auth/munge/files/munged.initd')
-rw-r--r-- | sys-auth/munge/files/munged.initd | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys-auth/munge/files/munged.initd b/sys-auth/munge/files/munged.initd index d1ac230c7642..c53219d2ae85 100644 --- a/sys-auth/munge/files/munged.initd +++ b/sys-auth/munge/files/munged.initd @@ -1,5 +1,5 @@ #!/sbin/openrc-run -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ @@ -9,20 +9,24 @@ depend() { check_key() { [ -s "${KEYFILE}" ] && return 0 - dd if=/dev/urandom bs=1 count=1024 >/etc/munge/munge.key 2>/dev/null || return 1 - chown munge:munge "${KEYFILE}" || return 1 - chmod 700 "${KEYFILE}" || return 1 + local old_umask=$(umask) + local ret + umask 037 + dd if=/dev/urandom bs=1024 count=1 of="${KEYFILE}" 2>/dev/null; ret=$? + umask $old_umask + return $ret } start() { ebegin "Starting munged" if ! check_key; then - eerror "Failed to verify/create munge key" + eerror "Failed to create munge key" eend 1 && exit 1 fi checkpath -d -m 755 -o munge:munge /var/run/munge checkpath -d -m 711 -o munge:munge /var/lib/munge checkpath -d -m 700 -o munge:munge /var/log/munge + checkpath -f -m 640 -o root:munge "${KEYFILE}" start-stop-daemon -S /usr/sbin/munged \ --user munge \ --group munge \ |