GNOME Bugzilla – Bug 758301
[RFE] stable randomized MAC address for connecting
Last modified: 2017-03-07 20:50:04 UTC
After bug 734081, randomization of the MAC address can be enabled or disabled. It would be great to have a 3rd mode, which hashes the connection-uuid to create a stable randomized MAC address per connection. Similar, to what Windows10 does (https://www.ietf.org/proceedings/93/slides/slides-93-intarea-5.pdf) How about: add a new mode "NM_SETTING_MAC_RANDOMIZATION_TOKEN" and a new string field "wifi.mac-address-randomization-token". If the token of a connection is unspecified, we fallback to the connection-uuid. With this, a user can always get the same "randomize" MAC address for certain connections. He can also create multiple connections that share the same MAC address. This somehow overlaps with NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS. Maybe there should be instead an option to randomize the cloned-mac-address?
see also bug 705545 which does something related for ethernet...
branch on review: th/device-inital-mac-addr-bgo708820
branch merged as https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=9a354cdc906a8d04d6541f1275e80540b7c3d567 Especially, now we support a stable method wifi.cloned-mac-address=stable ethernet.cloned-mac-address=stable which by default generates hashed MAC addresses based on the UUID, but it can be overwritten by setting connection.stable-id. What is still missing is like windows-10 allows: to generate a new stable ID every day. That could be implemented by supporting special stable-id, like connection.stable-id=generated:utc:7d,2016-01-04 should start on Monday 2016-01-04, and generate an ID every 7 days. For example, today at "2016-30-6 6:30:00 (UTC)" it would generate "2016-30-27 00:00:00". That would be possible and neat, but the full featured option is slightly complicated to get right wrt. local-time vs UTC, daylight-saving, etc. I leave the bug open for that, th/wip/device-generate-stable-id-bgo758301 has an initial patch.
commit https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=f0d40525dfb079820e5dce48360ef6a9a540064a supports dynamic values for connection.stable-id. The following expressions are supported: ${CONNECTION} ${BOOT} ${RANDOM} which can also be combined. See https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/nm-conf.d/30-anon.conf?id=2eeb13d81e82ce47e76290c75ab3dfedb768f563 for examples. What is still missing would be time-based expression... something like: ${TIME:weekly} ${TIME:2017-02-03,weekly} (weekly, starting with this date) ${TIME:2017-02-03,5d,2d} (peridoic, starting with this day, first 5 days, then 2 days, then start again). But maybe that is totally over-engineered, and ${BOOT} is already a good start. I am closing this as fixed. Some time-based algorithms could make sense as future RFEs.