diff --git a/.cvsignore b/.cvsignore index e69de29..896b46e 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +munge-0.5.8.tar.bz2 diff --git a/check-key-exists.patch b/check-key-exists.patch new file mode 100644 index 0000000..c237884 --- /dev/null +++ b/check-key-exists.patch @@ -0,0 +1,17 @@ +diff -uNr munge-0.5.8.ORIG/src/etc/munge.init.in munge-0.5.8/src/etc/munge.init.in +--- munge-0.5.8.ORIG/src/etc/munge.init.in 2009-07-22 23:51:58.211310282 +0200 ++++ munge-0.5.8/src/etc/munge.init.in 2009-07-22 23:53:58.585303749 +0200 +@@ -116,6 +116,13 @@ + # According to LSB, running "start" on a service already running should be + # considered successful. + ## ++ # If there is no key then exit as a configuration error. ++ if [ ! -f /etc/munge/munge.key ] ; then ++ echo "/etc/munge/munge.key does not exist, generate with create-munge-key" ++ exit 6 ++ fi ++ ++ + printf "Starting $DESC: " + case $SYSTEM in + DEBIAN) diff --git a/create-munge-key b/create-munge-key new file mode 100644 index 0000000..07dddd4 --- /dev/null +++ b/create-munge-key @@ -0,0 +1,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 diff --git a/import.log b/import.log new file mode 100644 index 0000000..06dee98 --- /dev/null +++ b/import.log @@ -0,0 +1 @@ +munge-0_5_8-4_fc11:HEAD:munge-0.5.8-4.fc11.src.rpm:1248941278 diff --git a/initd-pass-rpmlint.patch b/initd-pass-rpmlint.patch new file mode 100644 index 0000000..9fa0702 --- /dev/null +++ b/initd-pass-rpmlint.patch @@ -0,0 +1,22 @@ +diff -uNr munge-0.5.8.ORIG/src/etc/munge.init.in munge-0.5.8/src/etc/munge.init.in +--- munge-0.5.8.ORIG/src/etc/munge.init.in 2007-02-04 08:52:37.000000000 +0100 ++++ munge-0.5.8/src/etc/munge.init.in 2009-06-12 11:46:40.000000000 +0200 +@@ -7,7 +7,7 @@ + # Written by Chris Dunlap . + # UCRL-CODE-155910. + ############################################################################### +-# chkconfig: 345 40 60 ++# chkconfig: - 40 60 + ############################################################################### + ### BEGIN INIT INFO + # Provides: munge +@@ -15,8 +15,8 @@ + # Required-Stop: $named $time + # Should-Start: $local_fs $syslog + # Should-Stop: $local_fs $syslog +-# Default-Start: 3 4 5 + # Default-Stop: 0 1 2 6 ++# Short-Description: Start/Stop the MUNGE authentication service. + # Description: Start/Stop the MUNGE authentication service. + ### END INIT INFO + ############################################################################### diff --git a/munge.logrotate b/munge.logrotate new file mode 100644 index 0000000..8a92840 --- /dev/null +++ b/munge.logrotate @@ -0,0 +1,5 @@ +/var/log/munge/munged.log { + missingok + notifempty + copytruncate +} diff --git a/munge.spec b/munge.spec new file mode 100644 index 0000000..b355679 --- /dev/null +++ b/munge.spec @@ -0,0 +1,214 @@ + +%if 0%{?el4}%{?el5} +%define _initddir %{_sysconfdir}/rc.d/init.d +%endif + +Name: munge +Version: 0.5.8 +Release: 4%{?dist} +Summary: Enables uid & gid authentication across a host cluster + +Group: Applications/System +License: GPLv2+ +URL: http://home.gna.org/munge/ +Source0: http://download.gna.org/munge/%{version}/munge-%{version}.tar.bz2 +Source1: create-munge-key +Source2: munge.logrotate +Patch0: initd-pass-rpmlint.patch +Patch2: runas-munge-user.patch +Patch3: check-key-exists.patch +Patch4: remove-GPL_LICENSED-cpp.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: zlib-devel bzip2-devel openssl-devel + +Requires(post): chkconfig +Requires(pre): shadow-utils +Requires(preun): chkconfig, initscripts +Requires(postun): initscripts + + +%description +MUNGE (MUNGE Uid 'N' Gid Emporium) is an authentication service for creating +and validating credentials. It is designed to be highly scalable for use +in an HPC cluster environment. +It allows a process to authenticate the UID and GID of another local or +remote process within a group of hosts having common users and groups. +These hosts form a security realm that is defined by a shared cryptographic +key. Clients within this security realm can create and validate credentials +without the use of root privileges, reserved ports, or platform-specific +methods. + +%package devel +Summary: Development files for uid * gid authentication acrosss a host cluster +Requires: %{name} = %{version}-%{release} +Group: Applications/System + +%description devel +Header files for developing using MUNGE. + +%prep +%setup -q +%patch0 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 + + +%build +# Won't compile without -DGNU_SOURCE on fc11,12 at least. +%if ! 0%{?el4}%{?el5} + export CFLAGS="%{optflags} -D_GNU_SOURCE" +%endif + +%configure --disable-static +# Get rid of some rpaths for /usr/sbin +sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +make %{?_smp_mflags} + + +%install + +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT + +# mv init.d script form /etc/init.d to %{_initddir} +mkdir -p $RPM_BUILD_ROOT/%{_initddir} +mv $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/munge $RPM_BUILD_ROOT/%{_initddir}/munge +# +chmod 644 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/munge +# Exclude .la files +rm $RPM_BUILD_ROOT/%{_libdir}/libmunge.la + +install -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT/%{_sbindir}/create-munge-key +install -p -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/munge + +# Fix a few permissions +chmod 700 $RPM_BUILD_ROOT%{_var}/lib/munge $RPM_BUILD_ROOT%{_var}/log/munge +chmod 700 $RPM_BUILD_ROOT%{_sysconfdir}/munge + +# Create and empty key file to be marked as a ghost file below. +# i.e it is not actually included in the rpm, only the record +# of it is. +# Can't be done on .el4 or .el5. +%if ! 0%{?el4}%{?el5} +touch $RPM_BUILD_ROOT%{_sysconfdir}/munge/munge.key +chmod 400 $RPM_BUILD_ROOT%{_sysconfdir}/munge/munge.key +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%postun +/sbin/ldconfig +if [ "$1" -ge "1" ] ; then + /sbin/service munge condrestart >/dev/null 2>&1 || : +fi + + +%preun +if [ $1 = 0 ]; then + /sbin/service munge stop > /dev/null 2>&1 || : + /sbin/chkconfig --del munge || : +fi + +%pre +getent group munge >/dev/null || groupadd -r munge +getent passwd munge >/dev/null || \ +useradd -r -g munge -d %{_var}/run/munge -s /sbin/nologin \ + -c "Runs Uid 'N' Gid Emporium" munge +exit 0 + + +%post +/sbin/chkconfig --add munge || : +/sbin/ldconfig + + +%files +%defattr(-,root,root,-) +%{_initddir}/munge +%{_bindir}/munge +%{_bindir}/remunge +%{_bindir}/unmunge +%{_sbindir}/munged +%{_sbindir}/create-munge-key +%{_mandir}/man1/munge.1.gz +%{_mandir}/man1/remunge.1.gz +%{_mandir}/man1/unmunge.1.gz +%{_mandir}/man7/munge.7.gz +%{_mandir}/man8/munged.8.gz +%{_libdir}/libmunge.so.2 +%{_libdir}/libmunge.so.2.0.0 + +%attr(0700,munge,munge) %dir %{_var}/run/munge +%attr(0700,munge,munge) %dir %{_var}/log/munge +%attr(0700,munge,munge) %dir %{_sysconfdir}/munge +%if ! 0%{?el4}%{?el5} +%attr(0400,munge,munge) %ghost %{_sysconfdir}/%{name}/%{name}.key +%endif + +%attr(0700,munge,munge) %dir %{_var}/lib/munge + +%config(noreplace) %{_sysconfdir}/sysconfig/munge +%config(noreplace) %{_sysconfdir}/logrotate.d/munge + +%doc AUTHORS BUGS ChangeLog COPYING DISCLAIMER +%doc JARGON META NEWS QUICKSTART README +%doc doc + + + +%files devel +%defattr(-,root,root,-) +%{_includedir}/munge.h +%{_libdir}/libmunge.so +%{_mandir}/man3/munge.3.gz +%{_mandir}/man3/munge_ctx.3.gz +%{_mandir}/man3/munge_ctx_copy.3.gz +%{_mandir}/man3/munge_ctx_create.3.gz +%{_mandir}/man3/munge_ctx_destroy.3.gz +%{_mandir}/man3/munge_ctx_get.3.gz +%{_mandir}/man3/munge_ctx_set.3.gz +%{_mandir}/man3/munge_ctx_strerror.3.gz +%{_mandir}/man3/munge_decode.3.gz +%{_mandir}/man3/munge_encode.3.gz +%{_mandir}/man3/munge_enum.3.gz +%{_mandir}/man3/munge_enum_int_to_str.3.gz +%{_mandir}/man3/munge_enum_is_valid.3.gz +%{_mandir}/man3/munge_enum_str_to_int.3.gz +%{_mandir}/man3/munge_strerror.3.gz + + +%changelog +* Thu Jul 22 2009 Steve Traylen - 0.5.8-4 +- Expand defattr with 4th argument for default directory perms. +- Explict attr for non 0644 files and 0755 directories. + +* Thu Jul 22 2009 Steve Traylen - 0.5.8-3 +- Append -DGNU_SOURCE to default CFLAGS. + +* Wed Jul 22 2009 Steve Traylen - 0.5.8-2 +- Correct License to GPLv2+ +- Move man3 pages to the devel package. +- Remove +x bit from create-munge-key source. +- Preserve timestamps when installing files. +- ldconfig not needed on -devel package. +- Do a condrestart when upgrading. +- Remove redundant files from docs. +- chmod /var/lib/munge /var/log/munge and /etc/munge to 700. +- Apply patch to not error when GPL_LICENSED is not set. +- Patch service script to print error on if munge.key not present + on start only and with a better error. +- Remove dont-exit-form-lib.patch. munge is expecting munge to + do this. +- Remove libgcrypt-devel from BuildRequires, uses openssl by + default anyway. +- Mark the munge.key as a ghost file. + + +* Fri Jun 12 2009 Steve Traylen - 0.5.8-1 +- First Build + + diff --git a/remove-GPL_LICENSED-cpp.patch b/remove-GPL_LICENSED-cpp.patch new file mode 100644 index 0000000..3328941 --- /dev/null +++ b/remove-GPL_LICENSED-cpp.patch @@ -0,0 +1,21 @@ +diff -uNr munge-0.5.8.ORIG/src/libmunge/munge.h munge-0.5.8/src/libmunge/munge.h +--- munge-0.5.8.ORIG/src/libmunge/munge.h 2009-07-22 22:20:01.358333769 +0200 ++++ munge-0.5.8/src/libmunge/munge.h 2009-07-22 22:23:55.773390795 +0200 +@@ -31,17 +31,6 @@ + #include + + +-/***************************************************************************** +- * Got GPL? +- *****************************************************************************/ +- +-#if ! GPL_LICENSED +-# error By linking against libmunge, the derivative +-# error work becomes licensed under the terms of the +-# error GNU General Public License. Acknowledge by +-# error defining the GPL_LICENSED preprocessor macro. +-#endif /* !GPL_LICENSED */ +- + + /***************************************************************************** + * Got C++? diff --git a/runas-munge-user.patch b/runas-munge-user.patch new file mode 100644 index 0000000..d0a9162 --- /dev/null +++ b/runas-munge-user.patch @@ -0,0 +1,11 @@ +diff -uNr munge-0.5.8.ORIG/src/etc/munge.sysconfig munge-0.5.8/src/etc/munge.sysconfig +--- munge-0.5.8.ORIG/src/etc/munge.sysconfig 2009-06-12 16:03:40.000000000 +0200 ++++ munge-0.5.8/src/etc/munge.sysconfig 2009-06-12 16:04:10.000000000 +0200 +@@ -15,4 +15,6 @@ + ## + # Execute the daemon under another username. + ## +-# USER="daemon" ++USER="munge" ++ ++ diff --git a/sources b/sources index e69de29..494a220 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +10c3a913d8fc75d86cc9e71e72497724 munge-0.5.8.tar.bz2