Skip to content

rosenpass: refactor, add module and test - #254813

Merged
fricklerhandwerk merged 1 commit into
NixOS:masterfrom
ngi-nix:rosenpass-add-module
Oct 23, 2023
Merged

fricklerhandwerk merged 1 commit into
NixOS:masterfrom
ngi-nix:rosenpass-add-module

Conversation

@lorenzleutgeb

@lorenzleutgeb lorenzleutgeb commented Sep 12, 2023 •

Copy link
Copy Markdown
Member

Description of changes

  • Split rosenpass into rosenpass-tools (containing the rp script, which is not used by the module) and rosenpass (containing the rosenpass binary).
  • Refactor package.
  • Add module that interoperates with systemd-networkd.
  • Add a NixOS test involving two VMs that communicate via a WireGuard tunnel.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions Bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Sep 12, 2023
@github-actions github-actions Bot added 8.has: documentation This PR adds or changes documentation 8.has: changelog This PR adds or changes release notes labels Sep 12, 2023
@imincik

imincik commented Sep 12, 2023

Copy link
Copy Markdown
Contributor

@ofborg build rosenpass

@ofborg ofborg Bot added 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Sep 12, 2023
@lorenzleutgeb
lorenzleutgeb marked this pull request as ready for review September 13, 2023 16:25
@nixos-discourse

Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/2653

Comment thread nixos/tests/rosenpass/default.nix Resolved
@lorenzleutgeb

Copy link
Copy Markdown
Member Author

@ofborg build rosenpass rosenpass-tools

@Majiir Majiir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job generating the keys in the test!

Comment thread nixos/tests/rosenpass.nix Resolved
@lorenzleutgeb
lorenzleutgeb force-pushed the rosenpass-add-module branch 4 times, most recently from 6f6989b to 7bddc33 Compare September 26, 2023 11:54
@lorenzleutgeb

Copy link
Copy Markdown
Member Author

I implemented checking configuration for all of systemd.network, networking.wireguard and networking.wg-quick and tested locally by modifying the NixOS test.

@h7x4 h7x4 added 8.has: module (new) This PR adds a module in `nixos/` and removed 8.has: module (update) This PR changes an existing module in `nixos/` labels Oct 16, 2023

@SuperSandro2000 SuperSandro2000 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for another 10 comments 🙈 After this please merge this.

Comment thread pkgs/tools/misc/envsubst/default.nix Resolved
@github-actions github-actions Bot added the 8.has: module (update) This PR changes an existing module in `nixos/` label Oct 20, 2023
@wahjava

wahjava commented Oct 23, 2023

Copy link
Copy Markdown
Contributor

I have tried this on my host with both pqpk, and pqsk credentials present in /nix store (in one attempt), as well as in /run/agenix (in another attempt), and with both of them I get (after #258371 (comment)):

Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state idle-server → pending-disconnect
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state pending-disconnect → processing-disconnect
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state processing-disconnect → disconnected
Oct 22 23:31:25 hostname (ss-start)[679811]: Successfully forked off '(sd-mkdcreds)' as PID 679814.
Oct 22 23:31:25 hostname (sd-mkdcre[679814]: Changing mount propagation /dev (MS_REC|MS_SLAVE "")
Oct 22 23:31:25 hostname (sd-mkdcre[679814]: Bind-mounting /run/credentials/rosenpass.service on /dev/shm (MS_BIND|MS_REC "")...
Oct 22 23:31:25 hostname systemd[1]: varlink: New incoming connection.
Oct 22 23:31:25 hostname systemd[1]: varlink: Connections of user 998: 0 (of 1024 max)
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Setting state idle-server
Oct 22 23:31:25 hostname systemd[1]: varlink-234: New incoming message: {"method":"io.systemd.UserDatabase.GetMemberships","parameters":{"groupName":"wheel","service":"io.systemd.DynamicUser"},"more":true}
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state idle-server → processing-method-more
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Sending message: {"error":"io.systemd.UserDatabase.NoRecordFound","parameters":{}}
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state processing-method-more → processed-method
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state processed-method → idle-server
Oct 22 23:31:25 hostname (sd-mkdcre[679814]: Changing mount flags /dev/shm (MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_REMOUNT|MS_NOSYMFOLLOW|MS_BIND "")...
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Got POLLHUP from socket.
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state idle-server → pending-disconnect
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state pending-disconnect → processing-disconnect
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state processing-disconnect → disconnected
Oct 22 23:31:25 hostname systemd[1]: varlink: New incoming connection.
Oct 22 23:31:25 hostname systemd[1]: varlink: Connections of user 998: 0 (of 1024 max)
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Setting state idle-server
Oct 22 23:31:25 hostname systemd[1]: varlink-234: New incoming message: {"method":"io.systemd.UserDatabase.GetGroupRecord","parameters":{"gid":26,"service":"io.systemd.DynamicUser"}}
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state idle-server → processing-method
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Sending message: {"error":"io.systemd.UserDatabase.NoRecordFound","parameters":{}}
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state processing-method → processed-method
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state processed-method → idle-server
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Got POLLHUP from socket.
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state idle-server → pending-disconnect
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state pending-disconnect → processing-disconnect
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state processing-disconnect → disconnected
Oct 22 23:31:25 hostname systemd[1]: varlink: New incoming connection.
Oct 22 23:31:25 hostname (sd-mkdcre[679814]: Failed to write credential 'pqpk': No space left on device
Oct 22 23:31:25 hostname systemd[1]: varlink: Connections of user 998: 0 (of 1024 max)
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Setting state idle-server
Oct 22 23:31:25 hostname systemd[1]: varlink-234: New incoming message: {"method":"io.systemd.UserDatabase.GetMemberships","parameters":{"groupName":"video","service":"io.systemd.DynamicUser"},"more":true}
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state idle-server → processing-method-more
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Sending message: {"error":"io.systemd.UserDatabase.NoRecordFound","parameters":{}}
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state processing-method-more → processed-method
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state processed-method → idle-server
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Got POLLHUP from socket.
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state idle-server → pending-disconnect
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state pending-disconnect → processing-disconnect
Oct 22 23:31:25 hostname systemd[1]: varlink-234: Changing state processing-disconnect → disconnected
Oct 22 23:31:25 hostname (ss-start)[679811]: (sd-mkdcreds) failed with exit status 1.
Oct 22 23:31:25 hostname (ss-start)[679811]: rosenpass.service: Failed to set up credentials: Protocol error
Oct 22 23:31:25 hostname (ss-start)[679811]: rosenpass.service: Failed at step CREDENTIALS spawning /nix/store/xnd4vs34wjcn22a5wqsigjazwi53fjhi-unit-script-rosenpass-start/bin/rosenpass-start: Protocol error
Oct 22 23:31:25 hostname systemd[1]: Received SIGCHLD from PID 679811 ((ss-start)).
Oct 22 23:31:25 hostname systemd[1]: Child 679811 ((ss-start)) died (code=exited, status=243/CREDENTIALS)
Oct 22 23:31:25 hostname systemd[1]: rosenpass.service: Child 679811 belongs to rosenpass.service.
Oct 22 23:31:25 hostname systemd[1]: rosenpass.service: Main process exited, code=exited, status=243/CREDENTIALS
Oct 22 23:31:25 hostname systemd[1]: rosenpass.service: Failed with result 'exit-code'.
Oct 22 23:31:25 hostname systemd[1]: rosenpass.service: Service will not restart (restart setting)
Oct 22 23:31:25 hostname systemd[1]: rosenpass.service: Changed running -> failed
Oct 22 23:31:25 hostname systemd[1]: varlink-230: Sending message: {"parameters":{"cgroups":[{"mode":"auto","path":"/system.slice/rosenpass.service","property":"ManagedOOMSwap"},{"mode":"auto","path":"/system.slice/rosenpass.service","property":"ManagedOOMMemoryPressure"}]},"continues":true}
Oct 22 23:31:25 hostname systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=111895 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Oct 22 23:31:25 hostname systemd[1]: rosenpass.service: Unit entered failed state.
Oct 22 23:31:25 hostname systemd[1]: rosenpass.service: Consumed 24ms CPU time, no IP traffic.
Oct 22 23:31:25 hostname systemd[1]: Spawning process to nuke '/tmp/systemd-private-28bc45272815484484d3f2524bf6b5dd-rosenpass.service-05mAT6'
Oct 22 23:31:25 hostname systemd[1]: Successfully forked off '(sd-rmrf)' as PID 679815.
Oct 22 23:31:25 hostname systemd[1]: Spawning process to nuke '/var/tmp/systemd-private-28bc45272815484484d3f2524bf6b5dd-rosenpass.service-dmD4vn'
Oct 22 23:31:25 hostname systemd[1]: Successfully forked off '(sd-rmrf)' as PID 679816.

I'm running the patch b24d3d4 applied on top of 7c9cc5a

Co-authored-by: Andres Navarro <[email protected]>
Co-authored-by: Auguste Baum <[email protected]>
Co-authored-by: Ondrej Kubanek <[email protected]>
Co-authored-by: Ivan Mincik <[email protected]>
@lorenzleutgeb

Copy link
Copy Markdown
Member Author

@wahjava I tried to reproduce this error (using nix-sops instead of agenix), but was unable to. Feel free to send a minimal system configuration (ideally a NixOS test) that reproduces the error. You can check my attempt here: https://github.com/ngi-nix/ngipkgs/tree/e0d6dcf1ccaa8a5e48b2ef7041bcb0b6b8164832/tests/rosenpass. Note that the test that is provided in this PR uses systemd credentials, and the error in your case seems to be connected to setting up credentials, which is outside of the responsibility of the module.

One line struck me in particular:

Oct 22 23:31:25 hostname (sd-mkdcre[679814]: Failed to write credential 'pqpk': No space left on device

@fricklerhandwerk
fricklerhandwerk merged commit cc6c2d3 into NixOS:master Oct 23, 2023
@fricklerhandwerk

Copy link
Copy Markdown
Contributor

Merged following @SuperSandro2000's review and given the error is likely unrelated to the packaging code.

@nixos-discourse

Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-summer-of-nix-program-goals/30376/13

@wahjava

wahjava commented Feb 3, 2024

Copy link
Copy Markdown
Contributor

@wahjava I tried to reproduce this error (using nix-sops instead of agenix), but was unable to. Feel free to send a minimal system configuration (ideally a NixOS test) that reproduces the error. You can check my attempt here: https://github.com/ngi-nix/ngipkgs/tree/e0d6dcf1ccaa8a5e48b2ef7041bcb0b6b8164832/tests/rosenpass. Note that the test that is provided in this PR uses systemd credentials, and the error in your case seems to be connected to setting up credentials, which is outside of the responsibility of the module.

One line struck me in particular:

Oct 22 23:31:25 hostname (sd-mkdcre[679814]: Failed to write credential 'pqpk': No space left on device

@lorenzleutgeb I am able to create a minimal reproduction case, the problem being public key being 512K, which due to ExecStartPre present in the rosenpass.service gets written to $CREDENTIALS_DIRECTORY twice (once per Exec* entry). I think it's better to just move ExecStartPre script to ExecStart so as to avoid this.

I'm happy to file a PR, if you like.

Thanks!

@phanirithvij phanirithvij added the 6.topic: NLNet / NGI The project is part of the NGI funding grant. https://nlnet.nl/NGI/ label Jun 20, 2026
jfly pushed a commit to ngi-nix/infra that referenced this pull request Jul 6, 2026
@github-project-automation github-project-automation Bot moved this to Done in Nix@NGI Jul 17, 2026
@phanirithvij phanirithvij added this to NGI Jul 30, 2026
@github-project-automation github-project-automation Bot moved this to Done in NGI Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: NLNet / NGI The project is part of the NGI funding grant. https://nlnet.nl/NGI/ 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.