Skip to content

client mode added#888

Open
BeigeBox wants to merge 42 commits intoEFForg:mainfrom
BeigeBox:feature/client-wifi
Open

client mode added#888
BeigeBox wants to merge 42 commits intoEFForg:mainfrom
BeigeBox:feature/client-wifi

Conversation

@BeigeBox
Copy link
Copy Markdown
Contributor

This has been tested on the Orbic. I have a Moxxe but I haven't tested it on that yet. One concern is that the wpa_supplicant is 1MB at present, which isn't good for the moxxe until we move it's logging to /cache. We may want to limit this to only Orbic until other devices are confirmed to work with this.

Posting this so folks can start to take a look at it and give me feedback. I've got a small shell script also that I threw together to tell me about the capabilities of other devices which I don't own. Reach out to me on mattermost if you have a device other than the Orbic or Moxxe and I'll send that to you. Then we can get a better idea of which devices can support client mode.

Pull Request Checklist

  • The Rayhunter team has recently expressed interest in reviewing a PR for this.
    • If not, this PR may be closed due our limited resources and need to prioritize how we spend them.
  • Added or updated any documentation as needed to support the changes in this PR.
  • Code has been linted and run through cargo fmt.
  • If any new functionality has been added, unit tests were also added.
  • CONTRIBUTING.md has been read.

@BeigeBox
Copy link
Copy Markdown
Contributor Author

I added another small change during the install to replace some daemons that aren't used for rayhunter. They phone home to verizon, and by replacing them with just shell scripts that sleep that's avoided. Plus it gets us more memory.

Comment thread installer/src/orbic_network.rs Outdated
Comment thread client-mode/scripts/wifi-client.sh Outdated
Comment thread daemon/src/server.rs Outdated
@BeigeBox BeigeBox marked this pull request as draft February 16, 2026 18:19
@BeigeBox
Copy link
Copy Markdown
Contributor Author

Now that I have the moxee I'm checking if it can support this too.

@BeigeBox BeigeBox force-pushed the feature/client-wifi branch from b7dc96b to 96ab600 Compare February 26, 2026 02:17
@BeigeBox BeigeBox marked this pull request as ready for review February 26, 2026 02:57
Comment thread installer/src/connection.rs Outdated
Comment thread installer/src/orbic_network.rs Outdated
Comment thread wifi/src/lib.rs Outdated
@cooperq
Copy link
Copy Markdown
Collaborator

cooperq commented Mar 4, 2026

We should figure out a way to hide the web ui config stuff if we didn't build with the wifi feature, right now as far as I can tell it would show up on all devices, no? Also It caused an error when I tried to set wifi stuff without compiling WPA supplicant first.
We should also include the steps for compiling WPA Supplicant in the building from source documentation.

@BeigeBox
Copy link
Copy Markdown
Contributor Author

BeigeBox commented Mar 4, 2026

We should figure out a way to hide the web ui config stuff if we didn't build with the wifi feature, right now as far as I can tell it would show up on all devices, no? Also It caused an error when I tried to set wifi stuff without compiling WPA supplicant first. We should also include the steps for compiling WPA Supplicant in the building from source documentation.

I recall that I was hiding the wifi stuff for devices without support for wifi yet (except the 'device security' section always shows as that's relevant whether you're on wifi or not). I have a script for compiling the WPA supplicant, maybe I forgot to include it. I'll turn that script into actual instructions.

@cooperq
Copy link
Copy Markdown
Collaborator

cooperq commented Mar 6, 2026

To clarify what I meant was I think that wifi should be a separate crate outside of rayhunter. Rust could use a good wifi crate, the only other one was last updated 2 years ago. But more importantly I think that rayhunter should not be this tightly coupled with the wifi handling. Right now this PR is probably too long to properly review, making wifi a separate external crate would probably help with that (or using an existing wifi crate.)

I also think that integrating the wifi with the installer is adding a lot of complexity for very little gain, I would suggest removing that for now and if you have a strong case for why it needs to be in there make that as a separate pull request later.

@BeigeBox
Copy link
Copy Markdown
Contributor Author

BeigeBox commented Mar 6, 2026

To clarify what I meant was I think that wifi should be a separate crate outside of rayhunter. Rust could use a good wifi crate, the only other one was last updated 2 years ago. But more importantly I think that rayhunter should not be this tightly coupled with the wifi handling. Right now this PR is probably too long to properly review, making wifi a separate external crate would probably help with that (or using an existing wifi crate.)

I also think that integrating the wifi with the installer is adding a lot of complexity for very little gain, I would suggest removing that for now and if you have a strong case for why it needs to be in there make that as a separate pull request later.

  1. Good call on removing the wifi from the installer, I'll do that.
  2. Are you suggesting a external crate on crates.io? That's a good long term goal, although I don't feel it's very actionable right now. This API is more device specific than I would like at the moment, for example adding support for the UZ801 required more tweaking than any other device so far (I haven't pushed that). I would like to eventually make it a general purpose crate, although until that point I would prefer to have it live with Rayhunter.
    EDIT: I'm willing to give it a go. I'll take a look over it and see what it would take to make it truly external, although I'm going to timebox that to an evening to avoid getting too deep into it if it's going to be a slog.
    EDIT EDIT: This is easier than I thought, I'll make it an external dep.
  3. In terms of the PR being too large to review, pulling out the wifi from the installer will help. I'll see what else I can do to slim it down.

Copy link
Copy Markdown
Collaborator

@oopsbagel oopsbagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots to address here, I'd like to see a lot of these changes cleaned up and decoupled from this PR.

The review process has left me wondering to what degree we need to integrate any of the wifi client support with the rayhunter daemon? We're already installing wpa_supplicant, right? What we integrate with rayhunter is at this point mostly plumbing the configuration through to wpa_supplicant and configuring iptables? (I'm not mentioning the ota blocking feature because that needs to move to a separate PR.)

Ideally, we can completely decouple any code changes from rayhunter and provide them separately as a downloadable extra in the FAQ. (e.g., "here's how to setup wpa_supplicant, with links to a prebuilt and vetted binary!", the same way we provide documentation on how to disable wifi.) I'm willing to accept that the solution isn't quite that clean cut, but what besides configuration control do we gain by integrating wifi client mode into the rayhunter binary?

Critically, the stability issues need to be addressed before we can considering including this.

Comment thread .github/workflows/main.yml Outdated
Comment thread tools/build-wpa-supplicant/Dockerfile Outdated
Comment thread installer/src/orbic_network.rs Outdated
Comment thread installer/src/orbic_network.rs Outdated
Comment thread installer/src/orbic_network.rs Outdated
Comment thread daemon/src/config.rs
Comment thread installer/src/connection.rs Outdated
Comment thread daemon/src/config.rs Outdated
Comment thread installer/src/tmobile.rs
Comment thread installer/Cargo.toml Outdated
@BeigeBox
Copy link
Copy Markdown
Contributor Author

BeigeBox commented Mar 11, 2026

Lots to address here, I'd like to see a lot of these changes cleaned up and decoupled from this PR.

The review process has left me wondering to what degree we need to integrate any of the wifi client support with the rayhunter daemon? We're already installing wpa_supplicant, right? What we integrate with rayhunter is at this point mostly plumbing the configuration through to wpa_supplicant and configuring iptables? (I'm not mentioning the ota blocking feature because that needs to move to a separate PR.)

Ideally, we can completely decouple any code changes from rayhunter and provide them separately as a downloadable extra in the FAQ. (e.g., "here's how to setup wpa_supplicant, with links to a prebuilt and vetted binary!", the same way we provide documentation on how to disable wifi.) I'm willing to accept that the solution isn't quite that clean cut, but what besides configuration control do we gain by integrating wifi client mode into the rayhunter binary?

Critically, the stability issues need to be addressed before we can considering including this.

Thanks for your comments, I've looked over them and I'll address them one at a time in their respective locations.

By integrating wifi client mode into the rayhunter installer and daemon we are getting two things in my view. The first being the groundwork for future work that needs a network or internet connection without paying for sim service. The second is user experience. The less roadbumps we have to getting something like this up and running, the greater the number of rayhunters will actually be deployed. If someone has to connect to the AP wifi every time they want more info than the minimal info a colored bar gives them that's going to be an impediment to the using it. Compare that to it being on their home network (or their phones hotspot) where they can just pull it up at any time.

I guess it comes down to what the goal with rayhunter is. Are we aiming to get as many of these out there so that we can truly understand the landscape of SCC deployment, or is it going to be a passion project that requires a lot of technical knowhow. This intent to make the project more accessable bleeds into some of the other work I'm doing which is a GUI for the TFT screen on the Orbic and Moxee.

@BeigeBox
Copy link
Copy Markdown
Contributor Author

I've got some code changes to finish testing then push, as well as comments from @oopsbagel to finish replying to but my lunch hour is up so I'll try and get to that tonight.

@sudo-nano
Copy link
Copy Markdown

I agree that it'd be ideal for client mode to be part of the official rayhunter software. Being able to set up real time alerts without having to pay for a separate cell plan for my rayhunter would be a huge improvement, and having these things integrated into the official installer is a huge help. I'm moderately familiar with setting up wireless related embedded systems, and have built a pwnagotchi, and I still dread trying to use third party modules for them.

Copy link
Copy Markdown
Contributor

@ch604 ch604 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The api doc builder won't like the external struct which has no utoipa decorators, so a change will likely be required upstream if we want to add api docs here successfully.

Comment thread daemon/src/config.rs
Comment thread daemon/src/server.rs
Comment thread daemon/src/server.rs
@ch604
Copy link
Copy Markdown
Contributor

ch604 commented Mar 16, 2026

ffr happy to make that upstream pr :)

@BeigeBox
Copy link
Copy Markdown
Contributor Author

ffr happy to make that upstream pr :)

That would be appreciated, thanks

Comment thread daemon/Cargo.toml Outdated
@BeigeBox BeigeBox requested review from ch604 and oopsbagel March 17, 2026 19:43
Copy link
Copy Markdown
Collaborator

@untitaker untitaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll let @oopsbagel have the final word over things, but I think in general this looks as good as it can get, thanks for the work so far! I am saddened that we have to replicate an entire WiFi GUI for client mode to work, and I'm also not convinced that the separate init script is needed.

Comment thread installer/src/orbic_network.rs Outdated
Comment thread lib/src/lib.rs
Comment thread daemon/src/firewall.rs
@BeigeBox
Copy link
Copy Markdown
Contributor Author

I'll let @oopsbagel have the final word over things, but I think in general this looks as good as it can get, thanks for the work so far! I am saddened that we have to replicate an entire WiFi GUI for client mode to work, and I'm also not convinced that the separate init script is needed.

I had command lines in the installer, although I was asked to take it out.

BeigeBox and others added 10 commits March 29, 2026 13:38
…OTA, revert unrelated changes

- Replace Docker-based wpa_supplicant build with shell script (scripts/build-wpa-supplicant.sh)
- Add iw cross-compilation and deployment to Orbic installer
- Skip wifi tool install if binary already exists on device
- Remove OTA daemon blocker (extracted for separate PR)
- Revert unrelated UZ801 and T-Mobile installer changes
- Remove connection.rs test scaffolding
- Rewrite S01iptables init script to read config.toml directly
- Pin url crate to 2.5.4 to fix MSRV
The ${VAR//pattern/replacement} syntax is a bash extension that
doesn't work in dash (Ubuntu's /bin/sh).
Passing PKG_CONFIG_LIBDIR as a make variable doesn't export it to
$(shell pkg-config ...) calls. Set it as an environment variable
so pkg-config finds the cross-compiled libnl.
Add decorators

Co-authored-by: Andrej Walilko <walilkoa@gmail.com>
add utopia doc support

Co-authored-by: Andrej Walilko <walilkoa@gmail.com>
add utopia doc support

Co-authored-by: Andrej Walilko <walilkoa@gmail.com>
@BeigeBox BeigeBox force-pushed the feature/client-wifi branch 2 times, most recently from c50da42 to 479742e Compare March 29, 2026 20:48
@BeigeBox BeigeBox force-pushed the feature/client-wifi branch from 479742e to 4be0214 Compare March 29, 2026 20:58
@BeigeBox
Copy link
Copy Markdown
Contributor Author

I'll have to add SAE support in the future. SAE support requires rebuilding wpa_supplicant with a real crypto backend (wolfSSL is the lightest option) since the internal crypto lacks the bignum and elliptic curve primitives that Dragonfly key exchange needs. This just means only WPA3 ONLY APs handshake wouldn't work. This isn't too practical of a concern though as almost all APs will allow WPA2/3.

@BeigeBox
Copy link
Copy Markdown
Contributor Author

BeigeBox commented Apr 6, 2026

Coming back to address the remaining open items. I replied to each of the inline comments individually, but the short version is: OTA removed, Docker replaced with shell script, UZ801 reverted, url pinned to 2.5.4, disk space check removed. All in 84062f1.

That leaves the two big questions from your review.

On stability: the wifi-station crate has a watchdog now that polls wlan1 every 30 seconds. It checks both interface existence and TX/RX packet counters. If traffic stalls for 3 consecutive polls it escalates through reassociate, wpa_supplicant restart, and full interface cycle. If the kernel module crashes entirely it reloads wlan.ko, restarts hostapd, and recreates the STA interface. There's exponential backoff on module reload failures and it gives up after 5 attempts. First crash saves a diagnostic snapshot to /data/rayhunter/crash-logs/ with dmesg, modules, ip addr, ps, and sysfs stats (keeps the last 10). There's also a kernel wakelock so the system doesn't sleep and drop wifi on battery. I've been running this on my Orbic for several weeks with no manual intervention needed. The watchdog has caught and recovered from a couple of wlan.ko crashes on its own.

On whether this needs to be in the daemon vs standalone: there are a few things we'd lose with standalone docs + binary.

  1. The UI shows live connection status (connected/connecting/recovering/failed with the assigned IP) by polling /api/wifi-status every 5 seconds. Without this users have no way to know what wifi is doing.
  2. /api/wifi-scan lets users discover networks from the UI instead of typing SSIDs and guessing security types.
  3. wifi_config() in config.rs handles device-specific paths for wpa_supplicant and hostapd across Orbic, T-Mobile, UZ801, and Wingtech. A standalone script would need separate variants or its own detection logic for each device.
  4. Saving config writes wpa_sta.conf and restarts the daemon atomically. Credentials stay in wpa_supplicant format, not in config.toml, and never come back via GET /api/config.
  5. Wifi runs as a managed tokio task with the daemon's shutdown token so cleanup is handled properly.

A standalone approach would work for people comfortable with shell access but it would lose status visibility, network discovery, and multi-device support out of the box. I think the integrated path makes sense if we want to lower the bar for getting rayhunters deployed.

fix ntfy port_or_known_default, comment out ntfy_url in config
template, update wifi-station with resolv.conf bind mount
fallback, udhcpc_bin config, and module path fix for UZ801
both devices have wifi hardware and backend support. wingtech
verified on hardware (QCA6174 via PCIe). uz801 excluded for now
due to driver scan limitations with hostapd active.
@cooperq cooperq self-assigned this Apr 17, 2026
Copy link
Copy Markdown
Collaborator

@cooperq cooperq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay so, outstanding issues:

  1. Orbic-usb doesn't install the wifi files (are there other installers that we need to add support for?)
  2. install-dev doesn't install wifi files even in wifi install mode
  3. docs and web UI don't agree about the default DNS servers
  4. wifi client mode can't start if a client is connected to the device
    If 1, 2, and 3 are fixed I think I'm ready to merge this, testing seems to work well and I think the code is in a good place now.

Comment thread daemon/web/src/lib/components/ConfigForm.svelte Outdated
Comment thread dist/config.toml.in
@cooperq cooperq mentioned this pull request Apr 17, 2026
@cooperq cooperq self-requested a review April 21, 2026 16:14
@BeigeBox BeigeBox requested a review from untitaker April 21, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants