From 1432f466c0e0dd0f5cc8d9b6bd29cedce572dd01 Mon Sep 17 00:00:00 2001 From: Hui Wang Date: Wed, 11 Oct 2023 14:47:07 +0800 Subject: [PATCH] Initial import (fedora#2239790) --- .gitignore | 1 + mod_proxy_cluster.conf.sample | 23 ++++++ mod_proxy_cluster.fc | 1 + mod_proxy_cluster.spec | 130 ++++++++++++++++++++++++++++++++++ mod_proxy_cluster.te | 12 ++++ sources | 1 + 6 files changed, 168 insertions(+) create mode 100644 .gitignore create mode 100644 mod_proxy_cluster.conf.sample create mode 100644 mod_proxy_cluster.fc create mode 100644 mod_proxy_cluster.spec create mode 100644 mod_proxy_cluster.te create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f65bfa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/mod_cluster-1.3.19.Final.tar.gz diff --git a/mod_proxy_cluster.conf.sample b/mod_proxy_cluster.conf.sample new file mode 100644 index 0000000..5fa37c2 --- /dev/null +++ b/mod_proxy_cluster.conf.sample @@ -0,0 +1,23 @@ +# mod_proxy_balancer should be disabled when mod_cluster is used +LoadModule proxy_cluster_module /usr/lib64/httpd/modules/mod_proxy_cluster.so +LoadModule cluster_slotmem_module /usr/lib64/httpd/modules/mod_cluster_slotmem.so +LoadModule manager_module /usr/lib64/httpd/modules/mod_manager.so +LoadModule advertise_module /usr/lib64/httpd/modules/mod_advertise.so + +MemManagerFile /var/cache/httpd/mod_proxy_cluster + + + Listen 6666 + + DirectoryIndex disabled + + Require ip 127.0.0.1 + + ServerAdvertise on + EnableMCPMReceive + + SetHandler mod_cluster-manager + Require ip 127.0.0.1 + + + diff --git a/mod_proxy_cluster.fc b/mod_proxy_cluster.fc new file mode 100644 index 0000000..a94035d --- /dev/null +++ b/mod_proxy_cluster.fc @@ -0,0 +1 @@ +/var/cache/httpd/mod_proxy_cluster(/.*)? gen_context(system_u:object_r:httpd_cache_t,s0) diff --git a/mod_proxy_cluster.spec b/mod_proxy_cluster.spec new file mode 100644 index 0000000..ee333c0 --- /dev/null +++ b/mod_proxy_cluster.spec @@ -0,0 +1,130 @@ +#no jars in this native build, so skip signing +%define _jarsign_opts --nocopy + +%global namedreltag .Final +%global namedversion %{version}%{?namedreltag} +%global selinuxtype targeted +%define aplibdir %{_libdir}/httpd/modules/ + +%define serial 1 + +Name: mod_proxy_cluster +Summary: JBoss mod_proxy_cluster for Apache httpd +Version: 1.3.19 +Release: %{serial}%{?dist} +License: LGPL-3.0-only +URL: https://github.com/modcluster/mod_cluster +Source0: https://github.com/modcluster/mod_cluster/archive/%{namedversion}/mod_cluster-%{namedversion}.tar.gz +Source1: %{name}.conf.sample +Source2: %{name}.te +Source3: %{name}.fc + +# 64 bit natives only +ExcludeArch: i686 i386 + +BuildRequires: httpd-devel +BuildRequires: apr-devel +BuildRequires: apr-util-devel +BuildRequires: autoconf +BuildRequires: gcc + +Requires: (%{name}-selinux if selinux-policy-%{selinuxtype}) + +Requires: httpd >= 0:2.4.6 +Requires: apr +Requires: apr-util + +# SELinux subpackage +%package selinux +Summary: mod_proxy_cluster SELinux policy +BuildArch: noarch +Requires: selinux-policy-%{selinuxtype} +Requires(post): selinux-policy-%{selinuxtype} +BuildRequires: selinux-policy-devel +%{?selinux_requires} + +%description selinux +mod_proxy_cluster SELinux policy module + +%description +JBoss mod_proxy_cluster for Apache httpd. + +%prep +%autosetup -n mod_cluster-%{namedversion} + +%build +pushd native +for i in advertise mod_manager mod_proxy_cluster mod_cluster_slotmem +do +pushd $i +set -e +sh buildconf +export CFLAGS='%{optflags} -fno-strict-aliasing -DMOD_CLUSTER_RELEASE_VERSION="-%{serial}"' +%configure --with-apxs=/usr/bin/apxs +%make_build +popd +done +popd + +# for SELinux +mkdir selinux +cp -p %{SOURCE2} selinux/ +cp -p %{SOURCE3} selinux/ + +make -f %{_datadir}/selinux/devel/Makefile %{name}.pp +bzip2 -9 %{name}.pp + +%install +install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version} +install -d -m 755 $RPM_BUILD_ROOT/%{aplibdir}/ +cp -p native/*/*.so ${RPM_BUILD_ROOT}/%{aplibdir}/ +install -d -m 755 $RPM_BUILD_ROOT/%{_localstatedir}/cache/httpd/mod_proxy_cluster + +install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/ +install -p -m 644 %{SOURCE1} \ + $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/mod_proxy_cluster.conf.sample + +install -D -m 0644 %{name}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2 + +%pre selinux +%selinux_relabel_pre -s %{selinuxtype} + +%post selinux +%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2 + +%postun selinux +if [ $1 -eq 0 ]; then + %selinux_modules_uninstall -s %{selinuxtype} %{name} +fi + +%posttrans selinux +%selinux_relabel_post -s %{selinuxtype} + +%post +# first install +if [ $1 -eq 1 ]; then + %{_sbindir}/semanage port -a -t http_port_t -p udp 23364 || true + %{_sbindir}/semanage port -a -t http_port_t -p tcp 6666 || true +fi + +%postun +# Delete port labeling when the package is removed +if [ $1 -eq 0 ]; then + %{_sbindir}/semanage port -d -t http_port_t -p udp 23364 || true + %{_sbindir}/semanage port -d -t http_port_t -p tcp 6666 || true +fi + +%files +%license lgpl.txt +%dir %{_localstatedir}/cache/httpd/mod_proxy_cluster +%attr(0755,root,root) %{aplibdir}/* +%{_sysconfdir}/httpd/conf.d/mod_proxy_cluster.conf.sample + +%files selinux +%{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.* +%ghost %verify(not md5 size mode mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{name} + + +%changelog +* Wed Sep 20 2023 Hui Wang - 1.3.19-1 +- First build diff --git a/mod_proxy_cluster.te b/mod_proxy_cluster.te new file mode 100644 index 0000000..fa48ab8 --- /dev/null +++ b/mod_proxy_cluster.te @@ -0,0 +1,12 @@ +policy_module(mod_proxy_cluster, 1.0) + +gen_tunable(httpd_mod_proxy_cluster, true) + +require { + type httpd_t; + type http_port_t; +} + +tunable_policy(`httpd_mod_proxy_cluster', ` +corenet_udp_bind_http_port(httpd_t) + ') diff --git a/sources b/sources new file mode 100644 index 0000000..eb41510 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (mod_cluster-1.3.19.Final.tar.gz) = aa1a9bea6ccc9191e40aa42f6fc291feed24ba7b57ca832a7796d5c7f214a8340bcd7d2c32321efe301cd1a55b9c95af8e9f77b2b1fffd8a25dfd18fa346719d