Dockerfile container package builder for owasp libmodsecurity
Find a file
2025-10-24 23:12:33 -10:00
Dockerfiles Pushing all my work in progress dockerfiles 2025-10-24 23:12:33 -10:00
LICENSE Initial commit 2025-10-25 09:07:07 +00:00
README.md Update README.md 2025-10-25 09:11:22 +00:00

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.

  1. Stage 1 (builder): A full build environment is set up (e.g., almalinux:9-minimal). It installs all build-essential tools, -devel libraries, and rpm-build (or dpkg-dev).
  2. Source & Compile: The stage clones the official ModSecurity git repository, checks out a specific version tag, and compiles it.
  3. Packaging: It then uses native packaging tools (rpmbuild or dpkg-deb) to create the final package file.
  4. Stage 2 (final): A minimal FROM scratch or FROM alpine image is used. It copies only the completed .rpm or .deb package from the builder stage.
  5. Output: The final image's CMD is set to cat the 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