You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mc...@apache.org on 2020/03/03 21:51:18 UTC

[cassandra] branch cassandra-2.2 updated: Fix Red Hat init script on newer systemd versions

This is an automated email from the ASF dual-hosted git repository.

mck pushed a commit to branch cassandra-2.2
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-2.2 by this push:
     new 9105dcd  Fix Red Hat init script on newer systemd versions
9105dcd is described below

commit 9105dcd99e61537e8d177b41b7d38c5569412230
Author: Mick Semb Wever <mc...@apache.org>
AuthorDate: Tue Mar 3 11:37:04 2020 +0100

    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
---
 CHANGES.txt      | 1 +
 redhat/cassandra | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 9ecfcb4..44b4abe 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -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
diff --git a/redhat/cassandra b/redhat/cassandra
index 677ff8c..97a0447 100644
--- a/redhat/cassandra
+++ b/redhat/cassandra
@@ -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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org