luci
luci copied to clipboard
luci-mod-network: wireless.js: add wifi-iface macaddr random support
Add ability to choose random
or custom macaddr
for wifi-iface
Choosing the new randomly generated MAC address option will cause a new MAC address to be generated whenever the WiFi interface is (re-)configured or the system is rebooted.
This will work only if wifi-iface supports option macaddr 'random'
.
Depends on https://github.com/openwrt/openwrt/pull/10307
Why not add a button to generate a random Mac? Instead of a select?
Il Lun 25 Lug 2022, 08:00 Manas Sambhus @.***> ha scritto:
Add ability to choose random or custom macaddr for wifi-iface
[image: wifi-iface macaddr option] https://user-images.githubusercontent.com/51392775/180708159-74ccb91b-97a1-4c81-8ae2-4f4ca7cf445c.png
This will work only after openwrt/openwrt#10307 https://github.com/openwrt/openwrt/pull/10307 is merged.
You can view, comment on, or merge this pull request online at:
https://github.com/openwrt/luci/pull/5896 Commit Summary
- 62b0f56 https://github.com/openwrt/luci/pull/5896/commits/62b0f562d2c154dbee2973a820904ad4a42aa27e luci-mod-network: wireless.js: add wifi-iface macaddr random support
File Changes
(1 file https://github.com/openwrt/luci/pull/5896/files)
- M modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js https://github.com/openwrt/luci/pull/5896/files#diff-adf712ab47ca2e5c052d0ad45de5737b2be6860525cd51ec8f424c7e3a43b78a (6)
Patch Links:
- https://github.com/openwrt/luci/pull/5896.patch
- https://github.com/openwrt/luci/pull/5896.diff
— Reply to this email directly, view it on GitHub https://github.com/openwrt/luci/pull/5896, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2ZMQWYRA4KQIQ634TPIXTVVYURNANCNFSM54RAYZQQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Why not add a button to generate a random Mac?
@Ansuel The purpose of adding a macaddr random
option to wifi-iface
was to ensure a new random MAC address is generated everytime the interface (or the router itself) is restarted. Please have a look at https://github.com/openwrt/openwrt/pull/10307.
Oh ok sorry for the noise then.
Il Lun 25 Lug 2022, 08:16 Manas Sambhus @.***> ha scritto:
Why not add a button to generate a random Mac?
@Ansuel https://github.com/Ansuel The purpose of adding a macaddr random option to wifi-iface was to ensure a new random MAC address is generated everytime the interface (or the router itself) is restarted. Please have a look at openwrt/openwrt#10307 https://github.com/openwrt/openwrt/pull/10307.
— Reply to this email directly, view it on GitHub https://github.com/openwrt/luci/pull/5896#issuecomment-1193626810, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2ZMQVMKZOKGOUHMK6FWC3VVYWMZANCNFSM54RAYZQQ . You are receiving this because you were mentioned.Message ID: @.***>
Wonder if you should add some reference about this in the commit description. Anyway good work.
@Ansuel Updated commit and PR description
Is it possible to allow random/custom mac enabled by default? I mean to make the Openwrt router forget about the original factory MAC address at all, and never expose the original factory MAC address anytime anywhere, in order to prevent accidental leakage(during first time setup for example). Broadcasting real MAC address is just too...big brother. I suggest to allow to choose between Permanent/Temporary/Factory MAC and manual regenerate for the button design.
No, it will most likely not become the default as it would break existing setups relying on specific MACs for DHCP lease reservations etc.
@Che15ea I agree with @jow-, most people would prefer to use the router's default MAC address wherever possible, and opt in to using a randomised MAC only for some specific interfaces. Some have a network setup relying on MAC address for address assignment, access control etc. and also, there are some ISPs that identify a customer's device by MAC address and block access otherwise - hence using a randomized MAC by default would be troublesome for them.
Is it possible to allow random/custom mac enabled by default? I mean to make the Openwrt router forget about the original factory MAC address at all
If you need such a firmware, you can easily build one for yourself with the OpenWrt Imagebuilder. On most platforms, the /etc/board.d/xx_network
script is responsible for configuring the correct MAC address for the router by reading it from some flash partition or firmware folders in the kernel. You can replace this file with your own, that calls the macaddr_random()
function in place of the correct procedure defined for your device. Note that in most cases, this would also alter your ethernet MAC address, so be careful.
in order to prevent accidental leakage(during first time setup for example)
If referring to just wireless, I don't think that the original MAC address is leaked during the initial setup, because the wireless interfaces are disabled by default. You should be able to customise the settings and enable the interfaces only once done.
I suggest to allow to choose between Permanent/Temporary/Factory MAC and manual regenerate for the button design.
Thank you for the suggestion. I'll consider adding a button to generate a new random MAC address (in a separate PR). Currently, with the new randomly generated option that I've added, the MAC address is randomised whenever the WiFi interface is (re-)configured, so I believe that using the restart button in LuCI for that interface, should also create a new MAC address for it.
I merged https://github.com/openwrt/openwrt/pull/10307 and think this PR is fine, @jow- ?
I hope the 2 options in the select list are clear enough and are not misinterpreted 🙃
Also, do we need a custom validation message?
Is this "Network -> Interfaces -> Devices -> Configure -> Mac address", and going to be applied to all device types, not just Wi-Fi? I want to randomise the MAC address of my "WAN" device, so that my ISP would give a random IP, because the ISP always gives the same IP for the same MAC address.
If I have set "randomly generated" to the Mac address of my WAN device, and I click "Network -> Interfaces -> WAN-> Restart", my WAN device's Mac address will be changed to a random address without restarting the whole router, right?
@HubKing The change that I implemented was only for MAC randomisation for Wi-Fi interfaces, not Ethernet or other kinds of interfaces.
If your WAN connection is over a wireless interface, then MAC randomisation will surely work for it. You can change the MAC address by restarting the WiFi interface, without having to restart the router.
@HubKing The change that I implemented was only for MAC randomisation for Wi-Fi interfaces, not Ethernet or other kinds of interfaces.
If your WAN connection is over a wireless interface, then MAC randomisation will surely work for it. You can change the MAC address by restarting the WiFi interface, without having to restart the router.
No, my WAN is not Wi-Fi; like most people, it is wired connection to a broadband modem from my ISP. Can't the same random feature applies to Ethernet (wired) MAC address, too?
Can't the same random feature applies to Ethernet (wired) MAC address, too?
@HubKing For this, one will have to look at the corresponding scripts for ethernet device setup and add the change there (just like I did for wireless interfaces).
This is a good idea though, I'll try to implement this when I get some time (probably in late December).
@aparcar I have implemented your suggestion about keeping the MAC address visible, but only if it is not randomised. (Or I can also add the check for macaddr
to be empty/unset rather than checking against random
)
@jow- Are we good to merge now?
Ping. 🙂 @Ansuel @aparcar @jow-
@msvamp can you update the screen with new implementation?
@msvamp can you update the screen with new implementation?
@Ansuel Edited my first comment to add new screenshots