Skip to content

httpd-prepare: config_general() Listen port substitution is not idempotent #289

@taylor-benson

Description

@taylor-benson

Container platform

OCP 4

Version

No response

OS version of the container image

RHEL 9

Bugzilla, Jira

No response

Description

httpd-prepare: config_general() Listen port substitution is not idempotent. produces Listen 808080 on repeated runs.

Was introduced with c5c9b6c, @notroj

Currently we have our base apache image starting from the base httpd-24 images in redhat catalog. We then bake in a conf in config.d that disables certain ciphers and other standards we want to enforce in all of our apache images. After we drop the new config, I have to run /use/libexec/httpd-prepare or during get start up, I get permission errors.

My local fix is to just run sed -i -e 's/^Listen 808080$/Listen 8080/' ${HTTPD_MAIN_CONF_PATH}/httpd.conf after I run httpd-prepare, but this can be avoided if on https://github.com/sclorg/httpd-container/blob/c5c9b6c9c8c1827eaf80ab233197af484f61f44d/2.4/root/usr/share/container-scripts/httpd/common.sh#L67C3-L67C75, used an end of line anchor sed -i -e 's/^Listen 80$/Listen 8080/' ${HTTPD_MAIN_CONF_PATH}/httpd.conf

Reproducer

Sample container file, have shared config in httpd-cfg

FROM --platform=linux/amd64 registry.redhat.io/ubi9/httpd-24@sha256:73094fec7fcdae7579d23d583b7535158041d6813bf903087e7c5e312b22361c
USER root
COPY httpd-cfg/ /etc/httpd/
RUN /usr/libexec/httpd-prepare && rpm-file-permissions
USER 1001

After first run, Listen port will be 808080

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions