Skip to content

Latest commit

 

History

History
350 lines (300 loc) · 12.8 KB

policycoreutils.spec

File metadata and controls

350 lines (300 loc) · 12.8 KB
 
Oct 16, 2018
Oct 16, 2018
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# based on work by The Fedora Project (2017)
# Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Oct 16, 2018
Oct 16, 2018
23
24
25
26
%global libauditver 2.1.3
%global libsepolver 2.8
%global libsemanagever 2.8
%global libselinuxver 2.8
Oct 16, 2018
Oct 16, 2018
27
%global sepolgenver 2.8
28
Oct 16, 2018
Oct 16, 2018
29
%global generatorsdir /lib/systemd/system-generators
Oct 16, 2018
Oct 16, 2018
30
31
%if ! %{defined python3_sitearch}
Oct 16, 2018
Oct 16, 2018
32
%define python3_sitearch /%{_libdir}/python3.?/site-packages
Oct 16, 2018
Oct 16, 2018
33
34
35
%endif
%if ! %{defined python3_sitelib}
Oct 16, 2018
Oct 16, 2018
36
%define python3_sitelib /%{_libdir}/python3.?/site-packages
Oct 16, 2018
Oct 16, 2018
37
%endif
38
39
40
Summary: SELinux policy core utilities
Name: policycoreutils
Oct 16, 2018
Oct 16, 2018
41
Version: 2.8
Oct 16, 2018
Oct 16, 2018
42
Release: 1
43
44
License: GPLv2
Group: System Environment/Base
Oct 16, 2018
Oct 16, 2018
45
Source: %{name}-%{version}.tar.bz2
46
47
48
49
50
51
URL: https://github.com/SELinuxProject
Source15: selinux-autorelabel
Source16: selinux-autorelabel.service
Source17: selinux-autorelabel-mark.service
Source18: selinux-autorelabel.target
Source19: selinux-autorelabel-generator.sh
Oct 16, 2018
Oct 16, 2018
52
Patch0: disable_awk_sandbox_policycoreutils.patch
Oct 16, 2018
Oct 16, 2018
53
Patch1: fix_systemd_path.patch
54
55
56
Provides: /sbin/fixfiles
Provides: /sbin/restorecon
Oct 16, 2018
Oct 16, 2018
57
58
59
60
61
62
63
64
65
66
67
BuildRequires: audit-libs-devel >= %{libauditver}
BuildRequires: dbus-devel
BuildRequires: dbus-glib-devel
BuildRequires: gettext
BuildRequires: libcap-ng-devel
BuildRequires: libsepol-static >= %{libsepolver}
BuildRequires: libsemanage-static >= %{libsemanagever}
BuildRequires: libselinux-devel >= %{libselinuxver}
BuildRequires: libcap-devel
BuildRequires: pam-devel
BuildRequires: python
Oct 16, 2018
Oct 16, 2018
68
BuildRequires: python3-devel
69
BuildRequires: systemd
Oct 16, 2018
Oct 16, 2018
70
71
72
73
74
75
76
Requires: util-linux
Requires: grep
Requires: gawk
Requires: diffutils
Requires: rpm
Requires: sed
Oct 17, 2018
Oct 17, 2018
77
78
79
Requires: libsepol >= %{libsepolver}
Requires: coreutils
Requires: libselinux-utils >= %{libselinuxver}
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
%description
Security-enhanced Linux is a feature of the Linux® kernel and a number
of utilities with enhanced security functionality designed to add
mandatory access controls to Linux. The Security-enhanced Linux
kernel contains new architectural components originally developed to
improve the security of the Flask operating system. These
architectural components provide general support for the enforcement
of many kinds of mandatory access control policies, including those
based on the concepts of Type Enforcement®, Role-based Access
Control, and Multi-level Security.
policycoreutils contains the policy core utilities that are required
for basic operation of a SELinux system. These utilities include
load_policy to load policies, setfiles to label filesystems, newrole
to switch roles.
%prep
Oct 16, 2018
Oct 16, 2018
98
%setup -q -n %{name}-%{version}/upstream
Oct 16, 2018
Oct 16, 2018
99
%patch0 -p1
Oct 16, 2018
Oct 16, 2018
100
%patch1 -p1
101
102
%build
Oct 17, 2018
Oct 17, 2018
103
make -C policycoreutils LSPP_PRIV=y SBINDIR="%{_sbindir}" LIBDIR="%{_libdir}" CFLAGS="%{optflags} -fPIE" LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now" SEMODULE_PATH="%{_sbindir}" LIBSEPOLA="%{_libdir}/libsepol.a" all
Oct 16, 2018
Oct 16, 2018
104
Oct 16, 2018
Oct 16, 2018
105
make -C python SBINDIR="%{_sbindir}" LSPP_PRIV=y LIBDIR="%{_libdir}" CFLAGS="%{optflags} -fPIE" LDFLAGS="-pie -Wl,-z,relro" LIBSEPOLA="%{_libdir}/libsepol.a" all
Oct 16, 2018
Oct 16, 2018
106
Oct 16, 2018
Oct 16, 2018
107
make -C dbus SBINDIR="%{_sbindir}" LSPP_PRIV=y LIBDIR="%{_libdir}" CFLAGS="%{optflags} -fPIE" LDFLAGS="-pie -Wl,-z,relro" LIBSEPOLA="%{_libdir}/libsepol.a" all
Oct 16, 2018
Oct 16, 2018
108
Oct 16, 2018
Oct 16, 2018
109
make -C semodule-utils SBINDIR="%{_sbindir}" LSPP_PRIV=y LIBDIR="%{_libdir}" CFLAGS="%{optflags} -fPIE" LDFLAGS="-pie -Wl,-z,relro" LIBSEPOLA="%{_libdir}/libsepol.a" all
Oct 16, 2018
Oct 16, 2018
110
Oct 16, 2018
Oct 16, 2018
111
make -C restorecond SBINDIR="%{_sbindir}" LSPP_PRIV=y LIBDIR="%{_libdir}" CFLAGS="%{optflags} -fPIE" LDFLAGS="-pie -Wl,-z,relro" LIBSEPOLA="%{_libdir}/libsepol.a" all
112
113
114
115
116
117
118
119
120
%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_mandir}/man1
mkdir -p %{buildroot}%{_mandir}/man5
mkdir -p %{buildroot}%{_mandir}/man8
%{__mkdir} -p %{buildroot}/%{_usr}/share/doc/%{name}/
Oct 17, 2018
Oct 17, 2018
121
make -C policycoreutils LSPP_PRIV=y DESTDIR="%{buildroot}" SBINDIR="%{_sbindir}" LIBDIR="%{_libdir}" SEMODULE_PATH="%{_sbindir}" LIBSEPOLA="%{_libdir}/libsepol.a" install
122
Oct 16, 2018
Oct 16, 2018
123
make -C python PYTHON=%{__python3} DESTDIR="%{buildroot}" SBINDIR="%{_sbindir}" LIBDIR="%{_libdir}" LIBSEPOLA="%{_libdir}/libsepol.a" install
124
Oct 16, 2018
Oct 16, 2018
125
make -C dbus PYTHON=%{__python3} DESTDIR="%{buildroot}" SBINDIR="%{_sbindir}" LIBDIR="%{_libdir}" LIBSEPOLA="%{_libdir}/libsepol.a" install
126
Oct 16, 2018
Oct 16, 2018
127
make -C semodule-utils PYTHON=%{__python3} DESTDIR="%{buildroot}" SBINDIR="%{_sbindir}" LIBDIR="%{_libdir}" LIBSEPOLA="%{_libdir}/libsepol.a" install
128
Oct 16, 2018
Oct 16, 2018
129
make -C restorecond PYTHON=%{__python3} DESTDIR="%{buildroot}" SBINDIR="%{_sbindir}" LIBDIR="%{_libdir}" SYSTEMDDIR="%{_unitdir}" LIBSEPOLA="%{_libdir}/libsepol.a" install
130
131
132
133
134
135
# Systemd
rm -rf %{buildroot}/%{_sysconfdir}/rc.d/init.d/restorecond
rm -f %{buildroot}/usr/share/man/man8/open_init_pty.8
Oct 16, 2018
Oct 16, 2018
136
137
rm -f %{buildroot}%{_sbindir}/open_init_pty
rm -f %{buildroot}%{_sbindir}/run_init
138
rm -f %{buildroot}/etc/pam.d/run_init*
Oct 16, 2018
Oct 16, 2018
139
140
141
142
rm -f %{buildroot}/usr/share/man/man8/sepolicy-gui.8*
rm -f %{buildroot}/usr/share/man/man8/run_init.8*
rm -f %{buildroot}/usr/lib/python3.4/site-packages/sepolicy/sepolicy.glade
rm -f %{buildroot}/usr/lib/python3.4/site-packages/sepolicy/gui.py
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# https://bugzilla.redhat.com/show_bug.cgi?id=1328825
mkdir -m 755 -p %{buildroot}/%{_unitdir}/basic.target.wants/
mkdir -m 755 -p %{buildroot}/%{generatorsdir}
install -m 644 -p %{SOURCE16} %{buildroot}/%{_unitdir}/
install -m 644 -p %{SOURCE17} %{buildroot}/%{_unitdir}/
install -m 644 -p %{SOURCE18} %{buildroot}/%{_unitdir}/
install -m 755 -p %{SOURCE19} %{buildroot}/%{generatorsdir}/
install -m 755 -p %{SOURCE15} %{buildroot}/%{_libexecdir}/selinux/
ln -s ../selinux-autorelabel-mark.service %{buildroot}/%{_unitdir}/basic.target.wants/
# change /usr/bin/python to %%{__python3} in policycoreutils-python3
find %{buildroot}%{python3_sitelib} %{buildroot}%{python3_sitearch} -type f | xargs \
sed -i '1s%\(#! *\)/usr/bin/python\([^3].*\|\)$%\1%{__python3}\2%'
# change /usr/bin/python to %%{__python3} in python-utils
sed -i '1s%\(#! *\)/usr/bin/python\([^3].*\|\)$%\1%{__python3}\2%' \
%{buildroot}%{_sbindir}/semanage \
%{buildroot}%{_bindir}/chcat \
%{buildroot}%{_bindir}/audit2allow \
%{buildroot}%{_bindir}/audit2why \
%{buildroot}%{_bindir}/sepolicy \
%{buildroot}%{_bindir}/sepolgen{,-ifgen} \
%nil
%find_lang %{name}
%package python-utils
Summary: SELinux policy core python utilities
Requires: policycoreutils-python3 = %{version}-%{release}
%description python-utils
The policycoreutils-python-utils package contains the management tools use to manage
an SELinux environment.
%files python-utils
%{_sbindir}/semanage
%{_bindir}/chcat
%{_bindir}/audit2allow
%{_bindir}/audit2why
%{_bindir}/semodule_package
%{_sysconfdir}/dbus-1/system.d/org.selinux.conf
%{_datadir}/bash-completion/completions/semanage
%{_datadir}/bash-completion/completions/setsebool
%package dbus
Summary: SELinux policy core DBUS api
Requires: policycoreutils-python3 = %{version}-%{release}
Requires: python3-slip-dbus
%description dbus
The policycoreutils-dbus package contains the management DBUS API use to manage
an SELinux environment.
%files dbus
%{_sysconfdir}/dbus-1/system.d/org.selinux.conf
%{_datadir}/dbus-1/system-services/org.selinux.service
%{_datadir}/polkit-1/actions/org.selinux.policy
%{_datadir}/system-config-selinux/selinux_server.py*
%package python3
Summary: SELinux policy core python3 interfaces
Group: System Environment/Base
Requires:policycoreutils = %{version}-%{release}
Requires:libsemanage-python3 >= %{libsemanagever} libselinux-python3 libcgroup
Requires:audit-libs-python3 >= %{libauditver}
Requires: python3-IPy
Requires: checkpolicy
Requires: setools-python3 >= 4.1.1
%description python3
The policycoreutils-python3 package contains the interfaces that can be used
by python 3 in an SELinux environment.
%files python3
%{python3_sitearch}/seobject.py*
%{python3_sitearch}/__pycache__
%{python3_sitearch}/sepolgen
%dir %{python3_sitelib}/sepolicy
%{python3_sitelib}/sepolicy/templates
%dir %{python3_sitelib}/sepolicy/help
%{python3_sitelib}/sepolicy/help/*
%{python3_sitelib}/sepolicy/__init__.py*
%{python3_sitelib}/sepolicy/booleans.py*
%{python3_sitelib}/sepolicy/communicate.py*
%{python3_sitelib}/sepolicy/generate.py*
%{python3_sitelib}/sepolicy/interface.py*
%{python3_sitelib}/sepolicy/manpage.py*
%{python3_sitelib}/sepolicy/network.py*
%{python3_sitelib}/sepolicy/transition.py*
%{python3_sitelib}/sepolicy/sedbus.py*
%{python3_sitelib}/sepolicy*.egg-info
%{python3_sitelib}/sepolicy/__pycache__
%package devel
Summary: SELinux policy core policy devel utilities
Group: System Environment/Base
Requires: policycoreutils-python-utils = %{version}-%{release}
Oct 16, 2018
Oct 16, 2018
241
Requires: /usr/bin/make
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
Requires: selinux-policy-devel
%description devel
The policycoreutils-devel package contains the management tools use to develop policy in an SELinux environment.
%files devel
%{_bindir}/sepolgen
%{_bindir}/sepolgen-ifgen
%{_bindir}/sepolgen-ifgen-attr-helper
%dir /var/lib/sepolgen
/var/lib/sepolgen/perm_map
%{_bindir}/sepolicy
%{_mandir}/man8/sepolgen.8*
%{_mandir}/man8/sepolicy-booleans.8*
%{_mandir}/man8/sepolicy-generate.8*
%{_mandir}/man8/sepolicy-interface.8*
%{_mandir}/man8/sepolicy-network.8*
%{_mandir}/man8/sepolicy.8*
%{_mandir}/man8/sepolicy-communicate.8*
%{_mandir}/man8/sepolicy-manpage.8*
%{_mandir}/man8/sepolicy-transition.8*
%{_usr}/share/bash-completion/completions/sepolicy
%{_bindir}/semodule_expand
%{_bindir}/semodule_link
%{_bindir}/semodule_unpackage
%{_mandir}/man8/semodule_expand.8*
%{_mandir}/man8/semodule_link.8*
%{_mandir}/man8/semodule_unpackage.8*
Oct 17, 2018
Oct 17, 2018
270
271
272
273
274
275
276
277
278
279
280
281
282
283
%{_mandir}/man5/selinux_config.5.gz
%{_mandir}/man5/sestatus.conf.5.gz
%{_mandir}/man8/fixfiles.8*
%{_mandir}/man8/load_policy.8*
%{_mandir}/man8/restorecon.8*
%{_mandir}/man8/restorecon_xattr.8*
%{_mandir}/man8/semodule.8*
%{_mandir}/man8/sestatus.8*
%{_mandir}/man8/setfiles.8*
%{_mandir}/man8/setsebool.8*
%{_mandir}/man1/secon.1*
%{_mandir}/man8/genhomedircon.8*
%{_mandir}/man1/newrole.1.gz
%{_mandir}/man8/restorecond.8*
Oct 17, 2018
Oct 17, 2018
284
285
286
287
288
%{_mandir}/man1/audit2allow.1*
%{_mandir}/man8/semodule_package.8*
%{_mandir}/man1/audit2why.1*
%{_mandir}/man8/chcat.8*
%{_mandir}/man8/semanage*.8*
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
%package newrole
Summary: The newrole application for RBAC/MLS
Group: System Environment/Base
Requires: policycoreutils = %{version}-%{release}
%description newrole
RBAC/MLS policy machines require newrole as a way of changing the role
or level of a logged in user.
%files newrole
%attr(0755,root,root) %caps(cap_dac_read_search,cap_setpcap,cap_audit_write,cap_sys_admin,cap_fowner,cap_chown,cap_dac_override=pe) %{_bindir}/newrole
%config(noreplace) %{_sysconfdir}/pam.d/newrole
%files -f %{name}.lang
%{_sbindir}/restorecon
%{_sbindir}/restorecon_xattr
%{_sbindir}/fixfiles
%{_sbindir}/setfiles
%{_sbindir}/load_policy
%{_sbindir}/genhomedircon
%{_sbindir}/setsebool
%{_sbindir}/semodule
%{_sbindir}/sestatus
%{_bindir}/secon
%{_libexecdir}/selinux/hll
%{_libexecdir}/selinux/selinux-autorelabel
%{_unitdir}/selinux-autorelabel-mark.service
%{_unitdir}/basic.target.wants/selinux-autorelabel-mark.service
%{_unitdir}/selinux-autorelabel.service
%{_unitdir}/selinux-autorelabel.target
%{generatorsdir}/selinux-autorelabel-generator.sh
%config(noreplace) %{_sysconfdir}/sestatus.conf
# selinux-policy Requires: policycoreutils, so we own this set of directories and our files within them
Oct 16, 2018
Oct 16, 2018
323
%doc policycoreutils/COPYING
324
325
326
327
328
%doc %{_usr}/share/doc/%{name}
%package restorecond
Summary: SELinux restorecond utilities
Group: System Environment/Base
Oct 16, 2018
Oct 16, 2018
329
#BuildRequires: systemd-units
330
331
332
333
334
335
336
337
338
339
340
%description restorecond
The policycoreutils-restorecond package contains the restorecond service.
%files restorecond
%{_sbindir}/restorecond
%{_unitdir}/restorecond.service
%config(noreplace) %{_sysconfdir}/selinux/restorecond.conf
%config(noreplace) %{_sysconfdir}/selinux/restorecond_user.conf
%{_sysconfdir}/xdg/autostart/restorecond.desktop
%{_datadir}/dbus-1/services/org.selinux.Restorecond.service
Oct 16, 2018
Oct 16, 2018
341
%doc policycoreutils/COPYING
342
343
344
345
346
347
348
349
350
%post restorecond
%systemd_post restorecond.service
%preun restorecond
%systemd_preun restorecond.service
%postun restorecond
%systemd_postun_with_restart restorecond.service