Technology1 min read

Chasing CVEs: Lessons from a real container build using Red Hat Hardened Images

By · Published by Everything Blog

In short

Engineering teams utilized Red Hat Hardened Images to construct a lightweight container for the Pi-hole ad-blocking system across its core components, web dashboard, and FTL DNS server. A multi-stage build effectively kept compilation tools and source repositories out of the final deployment footprint. However, staging RPM packages using an alternative installation root inadvertently caused DNF to reinstall existing dependencies such as glibc. This behavior disrupted the underlying RPM database, presenting complications for automated CVE scanners and SBOM generation.

Key points

  • Minimal runtime base images lack native package managers, requiring multi-stage builds to…: Minimal runtime base images lack native package managers, requiring multi-stage builds to import necessary dependencies.
  • Reinstalling baseline system packages during staging alters the RPM database and impairs…: Reinstalling baseline system packages during staging alters the RPM database and impairs the accuracy of CVE scanners.
  • Engineers are exploring Containerfile mount options to prevent filesystem bloat and prese…: Engineers are exploring Containerfile mount options to prevent filesystem bloat and preserve software bill of materials integrity.

Sources checked by our analysis pipeline: 1

After we launched Red Hat Hardened Images in May, I decided to migrate a containerized application I use at home to one of our images. I'd spent some time helping build the initial examples, and seen some issues with the distroless approach for a sample Python application, but I still needed to go deeper.

Knowing that minimization and distroless approaches shift how we need to build containerized applications, I decided to target the runtime environment with the smallest starting footprint. Our core-runtime is designed with dynamically linked applications in mind. No extra development tools, just libraries and a few other packages.

The goal: Take a containerized application I use somewhat regularly and rebuild it on a Red Hat Hardened Image. I have a functioning comparison point to know what done looks like.

The app: Pi-hole is a DNS sink I use to block access to sites on my home network. It also isn't a simple "run Ruby app on Ruby image" conversion, either. It's a mix of shell, compiled C, and JavaScript. There's some helper scripts in the project to…

Technology