/usr/sbin/create-munge-key is in munge 0.5.12-1+b1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #! /bin/sh
# Generates a random key for munged
#
# (C) 2007 Gennaro Oliva
# You may freely distribute this file under the terms of the GNU General
# Public License, version 2 or later.
#Setting default random file
randomfile=/dev/urandom
#Usage message
usage="Try \`$0 -h' for more information."
#Help message
needhelp() {
echo Usage: create-munge-key [OPTION]...
echo Generates a random key for munged
echo List of options
echo " -f force overwriting existing old key"
echo " -r specify /dev/random as random file for key generation"
echo " default is /dev/urandom"
echo " -h display this help and exit"
}
#Parsing command line options
while getopts "hrf" options; do
case $options in
r ) randomfile=/dev/random;;
f ) force=yes;;
h ) needhelp
exit 0;;
\? ) echo $usage
exit 1;;
* ) echo $usage
exit 1;;
esac
done
if [ `id -u` != 0 ] ; then
echo "Please run create-munge-key as root."
exit 1
fi
#Checking random file presence
if [ ! -e $randomfile ] ; then
echo $0: cannot find random file $randomfile
exit 1
fi
#Checking if the user want to overwrite existing key file
if [ "$force" != "yes" ] && [ -e /etc/munge/munge.key ] ; then
echo The munge key /etc/munge/munge.key already exists
echo -n "Do you want to overwrite it? (y/N) "
read ans
if [ "$ans" != "y" -a "$ans" != "Y" ] ; then
exit 0
fi
fi
#Generating the key file and change owner and permissions
if [ "$randomfile" = "/dev/random" ] ; then
echo Please type on the keyboard, echo move your mouse,
echo utilize the disks. This gives the random number generator
echo a better chance to gain enough entropy.
fi
echo -n "Generating a pseudo-random key using $randomfile "
dd if=$randomfile bs=1 count=1024 > /etc/munge/munge.key \
2>/dev/null
chown munge:munge /etc/munge/munge.key
chmod 0400 /etc/munge/munge.key
echo completed.
exit 0
|