Skip to content

gluon-setup-mode: allow network-triggered activation #2778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

blocktrron
Copy link
Member

This commit adds the ability to Gluon's Setup-Mode to be activated using a magic packet while booting

Intention

Some Outdoor-Networking devices (Notably the ZyXEL NWA55AXE but also potential Extreme Networks / OCEDO APs) do not have a physical reset-button. Returning to setup-mode involves opening the devices case, attaching the serial console and proceeding from there.

This PR introduces a network-based activation process, where the device waits in preinit prior to setup-mode activation for a magic packet. When received, the setup-mode is activated for this power-cycle.

Implementation

The magic packet uses a custom ethertype and is sent with the LLDP Multicast ethernet-address. On proper networking equipment, this limits the packet scope to the domain of two devices and should not propagate over a switch. Combined with the activation window in preinit, this requires physical access to the device or the PoE Injector.

Usage

There are two c files located in the packet, one used in preinit by the target device and one for sending the magic packet.

Scope

This functionality is per-device specific. To be clear about this, a list of devices should be included in the documentation of Gluon's setup-mode where this activation method is supported.

This is intentional, as a generic invocation will (most likely) not work. Some devices use an internal switch which prevents the CPU from receiving this magic packet, thus breaking this feature.

ToDo

  • Add python script to /contrib for setup-mode activation (C program is linux-specific)
  • Switch board-platform detection to Gluons libplatform

@github-actions github-actions bot added the 3. topic: package Topic: Gluon Packages label Feb 2, 2023
@blocktrron
Copy link
Member Author

Having dug deeper into this topic, it seems like you can not send raw ethernet frames on Windows using python but require to install WinPCAP.

Still, I'd like to keep the action radius of this feature limited to the physical point to point connection. Given that this is a "special" device-specific feature, I'd tend to suggest using a live-Linux distribution if necessary.

@github-actions github-actions bot added 3. topic: build This is about the build system 3. topic: docs Topic: Documentation labels Feb 4, 2023
@herbetom
Copy link
Contributor

herbetom commented Feb 4, 2023

I feel like people could confuse the gluon-enter-setup-mode command and the enter-config-mode binary.

@blocktrron
Copy link
Member Author

enter-setup-mode is not accessible from the PATH on the device, so i don't see an issue with that.

@github-actions github-actions bot added 3. topic: config-mode This is about the configuration mode 3. topic: wireless Topic: Wireless labels Feb 5, 2023
@github-actions github-actions bot removed 3. topic: wireless Topic: Wireless 3. topic: config-mode This is about the configuration mode labels Feb 5, 2023
Copy link
Contributor

@herbetom herbetom left a comment

Choose a reason for hiding this comment

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

I've just succesfully enabled the Config Mode over the Network with this on an NWA55AXE. 👍

Comment on lines +1 to +2
enter-setup-mode
check-setup-mode
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be wait-network-request and send-network-request?

@herbetom
Copy link
Contributor

There were two ideas regarding this functionality at today's Gluon Meetup:

  • for "scheduled" reboots, such as firmware upgrades, a flag could be set to disable the network triggered activation of the setup mode
  • the node could activate setup mode as soon as it receives the packet, send a signal back to the user, and deactivate the setup mode flag after a timeout. This would require two power cycles as well as the packet to reach the node to activate the configuration mode

These are more "or" options, and it is probably not necessary to have both.

@blocktrron
Copy link
Member Author

I dislike both concepts.

As outlined above, the packet is only transferred on the link and filtered at the switch.

So you need to a) have direct connection to the node and b) access to the power source.

I don't see a real attack vector for the already in-place requirements.

@herbetom
Copy link
Contributor

The concern voiced on the Meetup was that Unmanaged Switches won't filter those LLDP Packages. (I've got no idea about that).

And then an attacker could take over a node once it reboots. On a Node with "Nightly" Firmware those reboots could take place quite often.

@blocktrron
Copy link
Member Author

I see this scenario as extremely remote.

Even in case you flood LLDP packages over a switch, your threat-model implies an attacker already having compromised the Network the node is attached to. Looking at Gluons architecture, this is either the Uplink-LAN or another mesh-link.

The only thing i might be able to compromise on is the blocking on automatic upgrades. The reason for it being AVM introduced it to their newer models using TZ.

I however strongly oppose this proposal

the node could activate setup mode as soon as it receives the packet, send a signal back to the user, and deactivate the setup mode flag after a timeout. This would require two power cycles as well as the packet to reach the node to activate the configuration mode

This only introduces unnecessary complexity without really addressing a threat model apart from a crashing node.

@AiyionPrime AiyionPrime added the 2. status: waiting-on-review Awaiting review from the assignee but also interested parties. label Feb 21, 2023
@neocturne
Copy link
Member

This only introduces unnecessary complexity without really addressing a threat model apart from a crashing node.

Could you explain what you mean? The idea behind the proposal was to prevent an attacker in the WAN network to use the reboot following an upgrade to take over a node by requiring two reboots in quick succession.

@AiyionPrime AiyionPrime added 0. type: question 2. status: waiting-on-author Waiting on some action from the author and removed 2. status: waiting-on-review Awaiting review from the assignee but also interested parties. labels Feb 22, 2023
@blocktrron blocktrron force-pushed the remote-setup-mode branch from b0f87b7 to 8dc618f Compare July 6, 2023 22:13
@T-X
Copy link
Contributor

T-X commented Nov 6, 2023

Another stupid/wild idea (but maybe it ain't stupid if it works?) came to my mind: There is another way to communicate with a node that is ensured to only work on a direct link: Changing the advertised link speed.

So one might be able to Morse(-like) a magic sequence via ethtool?

That contrary to LLDP would never propagate over a network, even with an unmanaged switch.

@kpanic23
Copy link
Contributor

How about trying to detect a loopback plug?
image

@Djfe
Copy link
Contributor

Djfe commented Dec 10, 2024

Whoever needs it: This PR currently resides as a community-packet here and is ready to use:
https://github.com/freifunk-gluon/community-packages/tree/master/ffda-network-setup-mode

@Djfe
Copy link
Contributor

Djfe commented Dec 10, 2024

since it's been a 1.5 years since the last force push.
@blocktrron do you still want this to be merged in some way or another. Or rather close this and be done with the debate?

also: I wish you Happy Holidays! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. type: question 2. status: waiting-on-author Waiting on some action from the author 3. topic: build This is about the build system 3. topic: docs Topic: Documentation 3. topic: package Topic: Gluon Packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants