Skip to content

Commit 01cea40

Browse files
coolacidjordansissel
authored andcommitted
Fix for chroot not getting supliemental groups
Fixes #1398
1 parent bd75161 commit 01cea40

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/logstash.sysv

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ start() {
5050
HOME=${LS_HOME}
5151
export PATH HOME LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
5252

53+
# chown doesn't grab the suplimental groups when setting the user:group - so we have to do it for it.
54+
# Boy, I hope we're root here.
55+
SGROUPS=$(grep "$LS_USER" /etc/group | grep -v "^$LS_GROUP" | cut -d: -f1 | tr "\\n" "," | sed 's/,$//'; echo '')
56+
5357
# set ulimit as (root, presumably) first, before we drop privileges
5458
ulimit -n ${LS_OPEN_FILES}
5559

5660
# Run the program!
57-
nice -n ${LS_NICE} chroot --userspec $LS_USER:$LS_GROUP / sh -c "
61+
nice -n ${LS_NICE} chroot --userspec $LS_USER:$LS_GROUP --groups $SGROUPS / sh -c "
5862
cd $LS_HOME
5963
ulimit -n ${LS_OPEN_FILES}
6064
exec \"$program\" $args

0 commit comments

Comments
 (0)