1580c87
%define distro redhat
1580c87
%define direct_initrc y
1580c87
%define monolithic n
1580c87
%define polname1 targeted
d77f56b
%define polname2 mls
d77f56b
%define polname3 strict
7c94e8e
%define POLICYVER 20
7c94e8e
%define POLICYCOREUTILSVER 1.29.1-1
7c94e8e
%define CHECKPOLICYVER 1.28-1
1580c87
Summary: SELinux policy configuration
1580c87
Name: selinux-policy
e24a8b1
Version: 2.1.4
e24a8b1
Release: 1
1580c87
License: GPL
1580c87
Group: System Environment/Base
1580c87
Source: serefpolicy-%{version}.tgz
6f5a3bc
patch: policy-20051208.patch
d77f56b
Source1: modules-%{polname1}.conf
d77f56b
Source2: booleans-%{polname1}.conf
d77f56b
Source3: seusers-%{polname1}
d77f56b
Source4: setrans-%{polname1}.conf
d77f56b
Source5: modules-%{polname2}.conf
d77f56b
Source6: booleans-%{polname2}.conf
d77f56b
Source7: seusers-%{polname2}
d77f56b
Source8: setrans-%{polname2}.conf
3e930b8
1580c87
Url: http://serefpolicy.sourceforge.net
1580c87
BuildRoot: %{_tmppath}/serefpolicy-buildroot
1580c87
BuildArch: noarch
1580c87
BuildRequires: checkpolicy >= %{CHECKPOLICYVER} m4 policycoreutils >= %{POLICYCOREUTILSVER}
12e089c
PreReq: policycoreutils >= %{POLICYCOREUTILSVER}
1580c87
Obsoletes: policy 
1580c87
46e7261
%package %{polname1}
46e7261
Summary: SELinux %{polname1} base policy
46e7261
Group: System Environment/Base
46e7261
Provides: selinux-policy-base
46e7261
Obsoletes: selinux-policy-%{polname1}-sources
eb190f8
Prereq: policycoreutils >= %{POLICYCOREUTILSVER}
eb190f8
Prereq: coreutils
46e7261
46e7261
%description %{polname1}
46e7261
SELinux Reference policy targeted base module.
46e7261
1580c87
%define installCmds() \
3e930b8
cp -f ${RPM_SOURCE_DIR}/modules-%1.conf  ./policy/modules.conf \
3e930b8
cp -f ${RPM_SOURCE_DIR}/booleans-%1.conf ./policy/booleans.conf \
3e930b8
make NAME=%1 TYPE=%2 DISTRO=%{distro} DIRECT_INITRC=%3 MONOLITHIC=%{monolithic} base.pp \
3e930b8
make NAME=%1 TYPE=%2 DISTRO=%{distro} DIRECT_INITRC=%3 MONOLITHIC=%{monolithic} modules \
1580c87
%{__mkdir} -p $RPM_BUILD_ROOT/%{_usr}/share/selinux/%1/ \
1580c87
%{__cp} *.pp $RPM_BUILD_ROOT/%{_usr}/share/selinux/%1/ \
1580c87
%{__mkdir} -p $RPM_BUILD_ROOT/%{_sysconfdir}/selinux/%1/policy \
1580c87
%{__mkdir} -p $RPM_BUILD_ROOT/%{_sysconfdir}/selinux/%1/modules/active \
1580c87
%{__mkdir} -p $RPM_BUILD_ROOT/%{_sysconfdir}/selinux/%1/contexts/files \
a1e07bd
make NAME=%1 TYPE=%2 DISTRO=%{distro} DIRECT_INITRC=%3 MONOLITHIC=%{monolithic} DESTDIR=$RPM_BUILD_ROOT install-appconfig \
1580c87
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/selinux/%1/booleans \
1580c87
touch $RPM_BUILD_ROOT%{_sysconfdir}/selinux/config \
1580c87
touch $RPM_BUILD_ROOT%{_sysconfdir}/selinux/%1/seusers \
7c94e8e
touch $RPM_BUILD_ROOT%{_sysconfdir}/selinux/%1/policy/policy.%{POLICYVER} \
1580c87
touch $RPM_BUILD_ROOT%{_sysconfdir}/selinux/%1/contexts/files/file_contexts \
1580c87
touch $RPM_BUILD_ROOT%{_sysconfdir}/selinux/%1/contexts/files/homedir_template \
3e930b8
touch $RPM_BUILD_ROOT%{_sysconfdir}/selinux/%1/contexts/files/file_contexts.homedirs \
3e930b8
install -m0644 ${RPM_SOURCE_DIR}/seusers-%1 ${RPM_BUILD_ROOT}%{_sysconfdir}/selinux/%1/modules/active/seusers \
3e930b8
install -m0644 ${RPM_SOURCE_DIR}/setrans-%1.conf ${RPM_BUILD_ROOT}%{_sysconfdir}/selinux/%1/setrans.conf \
3e930b8
%nil
1580c87
1580c87
%define fileList() \
1580c87
%defattr(-,root,root) \
1580c87
%dir %{_usr}/share/selinux \
1580c87
%dir %{_usr}/share/selinux/%1 \
1580c87
%config %{_usr}/share/selinux/%1/base.pp \
1580c87
%dir %{_sysconfdir}/selinux \
1580c87
%ghost %config(noreplace) %{_sysconfdir}/selinux/config \
1580c87
%dir %{_sysconfdir}/selinux/%1 \
1580c87
%config(noreplace) %{_sysconfdir}/selinux/%1/setrans.conf \
1580c87
%ghost %{_sysconfdir}/selinux/%1/seusers \
1580c87
%dir %{_sysconfdir}/selinux/%1/modules \
21dea1c
%attr(700,root,root) %dir %{_sysconfdir}/selinux/%1/modules/active \
21dea1c
%verify(not md5 size mtime) %attr(600,root,root) %config(noreplace) %{_sysconfdir}/selinux/%1/modules/active/seusers \
1580c87
%dir %{_sysconfdir}/selinux/%1/policy/ \
7c94e8e
%ghost %{_sysconfdir}/selinux/%1/policy/policy.* \
1580c87
%dir %{_sysconfdir}/selinux/%1/contexts \
1580c87
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/customizable_types \
1580c87
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/dbus_contexts \
7c94e8e
%config %{_sysconfdir}/selinux/%1/contexts/default_contexts \
1580c87
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/default_type \
1580c87
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/failsafe_context \
1580c87
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/initrc_context \
1580c87
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/removable_context \
1580c87
%config(noreplace) %{_sysconfdir}/selinux/%1/contexts/userhelper_context \
1580c87
%dir %{_sysconfdir}/selinux/%1/contexts/files \
1580c87
%ghost %config %{_sysconfdir}/selinux/%1/contexts/files/file_contexts \
1580c87
%ghost %config %{_sysconfdir}/selinux/%1/contexts/files/homedir_template \
1580c87
%ghost %config %{_sysconfdir}/selinux/%1/contexts/files/file_contexts.homedirs \
1580c87
%config %{_sysconfdir}/selinux/%1/contexts/files/media
1580c87
1580c87
%define saveFileContext() \
bd7e86c
if [ -s /etc/selinux/config ]; then \
bd7e86c
	. %{_sysconfdir}/selinux/config; \
bd7e86c
	FILE_CONTEXT=%{_sysconfdir}/selinux/%1/contexts/files/file_contexts; \
bd7e86c
	if [ "${SELINUXTYPE}" == %1 -a -f ${FILE_CONTEXT} ]; then \
bd7e86c
		cp -f ${FILE_CONTEXT} ${FILE_CONTEXT}.pre; \
bd7e86c
	fi \
bd7e86c
fi
1580c87
1580c87
%define rebuildpolicy() \
1580c87
semodule -b /usr/share/selinux/%1/base.pp -s %1 \
1580c87
for file in $(ls /usr/share/selinux/%1 | grep -v base.pp) \
1580c87
do \
1580c87
	semodule -i /usr/share/selinux/%1/$file -s %1;\
598be15
done; \
598be15
rm -f %{_sysconfdir}/selinux/%1/policy/policy.*.rpmnew
1580c87
1580c87
%define relabel() \
1580c87
. %{_sysconfdir}/selinux/config; \
1580c87
FILE_CONTEXT=%{_sysconfdir}/selinux/%1/contexts/files/file_contexts; \
1580c87
if [ "${SELINUXTYPE}" == %1 -a -f ${FILE_CONTEXT}.pre ]; then \
1580c87
	fixfiles -C ${FILE_CONTEXT}.pre restore; \
