| Dockerfiles | ||
| LICENSE | ||
| README.md | ||
libmodsecurity-package-builder
This repository contains a simple, Docker-based build pipeline to compile and package the libmodsecurity (ModSecurity v3) library from source.
Project Intent
The purpose of this project is to create a reliable, repeatable, and isolated environment for building libmodsecurity into native packages (.deb, .rpm) for various Linux distributions.
Instead of compiling from source on every server, this pipeline generates a single, installable package artifact. This artifact can then be easily distributed, versioned, and used as a clean dependency for other projects (like the ModSecurity Nginx connector).
The core goal is to build once, deploy anywhere.
How It Works
This project uses multi-stage Dockerfiles to ensure a clean and minimal final output.
- Stage 1 (
builder): A full build environment is set up (e.g.,almalinux:9-minimal). It installs allbuild-essentialtools,-devellibraries, andrpm-build(ordpkg-dev). - Source & Compile: The stage clones the official ModSecurity git repository, checks out a specific version tag, and compiles it.
- Packaging: It then uses native packaging tools (
rpmbuildordpkg-deb) to create the final package file. - Stage 2 (
final): A minimalFROM scratchorFROM alpineimage is used. It copies only the completed.rpmor.debpackage from the builder stage. - Output: The final image's
CMDis set tocatthe package file to standard output.
How to Use
This pipeline is not meant to be run as a service. It is a "build-and-spit" tool.
1. Build the Builder Image
Build the Dockerfile for your target distribution (e.g., AlmaLinux 9).
# Example for AlmaLinux 9 RPM
docker build -t modsec-builder-al9 -f Dockerfile.almalinux9
2. Run the Container to Get the Package
Run the container and redirect its standard output to a local file. The container will run, cat the package, and immediately exit.
# The container's output *is* the package file
docker run --rm modsec-builder-al9 > libmodsecurity-cipherseed.rpm
You now have a clean, compiled libmodsecurity-cipherseed.rpm file on your host machine, ready for distribution or installation.
This pipeline is not meant to be run as a service. It is a "build-and-spit" tool.
This is so you have time to read through my work: Tales of Taeleera and my Library