nrf_sniffer fails for non-superuser on raspbian

I'm developing a BTLE sniffer app to run on a headless raspberry pi 4 with html/php/js access. The application runs well on the development platform - Ubuntu 22.04.

On the raspberry pi, logged in as the user that installed everything:

  tshark -D

shows /dev/ttyACM0-4.0 (nRF Sniffer for Bluetooth LE)

  wireshark -Hkw <file-name> -i "nRF Sniffer for Bluetooth LE" -platform offscreen

works fine.

Via appache2/php (user www-data) it doesn't work. tshark doesn't see the sniffer.

Logged in as user www-data (sudo -s -u www-data), tshark -D does *not* show the sniffer.

In experimenting with permissions, I set all the nrf_sniffer files to execute, and this started happening with tshark -D:

/usr/lib/aarch64-linux-gnu/wireshark/extcap/nrf_sniffer_ble.bat: 1: @echo: Permission denied
: Permission deniednux-gnu/wireshark/extcap/nrf_sniffer_ble.bat: 2:
/usr/lib/aarch64-linux-gnu/wireshark/extcap/nrf_sniffer_ble.bat: 3: rem: Permission denied
/usr/lib/aarch64-linux-gnu/wireshark/extcap/nrf_sniffer_ble.bat: 18: Syntax error: Unterminated quoted string
/usr/lib/aarch64-linux-gnu/wireshark/extcap/nrf_sniffer_ble.bat: 1: @echo: Permission denied
: Permission deniednux-gnu/wireshark/extcap/nrf_sniffer_ble.bat: 2:
/usr/lib/aarch64-linux-gnu/wireshark/extcap/nrf_sniffer_ble.bat: 3: rem: Permission denied
/usr/lib/aarch64-linux-gnu/wireshark/extcap/nrf_sniffer_ble.bat: 18: Syntax error: Unterminated quoted string

Meaning, of course, tshark is trying to run the bat file on a linux system. It still works anyway, and removing execute from the bat file makes it go away.

So how do I get the extcap sniffer to work for user www-data?

Operating System: Debian GNU/Linux 12 (bookworm)  
          Kernel: Linux 6.6.28+rpt-rpi-v8
    Architecture: arm64

Wireshark 4.0.11 (Git v4.0.11 packaged as 4.0.11-1~deb12u1).

TShark (Wireshark) 4.0.11 (Git v4.0.11 packaged as 4.0.11-1~deb12u1).

nrf_sniffer_for_bluetooth_le_4.1.1.zip

Thanks!

  • Hello,

    nRF Sniffer is currently only supported by wireshark, and not tshark.

    Best regards,

    Michal

  • The same results apply using wireshark -D. tshark works fine with nRF Sniffer on Ubuntu, btw. The problem has nothing to do with using tshark versus wireshark.

  • The problem was two-fold. The big issue was that there's a file, /tmp/logs/log.txt, that was created by the main user on running nRF Sniffer from the command line. The www-data user did not have access to it, so the sniffer failed. Once that was solved, I was able to see that the sniffer did not have permission to use /dev/ttyACM0. /dev/ttyACM0 was owned by root:dialout and had group rw. Putting www-data in the dialout group didn't help, but adding rw permission to all users did.

    To summarize:
    1. Default permission for /tmp/logs/log.txt on linux was o+rw, but not on raspbian.
    2. Default permission for /dev/ttyACM0 on linux was o+rw, but not on raspbian.

  • The problem was two-fold. The big issue was that there's a file, /tmp/logs/log.txt, that was created by the main user on running nRF Sniffer from the command line. The www-data user did not have access to it, so the sniffer failed. Once that was solved, I was able to see that the sniffer did not have permission to use /dev/ttyACM0. /dev/ttyACM0 was owned by root:dialout and had group rw. Putting www-data in the dialout group didn't help, but adding rw permission to all users did.

    To summarize:
    1. Default permission for /tmp/logs/log.txt on linux was o+rw, but not on raspbian.
    2. Default permission for /dev/ttyACM0 on linux was o+rw, but not on raspbian.

Related