1580c87
	rm -f ${FILE_CONTEXT}.pre; \
1580c87
fi; 
1580c87
1580c87
%description
1580c87
SELinux Reference Policy - modular.
1580c87
3e930b8
%prep 
1580c87
%setup -q -n serefpolicy-%{version}
3e930b8
%patch0 -p1 
3e930b8
	
1580c87
%install
e568731
e568731
# Build targeted policy
3e930b8
make conf
1580c87
%{__rm} -fR $RPM_BUILD_ROOT
d77f56b
%installCmds %{polname1} targeted-mcs %{direct_initrc}
3e930b8
e568731
# Build mls policy
3e930b8
make clean
3e930b8
make conf
d77f56b
%installCmds %{polname2} strict-mls n
d77f56b
3e930b8
d77f56b
# Build strict policy
d77f56b
# Commented out because only targeted ref policy currently builds
d77f56b
# make clean
d77f56b
# make conf
d77f56b
#%#installCmds %{polname3} strict-mcs %{direct_initrc}
1580c87
1580c87
%clean
1580c87
%{__rm} -fR $RPM_BUILD_ROOT
1580c87
af60908
%files %{polname1}
af60908
%fileList %{polname1}
af60908
af60908
%pre %{polname1}
af60908
%saveFileContext %{polname1}
af60908
af60908
%post %{polname1}
af60908
if [ ! -s /etc/selinux/config ]; then
af60908
	#
af60908
	#	New install so we will default to targeted policy
af60908
	#
af60908
	echo "
af60908
# This file controls the state of SELinux on the system.
af60908
# SELINUX= can take one of these three values:
af60908
#	enforcing - SELinux security policy is enforced.
af60908
#	permissive - SELinux prints warnings instead of enforcing.
af60908
#	disabled - No SELinux policy is loaded.
af60908
SELINUX=enforcing
af60908
# SELINUXTYPE= can take one of these two values:
af60908
#	targeted - Only targeted network daemons are protected.
af60908
#	strict - Full SELinux protection.
af60908
#	mls - Multi Level Security protection.
af60908
SELINUXTYPE=targeted 
af60908
# SETLOCALDEFS= Check local definition changes
af60908
SETLOCALDEFS=0 
af60908
af60908
" > /etc/selinux/config
af60908
af60908
	ln -sf /etc/selinux/config /etc/sysconfig/selinux 
af60908
	restorecon /etc/selinux/config 2> /dev/null
af60908
else
af60908
	# if first time update booleans.local needs to be copied to sandbox
af60908
	[ -f /etc/selinux/%{polname1}/booleans.local ] && mv /etc/selinux/%{polname1}/booleans.local /etc/selinux/%{polname1}/modules/active/
af60908
	[ -f /etc/selinux/%{polname1}/seusers ] && cp -f /etc/selinux/%{polname1}/seusers /etc/selinux/%{polname1}/modules/active/seusers
af60908
	grep -q "^SETLOCALDEFS" /etc/selinux/config || echo -n "
af60908
# SETLOCALDEFS= Check local definition changes
af60908
SETLOCALDEFS=0 
af60908
">> /etc/selinux/config
af60908
fi
af60908
%rebuildpolicy %{polname1}
af60908
%relabel %{polname1}
af60908
2b2203d
%triggerpostun %{polname1} -- selinux-policy-%{polname1} <= 2.0.7
af60908
%rebuildpolicy %{polname1}
af60908
1580c87
%package %{polname2} 
1580c87
Summary: SELinux %{polname2} base policy
1580c87
Group: System Environment/Base
1580c87
Provides: selinux-policy-base
be926ab
Obsoletes: selinux-policy-%{polname2}-sources
eb190f8
Prereq: policycoreutils >= %{POLICYCOREUTILSVER}
eb190f8
Prereq: coreutils
1580c87
1580c87
%description %{polname2} 
1580c87
SELinux Reference policy %{polname2} base module.
1580c87
1580c87
%pre %{polname2} 
1580c87
%saveFileContext %{polname2}
1580c87
1580c87
%post %{polname2} 
1580c87
%rebuildpolicy %{polname2} 
d77f56b
%relabel %{polname2}
1580c87
2b2203d
%triggerpostun %{polname2} -- %{polname2} <= 2.0.7
1580c87
%{rebuildpolicy} %{polname2} 
1580c87
1580c87
%files %{polname2}
d77f56b
%fileList %{polname2}
3e930b8
d77f56b
%if 0
3e930b8
%package %{polname3} 
3e930b8
Summary: SELinux %{polname3} base policy
3e930b8
Group: System Environment/Base
3e930b8
Provides: selinux-policy-base
3e930b8
Obsoletes: selinux-policy-%{polname3}-sources
eb190f8
Prereq: policycoreutils >= %{POLICYCOREUTILSVER}
eb190f8
Prereq: coreutils
3e930b8
3e930b8
%description %{polname3} 
3e930b8
SELinux Reference policy %{polname3} base module.
3e930b8
3e930b8
%pre %{polname3} 
3e930b8
%saveFileContext %{polname3}
3e930b8
3e930b8
%post %{polname3} 
3e930b8
%rebuildpolicy %{polname3} 
d77f56b
%relabel %{polname3}
3e930b8
2b2203d
%triggerpostun %{polname3} -- %{polname3} <= 2.0.7
3e930b8
%{rebuildpolicy} %{polname3} 
3e930b8
3e930b8
%files %{polname3}
d4da533
%fileList %{polname3}
d4da533
d77f56b
%endif
3e930b8
3e930b8
1580c87
%changelog
e24a8b1
* Mon Dec 12 2005 Dan Walsh <dwalsh@redhat.com> 2.1.4-1
1ff14ab
- Fixes for hal
e24a8b1
- Update to upstream
1ff14ab
afa8a21
* Mon Dec 12 2005 Dan Walsh <dwalsh@redhat.com> 2.1.3-1
d8566e6
- Turn back on execmem since we need it for java, firefox, ooffice
57c18fe
- Allow gpm to stream socket to itself
57c18fe
eb190f8
* Mon Dec 12 2005 Jeremy Katz <katzj@redhat.com> - 2.1.2-3
eb190f8
- fix requirements to be on the actual packages so that policy can get
eb190f8
  created properly at install time
eb190f8
9e85a85
* Sun Dec  10 2005 Dan Walsh <dwalsh@redhat.com> 2.1.2-2
9e85a85
- Allow unconfined_t to execmod texrel_shlib_t
9e85a85
d4da533
* Sat Dec  9 2005 Dan Walsh <dwalsh@redhat.com> 2.1.2-1
d4da533
- Update to upstream 
d4da533
- Turn off allow_execmem and allow_execmod booleans
d4da533
- Add tcpd and automount policies
d4da533
e1ccb6f
* Fri Dec  8 2005 Dan Walsh <dwalsh@redhat.com> 2.1.1-3
e1ccb6f
- Add two new httpd booleans, turned off by default
e1ccb6f
	* httpd_can_network_relay
e1ccb6f
	* httpd_can_network_connect_db
e1ccb6f
7c94e8e
* Fri Dec  8 2005 Dan Walsh <dwalsh@redhat.com> 2.1.1-2
7c94e8e
- Add ghost for policy.20
7c94e8e
6f5a3bc
* Thu Dec  8 2005 Dan Walsh <dwalsh@redhat.com> 2.1.1-1
6f5a3bc
- Update to upstream
6f5a3bc
- Turn off boolean allow_execstack
6f5a3bc
c6c4985
* Thu Dec  8 2005 Dan Walsh <dwalsh@redhat.com> 2.1.0-3
c6c4985
- Change setrans-mls to use new libsetrans
c6c4985
- Add default_context rule for xdm
c6c4985
12e089c
* Thu Dec  8 2005 Dan Walsh <dwalsh@redhat.com> 2.1.0-2.
12e089c
- Change Requires to PreReg for requiring of policycoreutils on install
12e089c
12e089c
* Wed Dec  7 2005 Dan Walsh <dwalsh@redhat.com> 2.1.0-1.
12e089c
- New upstream release
12e089c
97bd2aa
* Wed Dec  7 2005 Dan Walsh <dwalsh@redhat.com> 2.0.11-2.
97bd2aa
Add xdm policy
97bd2aa
46a9067
* Tue Dec  6 2005 Dan Walsh <dwalsh@redhat.com> 2.0.11-1.
46a9067
Update from upstream
46a9067
4751861
* Fri Dec  2 2005 Dan Walsh <dwalsh@redhat.com> 2.0.9-1.
4751861
Update from upstream
4751861
caeef12
* Fri Dec  2 2005 Dan Walsh <dwalsh@redhat.com> 2.0.8-1.
caeef12
Update from upstream
caeef12
2b2203d
* Fri Dec  2 2005 Dan Walsh <dwalsh@redhat.com> 2.0.7-3
2b2203d
- Also trigger to rebuild policy for versions up to 2.0.7.
2b2203d
2b2203d
* Tue Nov 29 2005 Dan Walsh <dwalsh@redhat.com> 2.0.7-2
28930b1
- No longer installing policy.20 file, anaconda handles the building of the app.
28930b1
2b2203d
* Tue Nov 29 2005 Dan Walsh <dwalsh@redhat.com> 2.0.6-2
4199dc8
- Fixes for dovecot and saslauthd
4199dc8
2b2203d
* Wed Nov 23 2005 Dan Walsh <dwalsh@redhat.com> 2.0.5-4
21dea1c
- Cleanup pegasus and named 
21dea1c
- Fix spec file
c1b0228
- Fix up passwd changing applications
21dea1c
2b2203d
* Tue Nov 21 2005 Dan Walsh <dwalsh@redhat.com> 2.0.5-1
e38dc41
-Update to latest from upstream
e38dc41
2b2203d
* Tue Nov 21 2005 Dan Walsh <dwalsh@redhat.com> 2.0.4-1
765f818
- Add rules for pegasus and avahi
765f818
2b2203d
* Mon Nov 21 2005 Dan Walsh <dwalsh@redhat.com> 2.0.2-2
a32f665
- Start building MLS Policy
a32f665
2b2203d
* Fri Nov 18 2005 Dan Walsh <dwalsh@redhat.com> 2.0.2-1
1a0a256
- Update to upstream
1a0a256
2b2203d
* Wed Nov 9 2005 Dan Walsh <dwalsh@redhat.com> 2.0.1-2
205d3ff
- Turn on bash
205d3ff
2b2203d
* Wed Nov 9 2005 Dan Walsh <dwalsh@redhat.com> 2.0.1-1
1580c87
- Initial version