Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-16457 Add symbolic link version of solr.install.dir to security.policy (#1346)

Jan Høydahl47b7f6c75a43
diff --git a/solr/bin/solr b/solr/bin/solr
index e29247c18a1..28880369446 100644
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -87,6 +87,8 @@ done
CDPATH='' # Prevent "file or directory not found" for 'cdpath' users
SOLR_TIP=$(dirname "$SOLR_SCRIPT")/..
# shellcheck disable=SC2164
+SOLR_TIP_SYM=$(cd "$SOLR_TIP"; pwd -L)
+# shellcheck disable=SC2164
SOLR_TIP=$(cd "$SOLR_TIP"; pwd -P)
DEFAULT_SERVER_DIR="$SOLR_TIP/server"
@@ -110,7 +112,7 @@ elif [ -r "$SOLR_INCLUDE" ]; then
. "$SOLR_INCLUDE"
fi
-# if pid dir is unset, deafult to $solr_tip/bin
+# if pid dir is unset, default to $solr_tip/bin
: "${SOLR_PID_DIR:=$SOLR_TIP/bin}"
if [ -n "${SOLR_JAVA_HOME:-}" ]; then
@@ -2281,7 +2283,7 @@ function start_solr() {
# '+CrashOnOutOfMemoryError' ensures that Solr crashes whenever
# OOME is thrown. Program operation after OOME is unpredictable.
"-XX:+CrashOnOutOfMemoryError" "-XX:ErrorFile=${SOLR_LOGS_DIR}/jvm_crash_%p.log" \
- "-Djetty.home=$SOLR_SERVER_DIR" "-Dsolr.solr.home=$SOLR_HOME" "-Dsolr.install.dir=$SOLR_TIP" \
+ "-Djetty.home=$SOLR_SERVER_DIR" "-Dsolr.solr.home=$SOLR_HOME" "-Dsolr.install.dir=$SOLR_TIP" "-Dsolr.install.symDir=$SOLR_TIP_SYM" \
"-Dsolr.default.confdir=$DEFAULT_CONFDIR" "${LOG4J_CONFIG[@]}" "${SOLR_OPTS[@]}" "${SECURITY_MANAGER_OPTS[@]}" "${SOLR_ADMIN_UI}")
mk_writable_dir "$SOLR_LOGS_DIR" "Logs"
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index 88bda913461..8ed5c2aa216 100755
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -1396,7 +1396,7 @@ IF "%FG%"=="1" (
echo %SOLR_PORT%>"%SOLR_TIP%"\bin\solr-%SOLR_PORT%.port
"%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS% ^
-Dlog4j.configurationFile="%LOG4J_CONFIG%" -DSTOP.PORT=!STOP_PORT! -DSTOP.KEY=%STOP_KEY% ^
- -Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" -Dsolr.default.confdir="%DEFAULT_CONFDIR%" ^
+ -Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" -Dsolr.install.symDir="%SOLR_TIP%" -Dsolr.default.confdir="%DEFAULT_CONFDIR%" ^
-Djetty.port=%SOLR_PORT% -Djetty.home="%SOLR_SERVER_DIR%" ^
-Djava.io.tmpdir="%SOLR_SERVER_DIR%\tmp" -jar start.jar %SOLR_JETTY_CONFIG% "%SOLR_JETTY_ADDL_CONFIG%"
) ELSE (
@@ -1404,7 +1404,7 @@ IF "%FG%"=="1" (
"%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS% ^
-Dlog4j.configurationFile="%LOG4J_CONFIG%" -DSTOP.PORT=!STOP_PORT! -DSTOP.KEY=%STOP_KEY% ^
-Dsolr.log.muteconsole ^
- -Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" -Dsolr.default.confdir="%DEFAULT_CONFDIR%" ^
+ -Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" -Dsolr.install.symDir="%SOLR_TIP%" -Dsolr.default.confdir="%DEFAULT_CONFDIR%" ^
-Djetty.port=%SOLR_PORT% -Djetty.home="%SOLR_SERVER_DIR%" ^
-Djava.io.tmpdir="%SOLR_SERVER_DIR%\tmp" -jar start.jar %SOLR_JETTY_CONFIG% "%SOLR_JETTY_ADDL_CONFIG%" > "!SOLR_LOGS_DIR!\solr-%SOLR_PORT%-console.log"
echo %SOLR_PORT%>"%SOLR_TIP%"\bin\solr-%SOLR_PORT%.port
@@ -1423,6 +1423,7 @@ REM Run the requested example
"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^
-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^
+ -Dsolr.install.symDir="%SOLR_TIP%" ^
-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
org.apache.solr.util.SolrCLI run_example -script "%SDIR%\solr.cmd" -e %EXAMPLE% -d "%SOLR_SERVER_DIR%" ^
-urlScheme !SOLR_URL_SCHEME! !PASS_TO_RUN_EXAMPLE!
diff --git a/solr/server/etc/security.policy b/solr/server/etc/security.policy
index 8681d1e3663..640f82f4e13 100644
--- a/solr/server/etc/security.policy
+++ b/solr/server/etc/security.policy
@@ -193,6 +193,8 @@ grant {
permission java.io.FilePermission "${solr.install.dir}", "read,write,delete,readlink";
permission java.io.FilePermission "${solr.install.dir}${/}-", "read,write,delete,readlink";
+ permission java.io.FilePermission "${solr.install.symDir}", "read,write,delete,readlink";
+ permission java.io.FilePermission "${solr.install.symDir}${/}-", "read,write,delete,readlink";
permission java.io.FilePermission "${jetty.home}", "read,write,delete,readlink";
permission java.io.FilePermission "${jetty.home}${/}-", "read,write,delete,readlink";