Merge pull request #252283 from flokli/fcc-unlock-extra

This commit is contained in:
Ryan Lahfa 2023-09-13 10:18:06 +02:00 committed by GitHub
commit eb23738e85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 73 additions and 49 deletions

View File

@ -935,8 +935,7 @@ In addition to numerous new and upgraded packages, this release has the followin
using the `pomerium-cli` command, you should now install the `pomerium-cli` using the `pomerium-cli` command, you should now install the `pomerium-cli`
package. package.
- The option - The option `services.networking.networkmanager.enableFccUnlock`
[services.networking.networkmanager.enableFccUnlock](#opt-networking.networkmanager.enableFccUnlock)
was added to support FCC unlock procedures. Since release 1.18.4, the ModemManager was added to support FCC unlock procedures. Since release 1.18.4, the ModemManager
daemon no longer automatically performs the FCC unlock procedure by default. See daemon no longer automatically performs the FCC unlock procedure by default. See
[the docs](https://modemmanager.org/docs/modemmanager/fcc-unlock/) for more details. [the docs](https://modemmanager.org/docs/modemmanager/fcc-unlock/) for more details.

View File

@ -187,6 +187,8 @@
- Emacs macport version 29 was introduced. - Emacs macport version 29 was introduced.
- The option `services.networking.networkmanager.enableFccUnlock` was removed in favor of `networking.networkmanager.fccUnlockScripts`, which allows specifying unlock scripts explicitly. The previous option simply did enable all unlock scripts bundled with ModemManager, which is risky, and didn't allow using vendor-provided unlock scripts at all.
- The `html-proofer` package has been updated from major version 3 to major version 5, which includes [breaking changes](https://github.com/gjtorikian/html-proofer/blob/v5.0.8/UPGRADING.md). - The `html-proofer` package has been updated from major version 3 to major version 5, which includes [breaking changes](https://github.com/gjtorikian/html-proofer/blob/v5.0.8/UPGRADING.md).
- `kratos` has been updated from 0.10.1 to the first stable version 1.0.0, please read the [0.10.1 to 0.11.0](https://github.com/ory/kratos/releases/tag/v0.11.0), [0.11.0 to 0.11.1](https://github.com/ory/kratos/releases/tag/v0.11.1), [0.11.1 to 0.13.0](https://github.com/ory/kratos/releases/tag/v0.13.0) and [0.13.0 to 1.0.0](https://github.com/ory/kratos/releases/tag/v1.0.0) upgrade guides. The most notable breaking change is the introduction of one-time passwords (`code`) and update of the default recovery strategy from `link` to `code`. - `kratos` has been updated from 0.10.1 to the first stable version 1.0.0, please read the [0.10.1 to 0.11.0](https://github.com/ory/kratos/releases/tag/v0.11.0), [0.11.0 to 0.11.1](https://github.com/ory/kratos/releases/tag/v0.11.1), [0.11.1 to 0.13.0](https://github.com/ory/kratos/releases/tag/v0.13.0) and [0.13.0 to 1.0.0](https://github.com/ory/kratos/releases/tag/v1.0.0) upgrade guides. The most notable breaking change is the introduction of one-time passwords (`code`) and update of the default recovery strategy from `link` to `code`.

View File

@ -5,7 +5,7 @@ with lib;
let let
cfg = config.networking.networkmanager; cfg = config.networking.networkmanager;
delegateWireless = config.networking.wireless.enable == true && cfg.unmanaged != []; delegateWireless = config.networking.wireless.enable == true && cfg.unmanaged != [ ];
enableIwd = cfg.wifi.backend == "iwd"; enableIwd = cfg.wifi.backend == "iwd";
@ -40,7 +40,7 @@ let
}) })
(mkSection "keyfile" { (mkSection "keyfile" {
unmanaged-devices = unmanaged-devices =
if cfg.unmanaged == [] then null if cfg.unmanaged == [ ] then null
else lib.concatStringsSep ";" cfg.unmanaged; else lib.concatStringsSep ";" cfg.unmanaged;
}) })
(mkSection "logging" { (mkSection "logging" {
@ -103,7 +103,7 @@ let
}; };
macAddressOpt = mkOption { macAddressOpt = mkOption {
type = types.either types.str (types.enum ["permanent" "preserve" "random" "stable"]); type = types.either types.str (types.enum [ "permanent" "preserve" "random" "stable" ]);
default = "preserve"; default = "preserve";
example = "00:11:22:33:44:55"; example = "00:11:22:33:44:55";
description = lib.mdDoc '' description = lib.mdDoc ''
@ -126,7 +126,8 @@ let
pkgs.wpa_supplicant pkgs.wpa_supplicant
]; ];
in { in
{
meta = { meta = {
maintainers = teams.freedesktop.members; maintainers = teams.freedesktop.members;
@ -156,7 +157,7 @@ in {
int int
str str
])); ]));
default = {}; default = { };
description = lib.mdDoc '' description = lib.mdDoc ''
Configuration for the [connection] section of NetworkManager.conf. Configuration for the [connection] section of NetworkManager.conf.
Refer to Refer to
@ -186,7 +187,7 @@ in {
unmanaged = mkOption { unmanaged = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [ ];
description = lib.mdDoc '' description = lib.mdDoc ''
List of interfaces that will not be managed by NetworkManager. List of interfaces that will not be managed by NetworkManager.
Interface name can be specified here, but if you need more fidelity, Interface name can be specified here, but if you need more fidelity,
@ -251,7 +252,7 @@ in {
appendNameservers = mkOption { appendNameservers = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [ ];
description = lib.mdDoc '' description = lib.mdDoc ''
A list of name servers that should be appended A list of name servers that should be appended
to the ones configured in NetworkManager or received by DHCP. to the ones configured in NetworkManager or received by DHCP.
@ -260,7 +261,7 @@ in {
insertNameservers = mkOption { insertNameservers = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [ ];
description = lib.mdDoc '' description = lib.mdDoc ''
A list of name servers that should be inserted before A list of name servers that should be inserted before
the ones configured in NetworkManager or received by DHCP. the ones configured in NetworkManager or received by DHCP.
@ -336,21 +337,21 @@ in {
}; };
}; };
}); });
default = []; default = [ ];
example = literalExpression '' example = literalExpression ''
[ { [ {
source = pkgs.writeText "upHook" ''' source = pkgs.writeText "upHook" '''
if [ "$2" != "up" ]; then if [ "$2" != "up" ]; then
logger "exit: event $2 != up" logger "exit: event $2 != up"
exit exit
fi fi
# coreutils and iproute are in PATH too # coreutils and iproute are in PATH too
logger "Device $DEVICE_IFACE coming up" logger "Device $DEVICE_IFACE coming up"
'''; ''';
type = "basic"; type = "basic";
} ]''; } ]'';
description = lib.mdDoc '' description = lib.mdDoc ''
A list of scripts which will be executed in response to network events. A list of scripts which will be executed in response to network events.
''; '';
@ -369,14 +370,24 @@ in {
''; '';
}; };
enableFccUnlock = mkOption { fccUnlockScripts = mkOption {
type = types.bool; type = types.listOf (types.submodule {
default = false; options = {
id = mkOption {
type = types.str;
description = lib.mdDoc "vid:pid of either the PCI or USB vendor and product ID";
};
path = mkOption {
type = types.path;
description = lib.mdDoc "Path to the unlock script";
};
};
});
default = [ ];
example = literalExpression ''[{ name = "03f0:4e1d"; script = "''${pkgs.modemmanager}/share/ModemManager/fcc-unlock.available.d/03f0:4e1d"; }]'';
description = lib.mdDoc '' description = lib.mdDoc ''
Enable FCC unlock procedures. Since release 1.18.4, the ModemManager daemon no longer List of FCC unlock scripts to enable on the system, behaving as described in
automatically performs the FCC unlock procedure by default. See https://modemmanager.org/docs/modemmanager/fcc-unlock/#integration-with-third-party-fcc-unlock-tools.
[the docs](https://modemmanager.org/docs/modemmanager/fcc-unlock/)
for more details.
''; '';
}; };
}; };
@ -387,7 +398,14 @@ in {
[ "networking" "networkmanager" "packages" ] [ "networking" "networkmanager" "packages" ]
[ "networking" "networkmanager" "plugins" ]) [ "networking" "networkmanager" "plugins" ])
(mkRenamedOptionModule [ "networking" "networkmanager" "useDnsmasq" ] [ "networking" "networkmanager" "dns" ]) (mkRenamedOptionModule [ "networking" "networkmanager" "useDnsmasq" ] [ "networking" "networkmanager" "dns" ])
(mkRemovedOptionModule ["networking" "networkmanager" "dynamicHosts"] '' (mkRemovedOptionModule [ "networking" "networkmanager" "enableFccUnlock" ] ''
This option was removed, because using bundled FCC unlock scripts is risky,
might conflict with vendor-provided unlock scripts, and should
be a conscious decision on a per-device basis.
Instead it's recommended to use the
`networking.networkmanager.fccUnlockScripts` option.
'')
(mkRemovedOptionModule [ "networking" "networkmanager" "dynamicHosts" ] ''
This option was removed because allowing (multiple) regular users to This option was removed because allowing (multiple) regular users to
override host entries affecting the whole system opens up a huge attack override host entries affecting the whole system opens up a huge attack
vector. There seem to be very rare cases where this might be useful. vector. There seem to be very rare cases where this might be useful.
@ -403,7 +421,8 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = [ assertions = [
{ assertion = config.networking.wireless.enable == true -> cfg.unmanaged != []; {
assertion = config.networking.wireless.enable == true -> cfg.unmanaged != [ ];
message = '' message = ''
You can not use networking.networkmanager with networking.wireless. You can not use networking.networkmanager with networking.wireless.
Except if you mark some interfaces as <literal>unmanaged</literal> by NetworkManager. Except if you mark some interfaces as <literal>unmanaged</literal> by NetworkManager.
@ -414,25 +433,29 @@ in {
hardware.wirelessRegulatoryDatabase = true; hardware.wirelessRegulatoryDatabase = true;
environment.etc = { environment.etc = {
"NetworkManager/NetworkManager.conf".source = configFile; "NetworkManager/NetworkManager.conf".source = configFile;
} }
// builtins.listToAttrs (map (pkg: nameValuePair "NetworkManager/${pkg.networkManagerPlugin}" { // builtins.listToAttrs (map
(pkg: nameValuePair "NetworkManager/${pkg.networkManagerPlugin}" {
source = "${pkg}/lib/NetworkManager/${pkg.networkManagerPlugin}"; source = "${pkg}/lib/NetworkManager/${pkg.networkManagerPlugin}";
}) cfg.plugins) })
// optionalAttrs cfg.enableFccUnlock cfg.plugins)
{ // builtins.listToAttrs (map
"ModemManager/fcc-unlock.d".source = (e: nameValuePair "ModemManager/fcc-unlock.d/${e.id}" {
"${pkgs.modemmanager}/share/ModemManager/fcc-unlock.available.d/*"; source = e.path;
} })
// optionalAttrs (cfg.appendNameservers != [] || cfg.insertNameservers != []) cfg.fccUnlockScripts)
{ // optionalAttrs (cfg.appendNameservers != [ ] || cfg.insertNameservers != [ ])
"NetworkManager/dispatcher.d/02overridedns".source = overrideNameserversScript; {
} "NetworkManager/dispatcher.d/02overridedns".source = overrideNameserversScript;
// listToAttrs (lib.imap1 (i: s: }
{ // listToAttrs (lib.imap1
name = "NetworkManager/dispatcher.d/${dispatcherTypesSubdirMap.${s.type}}03userscript${lib.fixedWidthNumber 4 i}"; (i: s:
value = { mode = "0544"; inherit (s) source; }; {
}) cfg.dispatcherScripts); name = "NetworkManager/dispatcher.d/${dispatcherTypesSubdirMap.${s.type}}03userscript${lib.fixedWidthNumber 4 i}";
value = { mode = "0544"; inherit (s) source; };
})
cfg.dispatcherScripts);
environment.systemPackages = packages; environment.systemPackages = packages;