-
Notifications
You must be signed in to change notification settings - Fork 46
/
munge.spec.in
200 lines (176 loc) · 5.96 KB
/
munge.spec.in
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# This rpm specfile has been tested on the following systems:
# - AlmaLinux 9, 8
# - CentOS Stream 9, Stream 8, 7.9.2009
# - Fedora 39, 38, 37
Name: munge
Version: @VERSION@
Release: 1%{?dist}
# Disable test suite by default; add "--with check" to enable.
%bcond_with check
# Disable source file verification by default; add "--with verify" to enable.
# Requires a detached signature (Source1) and gpg public key (Source2).
%bcond_with verify
# Enable hardened build since munged is a long-running daemon.
%global _hardened_build 1
Summary: MUNGE authentication service
License: GPL-3.0-or-later
URL: https://github.com/dun/munge
Source0: https://github.com/dun/munge/releases/download/%{name}-%{version}/%{name}-%{version}.tar.xz
%if %{with verify}
Source1: https://github.com/dun/munge/releases/download/%{name}-%{version}/%{name}-%{version}.tar.xz.asc
Source2: https://github.com/dun.gpg
%endif
BuildRequires: gnupg2
BuildRequires: make
BuildRequires: gcc
BuildRequires: bzip2-devel
BuildRequires: openssl-devel
BuildRequires: zlib-devel
BuildRequires: procps
BuildRequires: %{?el7:systemd}%{!?el7:systemd-rpm-macros}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: logrotate
Requires(pre): shadow-utils
%{?systemd_requires}
%description
MUNGE (MUNGE Uid 'N' Gid Emporium) is an authentication service for creating
and validating user credentials. It is designed to be highly scalable for
use in an HPC cluster environment. It provides a portable API for encoding
the user's identity into a tamper-proof credential that can be obtained by an
untrusted client and forwarded by untrusted intermediaries within a security
realm. Clients within this realm can create and validate credentials without
the use of root privileges, reserved ports, or platform-specific methods.
%package devel
Summary: MUNGE authentication service development files
License: LGPL-3.0-or-later
Requires: pkgconfig
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description devel
Development files for building applications that use libmunge.
%package libs
Summary: MUNGE authentication service shared library
License: LGPL-3.0-or-later
Requires: %{name} = %{version}-%{release}
%description libs
The shared library (libmunge) for running applications that use MUNGE.
%prep
%if %{with verify}
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%endif
%setup -q
%build
%configure --disable-static \
--with-crypto-lib=openssl \
--with-logrotateddir=%{_sysconfdir}/logrotate.d \
--with-pkgconfigdir=%{_libdir}/pkgconfig \
--with-runstatedir=%{_rundir} \
--with-systemdunitdir=%{_unitdir}
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_build
%check
%if %{with check}
%make_build check \
LD_LIBRARY_PATH=%{buildroot}%{_libdir} \
root=/tmp/munge-test-$$ verbose=t VERBOSE=t
%endif
%install
%make_install
touch %{buildroot}%{_sysconfdir}/munge/munge.key
touch %{buildroot}%{_localstatedir}/lib/munge/munged.seed
touch %{buildroot}%{_localstatedir}/log/munge/munged.log
mkdir -p %{buildroot}%{_rundir}/munge
touch %{buildroot}%{_rundir}/munge/munged.pid
#
%if 0%{?rhel} == 7
sed -i '/^RuntimeDirectory/ s/^/#/' %{buildroot}%{_unitdir}/munge.service
mkdir -p %{buildroot}%{_tmpfilesdir}
install -m 0644 src/etc/munge.tmpfiles.conf %{buildroot}%{_tmpfilesdir}/munge.conf
%endif
%pre
getent group munge >/dev/null || \
groupadd -r munge
getent passwd munge >/dev/null || \
useradd -c "MUNGE authentication service" -d "%{_sysconfdir}/munge" \
-g munge -s /sbin/nologin -r munge
exit 0
%post
if test ! -f %{_sysconfdir}/munge/munge.key; then
echo "Run %{_sbindir}/mungekey as the munge user to create a key."
echo "For example: \"sudo -u munge %{_sbindir}/mungekey -v\"."
echo "Refer to the mungekey(8) manpage for more information."
fi
%systemd_post munge.service
#
%if 0%{?rhel} == 7
systemd-tmpfiles --create %{_tmpfilesdir}/munge.conf
%endif
%post libs -p /sbin/ldconfig
%preun
%systemd_preun munge.service
%postun
%systemd_postun_with_restart munge.service
%postun libs -p /sbin/ldconfig
%files
%license COPYING
%license COPYING.LESSER
%doc AUTHORS
%doc DISCLAIMER.LLNS
%doc DISCLAIMER.UC
%doc JARGON
%doc NEWS
%doc QUICKSTART
%doc README
%doc THANKS
%doc doc/credential_v3_format.txt
%dir %attr(0700,munge,munge) %{_sysconfdir}/munge
%attr(0600,munge,munge) %config(noreplace) %ghost %{_sysconfdir}/munge/munge.key
%config(noreplace) %{_sysconfdir}/logrotate.d/munge
%config(noreplace) %{_sysconfdir}/sysconfig/munge
%dir %attr(0700,munge,munge) %{_localstatedir}/lib/munge
%attr(0600,munge,munge) %ghost %{_localstatedir}/lib/munge/munged.seed
%dir %attr(0700,munge,munge) %{_localstatedir}/log/munge
%attr(0640,munge,munge) %ghost %{_localstatedir}/log/munge/munged.log
%dir %attr(0755,munge,munge) %ghost %{_rundir}/munge
%attr(0644,munge,munge) %ghost %{_rundir}/munge/munged.pid
%{_bindir}/munge
%{_bindir}/remunge
%{_bindir}/unmunge
%{_sbindir}/munged
%{_sbindir}/mungekey
%{_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
%{_mandir}/man8/mungekey.8.gz
%{_unitdir}/munge.service
#
%if 0%{?rhel} == 7
%{_tmpfilesdir}/munge.conf
%endif
%files devel
%{_includedir}/munge.h
%if 0%{?fedora} < 36
%{_libdir}/libmunge.la
%endif
%{_libdir}/libmunge.so
%{_libdir}/pkgconfig/munge.pc
%{_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
%files libs
%{_libdir}/libmunge.so.2
%{_libdir}/libmunge.so.2.0.0