Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zimmerle/a2b069f0099c90c142e8 to your computer and use it in GitHub Desktop.
Save zimmerle/a2b069f0099c90c142e8 to your computer and use it in GitHub Desktop.
ModSecurity 2.x rpm package generation
From 0d90c84a7a89d26b9cffb4f987342185fe482118 Mon Sep 17 00:00:00 2001
From: Antony Hutchison <antony@hutchisontechnical.co.uk>
Date: Tue, 12 Jan 2016 22:43:35 +0000
Subject: [PATCH] Adds a spec file for building an RPM package
---
rpmbuild/mod_security.spec | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 rpmbuild/mod_security.spec
diff --git a/rpmbuild/mod_security.spec b/rpmbuild/mod_security.spec
new file mode 100644
index 0000000..9a64834
--- /dev/null
+++ b/rpmbuild/mod_security.spec
@@ -0,0 +1,45 @@
+Summary: ModSecurity module for Apache HTTP Server
+Name: mod_security
+Version: 2.9.0
+Release: 1%{?dist}
+License: ASL 2.0
+URL: http://www.modsecurity.org/
+Group: System Environment/Daemons
+Source: http://www.modsecurity.org/download/modsecurity-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Requires: httpd httpd-mmn = %([ -a %{_includedir}/httpd/.mmn ] && cat %{_includedir}/httpd/.mmn || echo missing)
+BuildRequires: httpd-devel libxml2-devel pcre-devel curl-devel lua-devel
+
+%description
+ModSecurity: Open Source Web Application Firewall
+
+%prep
+%setup -q -n modsecurity-%{version}
+
+%build
+find doc -type f -exec chmod -x {} \;
+./autogen.sh
+%configure
+make %{_smp_mflags}
+
+%install
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
+rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/%{name}
+
+%clean
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr (-,root,root)
+%doc CHANGES LICENSE README.* modsecurity* doc
+%{_libdir}/httpd/modules/mod_security2.so
+%{_bindir}/mlogc
+%{_bindir}/mlogc-batch-load.pl
+%{_bindir}/rules-updater.pl
+/usr/lib/mod_security2.so
+
+
+%changelog
+* Tue Jan 12 2016 Antony Hutchison <antony@hutchisontechnical.co.uk> - 2.9.0-1
+- initial build of RPM
Copy link

ghost commented Jun 21, 2017

heads up @zimmerle, this file has some odd characters which cause errors when trying to consume it from within docker:

awk '/[^\x00-\x7F]/{ print NR ":", $0 }' 0d90c84a7a89d26b9cffb4f987342185fe482118.patch 

source of awk command: https://stackoverflow.com/questions/30738924/detecting-corrupt-characters-in-utf-8-encoded-text-file#30764921
Did not get a chance to scrub it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment