Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

How RHEL image builder has improved security and function

March 2, 2023
Jacob Kozol Achilleas Koutsou, Gianluca Zuccarelli
Related topics:
ContainersLinuxSecurity
Related products:
Red Hat Enterprise Linux

Share:

    Starting with Red Hat Enterprise Linux 8.7 and 9.1, image builder offers an easy way to embed containers. RHEL image builder works at build time and allows for containerized applications or services to be baked in, making the resulting images near production-ready. Furthermore, the image builder team worked with the OpenSCAP team to deliver security-hardened images. The OpenSCAP project provides security guidelines and baselines for securing images. This integration uses existing OpenSCAP tooling to run security remediation during the image build process.

    How to embed the container

    Containers can now be embedded into images at build time. The source of the container can be specified in the blueprint with the following:

    [[containers]]
    source = "registry.access.redhat.com/ubi9:latest"
    name = “rhel-9”
    tls-verify = true

    This will download the container referred to by the source and add it to the image’s container registry. Of course you can use your own custom-built container image that provides the application or service you want to deploy.

    If the registry you are pulling from requires authentication, the credentials can be provided by configuring the worker to read them from a containers-auth file. Create a containers-auth.json file and add the following to /etc/osbuild-worker/osbuild-worker.toml:

    [containers]
    auth_file_path = "/etc/osbuild-worker/containers-auth.json"
    

    The containers-auth.json file can be conveniently generated with Podman using the following command:

    podman login --authfile=/etc/osbuild-worker/container-auth.json REGISTRY

    Refer to our guides for more information.

    Use OpenSCAP remediation at build time

    The reason for remediating the image during build time is to streamline the process by producing images that are security hardened and compliant out of the box.

    Once an image has been built, it is difficult to ensure that it is security compliant. For example, the volumes would need to be repartitioned to verify that certain mount points are mounted to separate partitions. But if we remediate during the image build, we will already know that the partitions meet the criteria for a security benchmark.

    How to use the oscap tool

    OpenSCAP remediations can be enabled with customization options in the image builder blueprint. To get started, add customizations to the blueprint. The oscap command-line tool can assist in generating the following customizations:

    [customizations.openscap]
    profile_id = "xccdf_org.ssgproject.content_profile_cis" 
    datastream = "/usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml"

    In the customization, the profile is the CIS security benchmark. The data stream is the file that contains all the security rules and the remediation instructions.

    Wrap up

    We explained how image builder has improved and demonstrated how to remediate a RHEL 8.7 image. Refer to our guides for supported distros and security profiles. Once the image has been created, you can boot it up. If desired, you can scan it again using the oscap tool to see the results or generate a report for profile compliance.

    Feel free to comment below if you have questions. We welcome your feedback.

    Related Posts

    • How to install Red Hat Ansible Automation Platform on RHEL 9

    • Working with Red Hat Enterprise Linux Universal Base Images (UBI)

    • DevNation Blog: End-to-end OpenSCAP for automated compliance

    • Making environment variables accessible in front-end containers

    Recent Posts

    • Cloud bursting with confidential containers on OpenShift

    • Reach native speed with MacOS llama.cpp container inference

    • A deep dive into Apache Kafka's KRaft protocol

    • Staying ahead of artificial intelligence threats

    • Strengthen privacy and security with encrypted DNS in RHEL

    What’s up next?

    Ready to level up your Linux knowledge? Our Intermediate Linux Cheat Sheet presents a collection of Linux commands and executables for developers and system administrators who want to move beyond the basics.

    Get the cheat sheet
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue