[bitnami/elasticsearch] crash when running as root when TLS certificates are read-only #77525
Labels
elasticsearch
tech-issues
The user has a technical issue about an application
triage
Triage is needed
Name and Version
bitnami/elasticsearch:8.17.2-debian-12-r0
What architecture are you using?
amd64
What steps will reproduce the bug?
Run the container as root with a read-only volume mounted to /opt/bitnami/elasticsearch/config/certs.
(This bug was originally reported as bitnami/charts#25280 against the bitnami/elasticsearch Helm chart, which at the time mounted a Kubernetes secret at this path containing the TLS certificate and key files for Elasticsearch)
What is the expected behavior?
Container should start up correctly.
What do you see instead?
Container fails to start, with the error in this section of
libelasticsearch.sh
:containers/bitnami/elasticsearch/8/debian-12/rootfs/opt/bitnami/scripts/libelasticsearch.sh
Lines 380 to 383 in 1e1e736
When running as root the container attempts to
chown
all files under$DB_CONF_DIR
(which is/opt/bitnami/elasticsearch/config
), but this is not possible when thecerts
subdirectory is a read-only filesystem.Additional information
A PR was accepted in the
charts
repository to "fix" the problem by copying the TLS certificates to a writeable volume instead of directly mounting the read-only one, but this has other undesirable effects where renewed certificates are no longer picked up and reloaded automatically. It would be better to back out that change to the chart and instead fix the problem at source in the container image.The simplest fix would be to add
-f
to thechown
command to ignore files whose ownership cannot be changed. An alternative could be to change the location of the certificate files so they do not fall under a directory that will bechown
-ed, but that may have further reaching knock-on effects on things like custom init scripts that assume the current file locations.The text was updated successfully, but these errors were encountered: