- Fix the install part since extra and experimental rules are not longer

included in 3.x
- Remove EL5 bits since EL5/EPEL5 are OEL-ed
- Bump reqs
This commit is contained in:
Athmane Madjoudj 2017-04-22 14:35:44 +01:00
parent 887ce1a4ea
commit 544ea44c25

View File

@ -1,82 +1,55 @@
%global with_extras 0%{?fedora} || 0%{?rhel} <= 6
Summary: ModSecurity Rules Summary: ModSecurity Rules
Name: mod_security_crs Name: mod_security_crs
Version: 3.0.0 Version: 3.0.0
Release: 1%{?dist} Release: 2%{?dist}
License: ASL 2.0 License: ASL 2.0
URL: https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project URL: https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project
Group: System Environment/Daemons Group: System Environment/Daemons
Source: https://github.com/SpiderLabs/owasp-modsecurity-crs/archive/v%{version}/owasp-modsecurity-crs-%{version}.tar.gz Source: https://github.com/SpiderLabs/owasp-modsecurity-crs/archive/v%{version}/owasp-modsecurity-crs-%{version}.tar.gz
BuildArch: noarch BuildArch: noarch
Requires: mod_security >= 2.7.0 Requires: mod_security >= 2.8.0
Obsoletes: mod_security_crs-extras
%description %description
This package provides the base rules for mod_security. This package provides the base rules for mod_security.
%if %with_extras
%package extras
Summary: Supplementary mod_security rules
Group: System Environment/Daemons
Requires: %name = %version-%release
%description extras
This package provides supplementary rules for mod_security.
%endif
%prep %prep
%autosetup -q -n %setup -q -n owasp-modsecurity-crs-%{version}
%build %build
%install %install
rm -rf %{buildroot}
install -d %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/ install -d %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/
install -d %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/activated_rules install -d %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/activated_rules
install -d %{buildroot}%{_prefix}/lib/modsecurity.d/base_rules install -d %{buildroot}%{_prefix}/lib/modsecurity.d/base_rules
%if %with_extras # To exclude rules (pre/post)
install -d %{buildroot}%{_prefix}/lib/modsecurity.d/optional_rules mv rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf
install -d %{buildroot}%{_prefix}/lib/modsecurity.d/experimental_rules mv rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf.example rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf
install -d %{buildroot}%{_prefix}/lib/modsecurity.d/slr_rules
%endif
install -m0644 modsecurity_crs_10_setup.conf.example %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/modsecurity_crs_10_config.conf install -m0644 rules/* %{buildroot}%{_prefix}/lib/modsecurity.d/base_rules/
install -m0644 base_rules/* %{buildroot}%{_prefix}/lib/modsecurity.d/base_rules/ mv crs-setup.conf.example %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/crs-setup.conf
%if %with_extras
install -m0644 optional_rules/* %{buildroot}%{_prefix}/lib/modsecurity.d/optional_rules/
install -m0644 experimental_rules/* %{buildroot}%{_prefix}/lib/modsecurity.d/experimental_rules/
install -m0644 slr_rules/* %{buildroot}%{_prefix}/lib/modsecurity.d/slr_rules
%endif
# activate base_rules # activate base_rules
for f in `ls %{buildroot}/%{_prefix}/lib/modsecurity.d/base_rules/` ; do for f in `ls %{buildroot}/%{_prefix}/lib/modsecurity.d/base_rules/` ; do
ln -s %{_prefix}/lib/modsecurity.d/base_rules/$f %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/activated_rules/$f; ln -s %{_prefix}/lib/modsecurity.d/base_rules/$f %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/activated_rules/$f;
done done
%clean
rm -rf %{buildroot}
%files %files
%doc CHANGES INSTALL LICENSE README.md %license LICENSE
%doc CHANGES README.md
%config(noreplace) %{_sysconfdir}/httpd/modsecurity.d/activated_rules/* %config(noreplace) %{_sysconfdir}/httpd/modsecurity.d/activated_rules/*
%config(noreplace) %{_sysconfdir}/httpd/modsecurity.d/modsecurity_crs_10_config.conf %config(noreplace) %{_sysconfdir}/httpd/modsecurity.d/crs-setup.conf
%{_prefix}/lib/modsecurity.d/base_rules %{_prefix}/lib/modsecurity.d/base_rules
%if %with_extras
%files extras
%{_prefix}/lib/modsecurity.d/optional_rules
%{_prefix}/lib/modsecurity.d/experimental_rules
%{_prefix}/lib/modsecurity.d/slr_rules
%endif
%changelog %changelog
* Sat Apr 22 2017 Athmane Madjoudj <athmane@fedoraproject.org> - 3.0.0-2
- Fix the install part since extra and experimental rules are not longer included in 3.x
- Remove EL5 bits since EL5/EPEL5 are OEL-ed
- Bump reqs
* Sat Apr 22 2017 Athmane Madjoudj <athmane@fedoraproject.org> - 3.0.0-1 * Sat Apr 22 2017 Athmane Madjoudj <athmane@fedoraproject.org> - 3.0.0-1
- Update to 3.0.0 - Update to 3.0.0
- Clean up the spec - Clean up the spec