mirror of https://github.com/apache/lucene.git
SOLR-9547: Do not allow bin/solr start as root user (unless -force param specified)
This commit is contained in:
parent
c1553c20f0
commit
6b28af0c7d
|
@ -198,6 +198,8 @@ Other Changes
|
||||||
|
|
||||||
* SOLR-9548: The beginning of solr.log now starts with a more informative welcome message (janhoy)
|
* SOLR-9548: The beginning of solr.log now starts with a more informative welcome message (janhoy)
|
||||||
|
|
||||||
|
* SOLR-9547: Do not allow bin/solr start as root user, unless -force param specified (janhoy)
|
||||||
|
|
||||||
================== 6.2.1 ==================
|
================== 6.2.1 ==================
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
|
|
|
@ -1049,6 +1049,7 @@ fi
|
||||||
|
|
||||||
# Run in foreground (default is to run in the background)
|
# Run in foreground (default is to run in the background)
|
||||||
FG="false"
|
FG="false"
|
||||||
|
FORCE=false
|
||||||
noprompt=false
|
noprompt=false
|
||||||
SOLR_OPTS=($SOLR_OPTS)
|
SOLR_OPTS=($SOLR_OPTS)
|
||||||
PASS_TO_RUN_EXAMPLE=
|
PASS_TO_RUN_EXAMPLE=
|
||||||
|
@ -1174,6 +1175,10 @@ if [ $# -gt 0 ]; then
|
||||||
stop_all=true
|
stop_all=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-force)
|
||||||
|
FORCE=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
@ -1298,6 +1303,14 @@ if [ -z "$STOP_PORT" ]; then
|
||||||
STOP_PORT=`expr $SOLR_PORT - 1000`
|
STOP_PORT=`expr $SOLR_PORT - 1000`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$SCRIPT_CMD" == "start" ] || [ "$SCRIPT_CMD" == "restart" ] ; then
|
||||||
|
if [[ "$(whoami)" == "root" ]] && [[ "$FORCE" == "false" ]] ; then
|
||||||
|
echo "WARNING: Starting Solr as the root user is a security risk and not considered best practice. Exiting."
|
||||||
|
echo " Please consult the Reference Guide. To override this check, start with argument '-force'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$SCRIPT_CMD" == "start" ]]; then
|
if [[ "$SCRIPT_CMD" == "start" ]]; then
|
||||||
# see if Solr is already running
|
# see if Solr is already running
|
||||||
SOLR_PID=`solr_pid_by_port "$SOLR_PORT"`
|
SOLR_PID=`solr_pid_by_port "$SOLR_PORT"`
|
||||||
|
|
Loading…
Reference in New Issue