Skip to content

GbE-region MAC randomisation - #2171

Open
FckBigTch wants to merge 3 commits into
linuxboot:masterfrom
Nitrokey:mac_randomisation
Open

GbE-region MAC randomisation#2171
FckBigTch wants to merge 3 commits into
linuxboot:masterfrom
Nitrokey:mac_randomisation

Conversation

@FckBigTch

Copy link
Copy Markdown

Follow-up to the PoC in #1195. This PR builds on that work and it is a feature to view and randomize the Ethernet MAC address stored in the GbE region of the flash.

Module

  • Add nvmutil (from the Libreboot project).

Makefile

  • Add ifdtool (from coreboot) as a build target in the Makefile, built directly from the board's coreboot checkout with Heads' existing cross toolchain to coreboot's own module configure step.

initrd/bin/gui-init.sh

  • Add a "MAC address randomization" submenu in gui-init.sh, gated on boards config CONFIG_NVMUTIL=y and CONFIG_IFDTOOL=y.

GUI

New submenu under the main menu, shown only when both CONFIG_NVMUTIL and CONFIG_IFDTOOL are set to yes for the board:

  • Show current Ethernet MAC address
  • Randomize Ethernet MAC address (fully random)
  • Randomize Ethernet MAC address using a valid OUI (locally-administered/universal OUI pattern, so the result still looks like a plausible vendor-assigned address)

Tested boards

Known limitation / open question

Fbwhiptail doesn't support conditionally hiding a single menu entry, so gui-init.sh's show_options_menu is currently duplicated (one version with the MAC randomization entry, one without) selected based on whether the board has the feature enabled.
This works, but duplicating a whole menu function to add one conditional entry doesn't scale well if more optional, board-gated features are added later. An alternative I considered: always show the entry, and if CONFIG_NVMUTIL/CONFIG_IFDTOOL are no on that board, show a message like "This feature is not available on your board" instead of duplicating the menu. That avoids the duplication but surfaces a dead-end option to boards that can never use it. What do you think?

If there are anything changes you'd like me to make, just let me know.

- nvmutil from libreboot added as a module
- ifdtool from coreboot is included as a part of the Makefile

Signed-off-by: Rene <chaotic@disroot.org>
- Ethernet MAC address randomization - menu option is displayed only if $CONFIG_NVMUTIL=y and $CONFIG_IFDTOOL=y are set in the config file
- add mac_randomization_options_menu() - to select a completely random mac, an intel pattern or to show the current mac
- add show_mac()
- add change_mac()
- add clean_up_mac(), remove temporary files

Signed-off-by: Rene <chaotic@disroot.org>
- add $CONFIG_NVMUTIL
- add $CONFIG_IFDTOOL
- added only to tested boards: x230, t480, t480s
- novacustom v54 and v56, tools are set to no, see linuxboot#1871 (comment)

Signed-off-by: Rene <chaotic@disroot.org>

@tlaurion tlaurion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for picking up on #1195 !

There is ways to make menu options dynamic, thinking of unlocking spi per boot per config settings as an example. Will look deeper in further code review

Comment thread modules/nvmutil

nvmutil_configure :=
nvmutil_target := \
$(MAKE_JOS) \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Typo, doesn't parallelise build

@tlaurion

tlaurion commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Confused on how ifdtool is built here vs #1195 (which was unclean still, required coreboot's built ifdtool that is needed to build coreboot (see modules/coreboot there) to add Makefile hacks to pack ifdtool as cbmem is packed to be used inside of Heads.

ifdtool needs to be built with musl-cross-make to depend on musl's libc; so unclear how building it with coreboot's buildstack produces an actual working ifdtool to be used inside of heads? You tested this pr @FckBigTch ?

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.

2 participants