Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

networking.wireguard...publicKey fails on newlines #166201

Closed
dbeecham opened this issue Mar 29, 2022 · 1 comment · Fixed by #216138
Closed

networking.wireguard...publicKey fails on newlines #166201

dbeecham opened this issue Mar 29, 2022 · 1 comment · Fixed by #216138
Labels
0.kind: bug Something is broken 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS

Comments

@dbeecham
Copy link
Contributor

Describe the bug

If a networking.wireguard.interfaces.<name>.peers.<peer-index>.publicKey contains newlines, e.g. when using = builtins.readFile pubkey, this bit of code

    let
      keyToUnitName = replaceChars
        [ "/" "-"    " "     "+"     "="      ]
        [ "-" "\\x2d" "\\x20" "\\x2b" "\\x3d" ];
      unitName = keyToUnitName publicKey;
      refreshSuffix = optionalString dynamicRefreshEnabled "-refresh";
    in
      "wireguard-${interfaceName}-peer-${unitName}${refreshSuffix}";

in nixos/modules/services/networking/wireguard.nix doesn't substitute the newline, and nix fails with an error like "store path contains illegal character ' '".

Steps To Reproduce

Steps to reproduce the behavior:

  1. ...publicKey = "\n"
  2. build

Expected behavior

newline is replaced with some useful character

Notify maintainers

@grahamc maybe

@dbeecham dbeecham added the 0.kind: bug Something is broken label Mar 29, 2022
@dbeecham
Copy link
Contributor Author

May be related to NixOS/nix#5466

@veprbl veprbl added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Mar 30, 2022
@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants