networkmanager service: support changing the mac-address (#23464)
Set `networking.networkmanager.wifi.macAddress` or `networking.networkmanager.ethernet.macAddress` to one of these values to change your macAddress. * "XX:XX:XX:XX:XX:XX": set the MAC address of the interface. * "permanent": use the permanent MAC address of the device. * "preserve": don’t change the MAC address of the device upon activation. * "random": generate a randomized value upon each connect. * "stable": generate a stable, hashed MAC address. See https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/ for more information
This commit is contained in:
parent
2d0991580c
commit
9a7bad2c17
@ -24,6 +24,8 @@ let
|
||||
|
||||
[connection]
|
||||
ipv6.ip6-privacy=2
|
||||
ethernet.cloned-mac-address=${cfg.ethernet.macAddress}
|
||||
wifi.cloned-mac-address=${cfg.wifi.macAddress}
|
||||
'';
|
||||
|
||||
/*
|
||||
@ -73,6 +75,19 @@ let
|
||||
"pre-down" = "pre-down.d/";
|
||||
};
|
||||
|
||||
macAddressOpt = mkOption {
|
||||
type = types.either types.str (types.enum ["permanent" "preserve" "random" "stable"]);
|
||||
default = "preserve";
|
||||
example = "00:11:22:33:44:55";
|
||||
description = ''
|
||||
"XX:XX:XX:XX:XX:XX": MAC address of the interface.
|
||||
<literal>permanent</literal>: use the permanent MAC address of the device.
|
||||
<literal>preserve</literal>: don’t change the MAC address of the device upon activation.
|
||||
<literal>random</literal>: generate a randomized value upon each connect.
|
||||
<literal>stable</literal>: generate a stable, hashed MAC address.
|
||||
'';
|
||||
};
|
||||
|
||||
in {
|
||||
|
||||
###### interface
|
||||
@ -140,6 +155,9 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
ethernet.macAddress = macAddressOpt;
|
||||
wifi.macAddress = macAddressOpt;
|
||||
|
||||
dispatcherScripts = mkOption {
|
||||
type = types.listOf (types.submodule {
|
||||
options = {
|
||||
@ -229,6 +247,7 @@ in {
|
||||
|
||||
systemd.services."network-manager" = {
|
||||
wantedBy = [ "network.target" ];
|
||||
restartTriggers = [ configFile ];
|
||||
|
||||
preStart = ''
|
||||
mkdir -m 700 -p /etc/NetworkManager/system-connections
|
||||
|
Loading…
Reference in New Issue
Block a user