Skip to content

Commit c0cf531

Browse files
coolacidjordansissel
authored andcommitted
Take into account if there are not extra groups
Fixes #1398
1 parent c4c4c34 commit c0cf531

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/logstash.sysv

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,16 @@ start() {
5454
# Boy, I hope we're root here.
5555
SGROUPS=$(grep "$LS_USER" /etc/group | grep -v "^$LS_GROUP" | cut -d: -f1 | tr "\\n" "," | sed 's/,$//'; echo '')
5656

57+
if [ ! -z $SGROUPS ]
58+
then
59+
EXTRA_GROUPS="--groups $SGROUPS"
60+
fi
61+
5762
# set ulimit as (root, presumably) first, before we drop privileges
5863
ulimit -n ${LS_OPEN_FILES}
5964

6065
# Run the program!
61-
nice -n ${LS_NICE} chroot --userspec $LS_USER:$LS_GROUP --groups $SGROUPS / sh -c "
66+
nice -n ${LS_NICE} chroot --userspec $LS_USER:$LS_GROUP $EXTRA_GROUPS / sh -c "
6267
cd $LS_HOME
6368
ulimit -n ${LS_OPEN_FILES}
6469
exec \"$program\" $args

0 commit comments

Comments
 (0)