<pre style='margin:0'>
Chris Jones (cjones051073) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/b6b7539aa201671414866cb47ac468106dce0127">https://github.com/macports/macports-ports/commit/b6b7539aa201671414866cb47ac468106dce0127</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new b6b7539 wireshark-chmodbpf: new port
</span>b6b7539 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit b6b7539aa201671414866cb47ac468106dce0127
</span>Author: Davide Gerhard <rainbow@irh.it>
AuthorDate: Tue Apr 23 13:25:44 2019 +0200
<span style='display:block; white-space:pre;color:#404040;'> wireshark-chmodbpf: new port
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Enable Wireshark to acces macOS capture devices
</span>---
net/wireshark-chmodbpf/Portfile | 54 ++++++++++++++++++++++
.../files/patch-wireshark-chmodbpf.diff | 46 ++++++++++++++++++
2 files changed, 100 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/net/wireshark-chmodbpf/Portfile b/net/wireshark-chmodbpf/Portfile
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..f2d357e
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/net/wireshark-chmodbpf/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,54 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortSystem 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+name wireshark-chmodbpf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+version 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+platforms darwin macosx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+categories net
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+license {GPL-2 GPL-3}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+maintainers {@ra1nb0w irh.it:rainbow} {darkart.com:opendarwin.org @ghosthound} openmaintainer
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+description Enable Wireshark to acces macOS capture devices.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+long_description An access_bpf group will be created and its members \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ allowed access to BPF devices at boot to allow unprivileged packet \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ captures. It is meant to support Wireshark where unprivileged access \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ to macOS packet capture devices is desired.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+homepage https://www.wireshark.org
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+distfiles
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# name of the group used on /dev/bpf*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set bpf_group access_bpf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+patchfiles-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patch-wireshark-chmodbpf.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use_configure no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+build {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+supported_archs noarch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+pre-destroot {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # create the group to access capture devices
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ addgroup ${bpf_group}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+destroot {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace s|@BPF_GROUP@|${bpf_group}|g ${worksrcpath}/sbin/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -o root -g wheel ${worksrcpath}/sbin/${name} ${destroot}${prefix}/sbin/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# create startup that run ${name} script
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.create yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.name wireshark.ChmodBPF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.autostart yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.executable ${prefix}/sbin/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.pidfile none
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+notes "
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ To fully complete your installation and use Wireshare
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ with capture devices, like network interfaces, please run:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo dseditgroup -q -o edit -a \[USER\] -t user ${bpf_group}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ and change \[USER\] with the user that need access
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ to the hardware. Then reboot.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/net/wireshark-chmodbpf/files/patch-wireshark-chmodbpf.diff b/net/wireshark-chmodbpf/files/patch-wireshark-chmodbpf.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..9e6b962
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/net/wireshark-chmodbpf/files/patch-wireshark-chmodbpf.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,46 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/wireshark-chmodbpf b/wireshark-chmodbpf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+new file mode 100755
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 0000000..8564790
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ sbin/wireshark-chmodbpf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -0,0 +1,40 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#!/bin/bash
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# Unfortunately, macOS's devfs is based on the old FreeBSD
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# one, not the current one, so there's no way to configure it
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# to create BPF devices with particular owners or groups. BPF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# devices on macOS are also non-cloning, that is they can
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# be created on demand at any time. This startup item will
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# pre-create a number of BPF devices, then make them owned by
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# the access_bpf group, with permissions rw-rw----, so that
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# anybody in the access_bpf group can use programs that capture
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# or send raw packets.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# Change this as appropriate for your site, e.g. to make
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# it owned by a particular user without changing the permissions,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# so only that user and the super-user can capture or send raw
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# packets, or give it the permissions rw-r-----, so that
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# only the super-user can send raw packets but anybody in the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# admin group can capture packets.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# Pre-create BPF devices. Set to 0 to disable.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++FORCE_CREATE_BPF_MAX=10
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++SYSCTL_MAX=$( sysctl -n debug.bpf_maxdevices )
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++if [ "$FORCE_CREATE_BPF_MAX" -gt "$SYSCTL_MAX" ] ; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ FORCE_CREATE_BPF_MAX=$SYSCTL_MAX
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++syslog -s -l notice "ChmodBPF: Forcing creation and setting permissions for /dev/bpf*"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++CUR_DEV=0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++while [ "$CUR_DEV" -lt "$FORCE_CREATE_BPF_MAX" ] ; do
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ # Try to do the minimum necessary to trigger the next device.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ read -n 0 < /dev/bpf$CUR_DEV > /dev/null 2>&1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ CUR_DEV=$(( $CUR_DEV + 1 ))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++done
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++chgrp @BPF_GROUP@ /dev/bpf*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++chmod g+rw /dev/bpf*
</span></pre><pre style='margin:0'>
</pre>