resinOS with Raspberry Pi wireless in monitoring mode

Hello resinio,

My team and I are installing RPis in some locations to collect wifi data via promiscuous / monitoring mode. We plan to have more than 10 RPis deployed in various locations.

Currently we have been deploying these RPis manually and would like to streamline the deployment process. We stumble upon resinio and gave it a shot and I think it’s a nifty tool to help us streamline development and deployment work via git and Docker.

In order for our application to work on the RPis, there are some configuration at the host level to ensure that monitoring mode on the built-in wifi chip is enabled (for e.g. with https://github.com/seemoo-lab/nexmon). However in order to use resinio we are required to use the pre-build resinOS images. I found that the filesystem is in read-only mode so i cannot add files or packages.

In order to successfully have our application work with resin.io, I would need to seek your advise on how to enable monitoring mode. Are there alternatives to resinOS or can resinOS be temporary launched with a read-write filesystem?

Your help is much appreciated. Thank you!

Regards,
Chris

Hi Chris!

This is certainly possible, though I’d have to start with a caveat:

One of the big values that the container approach gives you is that it’s easy to recover from a non working application update – just push a update the docker image and it’s back to working condition. When modifying the host Resin OS system, any failures there wouldn’t be remotely recoverable, so it’s important to keep that in mind.

Second caveat is that you’d have to re-apply the work around hack any time you update the core Resin OS version.

With that out of the way – yes this is certainly possible! :slight_smile:

You can list your devices through the resin-cli using:

$ resin devices
ID      UUID    NAME           DEVICE TYPE APPLICATION NAME STATUS IS ONLINE SUPERVISOR VERSION OS VERSION           DASHBOARD URL
1042685 bd10447 divine-feather intel-nuc   Docker           Idle   false     7.1.14             Resin OS 2.12.3+rev1 https://dashboard.resin.io/apps/1007573/devices/1042685/summary 

The UUID is important here. You can then SSH into the host operating system using:

$ resin ssh bd10447 --host

Once connected, you can remount the root file system and modify it as you need:

root@bd10447:/# mount -o remount, rw /
root@bd10447:/# echo "foo bar" > textfile.txt
root@bd10447:/# cat textfile.txt 
foo bar

These changes will persist over device reboots, but again, not over Resin OS upgrades (app updates won’t effect this of course).

The host OS is based on https://www.yoctoproject.org/ which doesn’t include a package manager, so you would probably want to package up the binary files and download those using curl and unpacking them locally on the host OS.

Once you’ve made this work, it should be pretty easy to automate this by executing all the required commands in a script that detects the latest new device, grabs the UUID, ssh’s to it and executes the commands on the host os.

Let me know if this makes sense and/or works for you!

@chrissng

I was wondering if you ever got this working as I am trying to accomplish something similar on the Balena fin v1.1.

My rather unstable solution is as follows:

As the on-board fin wifi doesn’t support monitoring mode. I am using a usb adapter that shows up as wlan1.

Then I ssh in and run the following commands:
ip link set wlan1 down
iw wlan1 set monitor control
ip link set wlan1 up

These changes don’t persist between restarts and to my frustration for some reason you have to plug the USB wifi adapter in after boot to be able to make these changes.

If you just and run these on the adapter with it plugged in during boot:
iw wlan1 set monitor control
output:
command failed operation not supported -95

I am working on making monitor mode persistent using the network manager.