Skip to content

Commit

Permalink
OF-2353: Add log4j2.formatMsgNoLookups system property to startup scr…
Browse files Browse the repository at this point in the history
…ipts

As another mitigation for CVE-2021-4428, add the log4j2.formatMsgNoLookups system property to all Openfire start scripts that we provide.
  • Loading branch information
guusdk committed Dec 16, 2021
1 parent 9e3ade6 commit 04ef47c
Show file tree
Hide file tree
Showing 7 changed files with 795 additions and 794 deletions.
1 change: 1 addition & 0 deletions build/debian/openfire.init.d
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ test -x $JAVA || exit 1

DAEMON_OPTS="$DAEMON_OPTS -server -DopenfireHome=${DAEMON_DIR} \
-Dlog4j.configurationFile=${DAEMON_LIB}/log4j2.xml \
-Dlog4j2.formatMsgNoLookups=true \
-Dopenfire.lib.dir=${DAEMON_LIB} -classpath ${DAEMON_LIB}/startup.jar\
-jar ${DAEMON_LIB}/startup.jar"

Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/extra/openfire-launchd-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function shutdown()
date
echo "Starting Openfire"

/usr/bin/java -server -jar "$OPENFIRE_HOME/lib/startup.jar" -Dlog4j.configurationFile=$$OPENFIRE_HOME/lib/log4j2.xml -Dopenfire.lib.dir=/usr/local/openfire/lib&
/usr/bin/java -server -jar "$OPENFIRE_HOME/lib/startup.jar" -Dlog4j.configurationFile=$$OPENFIRE_HOME/lib/log4j2.xml -Dlog4j2.formatMsgNoLookups=true -Dopenfire.lib.dir=/usr/local/openfire/lib&

OPENFIRE_PID=`ps auxww | grep -v wrapper | awk '/openfire/ && !/awk/ {print $2}'`

Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/extra/redhat/openfire
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ else
LOCALCLASSPATH="${OPENFIRE_LIB}/startup.jar:${LOCALCLASSPATH}"
fi

JAVACMD="${JAVACMD} -Dlog4j.configurationFile=${OPENFIRE_LIB}/log4j2.xml"
JAVACMD="${JAVACMD} -Dlog4j.configurationFile=${OPENFIRE_LIB}/log4j2.xml -Dlog4j2.formatMsgNoLookups=true"

# Export any necessary variables
export JAVA_HOME JAVACMD
Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/openfire.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ goto end
:run
SET debug=
if "%1" == "-debug" SET debug=-Xdebug -Xint -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
start "Openfire" "%JAVA_HOME%\bin\java" %debug% -server -Djdk.tls.ephemeralDHKeySize=matched -Djsse.SSLEngine.acceptLargeFragments=true -DopenfireHome="%OPENFIRE_HOME%" -Dlog4j.configurationFile="%OPENFIRE_HOME%\lib\log4j2.xml" -Dopenfire.lib.dir="%OPENFIRE_HOME%\lib" -jar "%OPENFIRE_HOME%\lib\startup.jar"
start "Openfire" "%JAVA_HOME%\bin\java" %debug% -server -Djdk.tls.ephemeralDHKeySize=matched -Djsse.SSLEngine.acceptLargeFragments=true -DopenfireHome="%OPENFIRE_HOME%" -Dlog4j.configurationFile="%OPENFIRE_HOME%\lib\log4j2.xml" -Dlog4j2.formatMsgNoLookups=true -Dopenfire.lib.dir="%OPENFIRE_HOME%\lib" -jar "%OPENFIRE_HOME%\lib\startup.jar"
goto end

:end
Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/openfire.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ esac
done


JAVACMD="${JAVACMD} -Dlog4j.configurationFile=${OPENFIRE_LIB}/log4j2.xml -Djdk.tls.ephemeralDHKeySize=matched -Djsse.SSLEngine.acceptLargeFragments=true"
JAVACMD="${JAVACMD} -Dlog4j.configurationFile=${OPENFIRE_LIB}/log4j2.xml -Dlog4j2.formatMsgNoLookups=true -Djdk.tls.ephemeralDHKeySize=matched -Djsse.SSLEngine.acceptLargeFragments=true"

if [ -z "$LOCALCLASSPATH" ] ; then
LOCALCLASSPATH=$OPENFIRE_LIB/startup.jar
Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/openfirectl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ else
LOCALCLASSPATH="${OPENFIRE_LIB}/startup.jar:${LOCALCLASSPATH}"
fi

JAVACMD="${JAVACMD} -Dlog4j.configurationFile=${OPENFIRE_LIB}/log4j2.xml"
JAVACMD="${JAVACMD} -Dlog4j.configurationFile=${OPENFIRE_LIB}/log4j2.xml -Dlog4j2.formatMsgNoLookups=true"

# Export any necessary variables
export JAVA_HOME JAVACMD
Expand Down
1,578 changes: 789 additions & 789 deletions distribution/src/installer/openfire.install4j

Large diffs are not rendered by default.

0 comments on commit 04ef47c

Please sign in to comment.