commit 83915aca944250f29b68d9c48573034a784cd3a9 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:58:03 2019 -0400 Package init diff --git a/libsemanage-2.9.tar.gz b/libsemanage-2.9.tar.gz new file mode 100644 index 0000000..9f73aff Binary files /dev/null and b/libsemanage-2.9.tar.gz differ diff --git a/libsemanage.spec b/libsemanage.spec new file mode 100644 index 0000000..39d2a7c --- /dev/null +++ b/libsemanage.spec @@ -0,0 +1,118 @@ +%define libsepol_version 2.8-1 +%define libselinux_version 2.8-1 + +Name: libsemanage +Version: 2.9 +Release: 1 +License: LGPLv2+ +Summary: SELinux binary policy manipulation library +URL: https://github.com/SELinuxProject/selinux/wiki +Source0: https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20180524/libsemanage-2.9.tar.gz +Source1: semanage.conf + +BuildRequires: gcc python3-devel python2-devel bison flex bzip2-devel audit-libs-devel +BuildRequires: libselinux-devel >= %{libselinux_version} swig ustr-devel libsepol-devel >= %{libsepol_version} + +Requires: bzip2-libs audit-libs +Requires: libselinux >= %{libselinux_version} + +%description +libsemanage is the policy management library. Using libsepol and +libselinux to interact with the SELinux system, it also calls helper +programs for loading policy and for checking whether the +file_contexts configuration is valid. + +%package devel +Summary: Header files and libraries used to build policy manipulation tools +Requires: %{name} = %{version}-%{release} ustr +Provides: libsemanage-static +Obsoletes: libsemanage-static + +%description devel +The libsemanage-devel package contains the libraries and header files +needed for developing applications that manipulate SELinux policies. + +%package -n python2-libsemanage +Summary: python2 bindings for libsemanage +Provides: %{name}-python = %{version}-%{release} +Obsoletes: %{name}-python < %{version}-%{release} +Requires: %{name} = %{version}-%{release} + +%description -n python2-libsemanage +The python3-libsemanage package contains the python bindings for developing +SELinux management applications. + +%package -n python3-libsemanage +Summary: python3 bindings for libsemanage +Requires: %{name} = %{version}-%{release} libselinux-python3 +Provides: %{name}-python3 = %{version}-%{release} +Obsoletes: %{name}-python3 < %{version}-%{release} + +%description -n python3-libsemanage +The python3-libsemanage package contains the python bindings for developing +SELinux management applications. + +%package_help + +%prep +%autosetup -n libsemanage-%{version} -p1 + +%build +export LDFLAGS="%{?__global_ldflags}" + +make clean +%make_build CFLAGS="%{optflags}" swigify +%make_build CFLAGS="%{optflags}" LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" all +%make_build %{__python2} LIBDIR="%{_libdir}" CFLAGS="-g %{optflags}" pywrap +%make_build %{__python3} LIBDIR="%{_libdir}" CFLAGS="-g %{optflags}" pywrap + +%install +mkdir -p %{buildroot}%{_libdir} +mkdir -p %{buildroot}%{_includedir} +mkdir -p %{buildroot}%{_sharedstatedir}/selinux +mkdir -p %{buildroot}%{_sharedstatedir}/selinux/tmp + +make DESTDIR="%{buildroot}" LIBDIR="%{_libdir}" SHLIBDIR="%{_libdir}" install +make PYTHON=%{__python2} DESTDIR="%{buildroot}" LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" install-pywrap +make PYTHON=%{__python3} DESTDIR="%{buildroot}" LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" install-pywrap + +cp %{SOURCE1} %{buildroot}/etc/selinux/semanage.conf +ln -sf %{_libdir}/libsemanage.so.1 %{buildroot}/%{_libdir}/libsemanage.so + +%ldconfig_scriptlets + +%files +%license COPYING +%dir %{_sysconfdir}/selinux +%config(noreplace) %{_sysconfdir}/selinux/semanage.conf +%{_libdir}/libsemanage.so.1 +%dir %{_libexecdir}/selinux +%dir %{_sharedstatedir}/selinux +%dir %{_sharedstatedir}/selinux/tmp + +%files devel +%{_libdir}/libsemanage.a +%{_libdir}/libsemanage.so +%{_libdir}/pkgconfig/libsemanage.pc +%dir %{_includedir}/semanage +%{_includedir}/semanage/*.h + +%files -n python2-libsemanage +%{python2_sitearch}/_semanage.so +%{python2_sitearch}/semanage.py* + +%files -n python3-libsemanage +%{python3_sitearch}/*.so +%{python3_sitearch}/semanage.py* +%{python3_sitearch}/__pycache__/semanage* +%{_libexecdir}/selinux/semanage_migrate_store + +%files help +%{_mandir}/man3/* +%{_mandir}/man5/* +%{_mandir}/ru/man5/* + + +%changelog +* Thu Sep 5 2019 openEuler Buildteam - 2.9-1 +- Package init diff --git a/semanage.conf b/semanage.conf new file mode 100644 index 0000000..9045021 --- /dev/null +++ b/semanage.conf @@ -0,0 +1,57 @@ +# Authors: Jason Tang +# +# Copyright (C) 2004-2005 Tresys Technology, LLC +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Specify how libsemanage will interact with a SELinux policy manager. +# The four options are: +# +# "source" - libsemanage manipulates a source SELinux policy +# "direct" - libsemanage will write directly to a module store. +# /foo/bar - Write by way of a policy management server, whose +# named socket is at /foo/bar. The path must begin +# with a '/'. +# foo.com:4242 - Establish a TCP connection to a remote policy +# management server at foo.com. If there is a colon +# then the remainder is interpreted as a port number; +# otherwise default to port 4242. +module-store = direct + +# When generating the final linked and expanded policy, by default +# semanage will set the policy version to POLICYDB_VERSION_MAX, as +# given in . Change this setting if a different +# version is necessary. +#policy-version = 19 + +# expand-check check neverallow rules when executing all semanage +# commands. There might be a penalty in execution time if this +# option is enabled. +expand-check=0 + +# usepasswd check tells semanage to scan all pass word records for home directories +# and setup the labeling correctly. If this is turned off, SELinux will label /home +# correctly only. You will need to use semanage fcontext command. +# For example, if you had home dirs in /althome directory you would have to execute +# semanage fcontext -a -e /home /althome +usepasswd=False +bzip-small=true +bzip-blocksize=5 +ignoredirs=/root + +[sefcontext_compile] +path = /usr/sbin/sefcontext_compile +args = -r $@ +[end]