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

Feature request: system.autoUpgrade Git signature verification. #304764

Open
voronind-com opened this issue Apr 17, 2024 · 0 comments
Open

Feature request: system.autoUpgrade Git signature verification. #304764

voronind-com opened this issue Apr 17, 2024 · 0 comments

Comments

@voronind-com
Copy link

voronind-com commented Apr 17, 2024

NixOS is already committed to using Git, and signature (GPG/PGP/SSH) verification is one of the features of Git. Simplest case: when an attacker gets access to the repository, he can push malicious changes to all the hosts that have autoupgrade enabled.

Currently system.autoUpgrade does not implement signature verification option. Right now I use a simple custom systemd service that performs checks before switching:

pushd /tmp
rm -rf ./nixos
${lib.getExe pkgs.git} clone --depth=1 --single-branch --branch=main ${const.url} ./nixos
pushd ./nixos
${lib.getExe pkgs.git} verify-commit HEAD || { # <- Verification happens here.
	echo "Verification failed."
	exit 1
};
${lib.getExe pkgs.gnumake} switch

In the example above I already have a git configured system-wide to use my public key for verification. As a possibility, new option should allow specifying and checking public key instead of relying on system-wide configuration.

This allows to block any unsigned automatic changes to the hosts. In the worst case of losing the key it is still possible to access the host by other means to run a switch manually.

Feel free to ask me any questions.


Add a 👍 reaction to issues you find important.

@voronind-com voronind-com changed the title Feature request: AutoUpgrade Git signature verification. Feature request: system.autoUpgrade Git signature verification. Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants