Assign access_bpf to GID less than 500

When installing ChmodBPF on macOS, assign the access_bpf group to the first
free GID greater than 100, rather to the default which starts at 500. Using
a GID less than 500 hides it in the System Preferences Users & Groups pane.

Bug: 6402
Change-Id: I62ed63bc64cb2721880467ffd0dc290ea57c8461
Reviewed-on: https://code.wireshark.org/review/37676
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Michael Schmitt 2020-07-02 16:04:03 -05:00 committed by Gerald Combs
parent 7e4ff6f826
commit 34ff98c860
1 changed files with 6 additions and 2 deletions

View File

@ -17,9 +17,13 @@ chmod -R a+rX,go-w "/Library/Application Support/Wireshark"
CHMOD_BPF_PLIST="/Library/LaunchDaemons/org.wireshark.ChmodBPF.plist"
BPF_GROUP="access_bpf"
BPF_GROUP_NAME="BPF device access ACL"
min_gid=100
if ! dscl . -read /Groups/"$BPF_GROUP" > /dev/null 2>&1; then
free_gid=$(dscl . -list /Groups PrimaryGroupID | sort -bnk2 | awk -v min_gid=$min_gid 'BEGIN{i=min_gid}{if($2==i)i++}END{print i}')
dseditgroup -q -o create -i $free_gid -r "$BPF_GROUP_NAME" "$BPF_GROUP"
fi
dscl . -read /Groups/"$BPF_GROUP" > /dev/null 2>&1 || \
dseditgroup -q -o create "$BPF_GROUP"
dseditgroup -q -o edit -a "$USER" -t user "$BPF_GROUP"
cp "/Library/Application Support/Wireshark/ChmodBPF/org.wireshark.ChmodBPF.plist" \