-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jetty.sh doesn't work with JETTY_USER in Jetty 10.0.17 thru Jetty 12.0.2 #10696
Comments
Example module file with options that are not compatible with
|
The problem comes from the combination of ...
On Jetty 10.0.17 / 11.0.17 / 12.0.2 the I'm wondering why we are even using Do we need Looking at the history of
|
I'm moving the |
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
Opened PR #10700 |
…t, or process will switch to JETTY_USER Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
So I'm walking through this from first principles.
The dry run produces the correctly quoted:
I have run this with |
@gregw the docker images are working, but they do not use |
Great. I asked because they do use --dry-run, so it is a good test that quoting is correct there. |
I simplified my module a bit for less verbose testing and also used full paths:
with this, I was able to cut/paste the dry-run output to start-stop-daemon and it worked fine:
But the problem comes when trying to use the dry-run via a shell mechanism. All the following failed:
However the following does appear to work:
@lachlan-roberts can you comment on usage of xargs in docker? was that finally accepted or is something else done? |
@gregw I don't think we use xargs anywhere for the docker images. We use an |
@lachlan-roberts thanks. That technique also works with start-stop-daemon:
|
@joakime Can you use either the xargs technique or the file technique above to call the start-stop-daemon in a way that better handles quotes and escapes? |
@joakime note that you can mix in extra args do something like:
|
Note, that while the initial PR is for We got a mysterious error along the lines of Not sure yet if the version of Jetty makes a difference here. I'll try to replicate (reliably) the fault on Jetty 12.0.2 so we can look deeper into it. |
I was able to replicate the origin of the "D" issue ...
Turns out it's a message from Turns out it's a subtle bug in 12.0.2 The bug is on line 564 |
@joakime I've found and "fixed" another pathological test case (that we should include). I created a base dir like:
modules/test.mod is
etc/jetty.conf is
The xml files are both just: <?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
</Configure> This died in numerous ways. The "fix" I have is diff --git a/jetty-home/src/main/resources/bin/jetty.sh b/jetty-home/src/main/resources/bin/jetty.sh
index 9fd13d0281..c6882a543d 100755
--- a/jetty-home/src/main/resources/bin/jetty.sh
+++ b/jetty-home/src/main/resources/bin/jetty.sh
@@ -471,14 +471,14 @@ then
do
if [ -r "$XMLFILE" ] && [ -f "$XMLFILE" ]
then
- JETTY_ARGS=(${JETTY_ARGS[*]} "$XMLFILE")
+ JETTY_ARGS=(${JETTY_ARGS[*]} "'$XMLFILE'")
else
echo "** WARNING: Cannot read '$XMLFILE' specified in '$JETTY_CONF'"
fi
done
else
# assume it's a command line parameter (let start.jar deal with its validity)
- JETTY_ARGS=(${JETTY_ARGS[*]} "$CONF")
+ JETTY_ARGS=(${JETTY_ARGS[*]} "'$CONF'")
fi
done < "$JETTY_CONF"
fi
@@ -566,7 +566,7 @@ then
fi
# Collect the dry-run (of opts,path,main,args) from the jetty.base configuration
-JETTY_DRY_RUN=$("$JAVA" -jar "$JETTY_START" --dry-run=opts,path,main,args ${JETTY_ARGS[*]} ${JAVA_OPTIONS[*]})
+JETTY_DRY_RUN=$({ echo -jar "$JETTY_START" --dry-run=opts,path,main,args ; echo ${JETTY_ARGS[*]} ${JAVA_OPTIONS[*]} ; } | xargs "$JAVA" )
RUN_ARGS=($JETTY_SYS_PROPS ${JETTY_DRY_RUN[@]})
if (( DEBUG )) Specifically I am adding single quotes around what I know are single arguments. |
Signed-off-by: Joakim Erdfelt <[email protected]>
* Issue #10696 - Addressing start-stop-daemon behaviors in jetty.sh * disable internal pid-file management of start-stop-daemon * IssueDo not test for file system permissions if user is root, or process will switch to JETTY_USER * Fixing bad UID / JETTY_USER condition * Avoid FS test with setuid use as well * Fixing stop behavior * Adding jetty.sh docker testing --------- Signed-off-by: Joakim Erdfelt <[email protected]> Signed-off-by: Olivier Lamy <[email protected]> Co-authored-by: Olivier Lamy <[email protected]>
Merged from 'jetty-10.0.x' to 'jetty-12.0.x' |
Jetty version(s)
10.0.17, 11.0.17, 12.0.2
Jetty Environment
All
Java version/vendor
(use: java -version)
All
OS type/version
Linux
Description
The
jetty.sh
is misbehaving when it comes to use of the JETTY_USER to switch users.Some issues discovered:
touch pid
behavior creating an empty pid on the root uid)The text was updated successfully, but these errors were encountered: