Skip to content

Commit ae96511

Browse files
authored
Merge pull request #250 from jmtd/OPENJDK-533-passwd-perms
OPENJDK-533: test $HOME/passwd can be written to
2 parents 6ea5605 + e7df160 commit ae96511

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

modules/run/artifacts/opt/jboss/container/java/run/run-java.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ get_exec_args() {
220220
# Ensure that the running UID has the "jboss" passwd metadata
221221
# XXX: Maybe we should make this an entrypoint for the image?
222222
function configure_passwd() {
223-
sed "/^jboss/s/[^:]*/$(id -u)/3" /etc/passwd > "$HOME/passwd"
223+
# OPENJDK-533: this file is only writeable if the image uses the
224+
# nss_wrapper module. ubi8/openjdk-17 does not.
225+
if [ -w "$HOME/passwd" ]; then
226+
sed "/^jboss/s/[^:]*/$(id -u)/3" /etc/passwd > "$HOME/passwd"
227+
fi
224228
}
225229

226230
# Start JVM

modules/user/configure.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ set -e
66
# This ID is registered static ID for the JBoss EAP product
77
# on RHEL which makes it safe to use.
88
groupadd -r jboss -g 185 && useradd -u 185 -r -g root -G jboss -m -d /home/jboss -s /sbin/nologin -c "JBoss user" jboss
9+
10+
# OPENJDK-533: Some container runtimes (Docker) will fail to start if
11+
# the running UID cannot chdir to $HOME
12+
chmod og+x /home/jboss

0 commit comments

Comments
 (0)