Fix Red Hat init script on newer systemd versions

The fix for systemd CVE-2018-16888 required changes to init scripts, so
that PID files end up owned by the "root" user.

 patch by Mike Kelly; reviewed by Mick Semb Wever for CASSANDRA-15273
This commit is contained in:
Mick Semb Wever 2020-03-03 11:37:04 +01:00
parent b2b1b46486
commit 9105dcd99e
No known key found for this signature in database
GPG Key ID: E91335D77E3E87CB
2 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,5 @@
2.2.17
* Fix Red Hat init script on newer systemd versions (CASSANDRA-15273)
* Allow EXTRA_CLASSPATH to work on tar/source installations (CASSANDRA-15567)
2.2.16

View File

@ -69,15 +69,16 @@ case "$1" in
echo -n "Starting Cassandra: "
[ -d `dirname "$pid_file"` ] || \
install -m 755 -o $CASSANDRA_OWNR -g $CASSANDRA_OWNR -d `dirname $pid_file`
su $CASSANDRA_OWNR -c "$CASSANDRA_PROG -p $pid_file" > $log_file 2>&1
runuser -u $CASSANDRA_OWNR -- $CASSANDRA_PROG -p $pid_file > $log_file 2>&1
retval=$?
chown root.root $pid_file
[ $retval -eq 0 ] && touch $lock_file
echo "OK"
;;
stop)
# Cassandra shutdown
echo -n "Shutdown Cassandra: "
su $CASSANDRA_OWNR -c "kill `cat $pid_file`"
runuser -u $CASSANDRA_OWNR -- kill `cat $pid_file`
retval=$?
[ $retval -eq 0 ] && rm -f $lock_file
for t in `seq 40`; do