Skip to content

nixos/openafsServer: give users the possibility of specifying privileged administrators declaratively #336793

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nessdoor
Copy link
Contributor

@nessdoor nessdoor commented Aug 23, 2024

Description of changes

OpenAFS has the concept of "privileged administrators", a set of users that are given the ability of executing administrative operations on the local AFS server (see UserList(5)). In order to configure this list of users, the system administrator must construct it imperatively via successive bos adduser/bos removeuser commands.

This change introduces a new setting, named privilegedAdministrators, which allows a system administrator to configure the list of privileged users declaratively, overwriting any pre-existing list. The original behavior is retained by default, or by setting privilegedAdministrators = null.

This addition represents a step forward towards achieving complete automatic deployment, easing the configuration of machines with volatile root partitions, and implementing automated tests.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 24.11 Release Notes (or backporting 23.11 and 24.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.

Add a 👍 reaction to pull requests you find important.

@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 Aug 23, 2024
@nessdoor nessdoor force-pushed the openafs-admin-list branch from 1df58da to 4d6eaca Compare August 23, 2024 14:48
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Aug 23, 2024
@nessdoor nessdoor force-pushed the openafs-admin-list branch from 4d6eaca to 575d6bd Compare August 23, 2024 15:06
@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 Aug 23, 2024
@nessdoor nessdoor force-pushed the openafs-admin-list branch from 690ec8a to fa76fcf Compare August 25, 2024 06:54
@nessdoor nessdoor requested a review from andersk August 25, 2024 13:47
@spacefrogg
Copy link
Contributor

I know this is not directly related to this PR but it also highlights the issue: Hard-coding localhost is not a good idea, because sometimes the server does not listen on localhost at all but only on the primary interface (when using -rxbind server options). This case is currently not handled by the systemd scripts. In this PR the problem gets a new quality, because it is not so easy anymore to fix by mkForce'ing the correct ExecStart and ExecStop command lines.

The logic should be as follows:

  • if advertisedAddresses != [] use the first advertised address
  • otherwise use localhost

This makes it an error to use -rxbind without also specifying advertisedAddresses, which I find okay. This also makes it an error to use a whole subnet for the first advertised address (which is permitted by the netInfo specification).

The user interface could be made safer by abstracting -rxbind into its own option, which can then enforce the necessary behaviour. On the other hand, a piece of documentation may suffice, because -rxbind needs a lot of administrator knowledge already to be useful. So, they are likely going to figure out the mechanics anyway by looking at the NixOS module (and the documentation).

Otherwise the PR looks fine. Thank you.

@nessdoor
Copy link
Contributor Author

@spacefrogg sorry for taking so long to respond, I have been on a hiatus from NixOS contributions, but now I'm back.

I am sorry I cannot quite understand your comment, or get any suggestion on how to improve my PR from it. Did I do something wrong?
You talk about overriding ExecStart and ExecStop via mkForce, but this PR does not alter any of those fields, instead relying on preStart and ExecPostStart to carry out its job. Am I missing some source of incompatibility in so doing?

Could you link any relevant issues that could be related to your concern? I might find some time to spare and work on it.

If you do not find any reason to keep this PR from being merged, could you also approve it?

@spacefrogg
Copy link
Contributor

I would ask you to update your PR in the following way:

  • Instead of hardcoding localhost, build the following logic:
    • if advertisedAddresses != [] use the first advertised address
    • otherwise use localhost

@nessdoor
Copy link
Contributor Author

While I was at it, I implemented the same logic for ExecStop as well, so that we can save on another PR. Is it ok?

Copy link
Contributor

@spacefrogg spacefrogg left a comment

Choose a reason for hiding this comment

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

While I was at it, I implemented the same logic for ExecStop as well, so that we can save on another PR. Is it ok?

Perfect! :)

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Nov 15, 2024
@nessdoor
Copy link
Contributor Author

Since you removed the backport tag (understandable, although not having this functionality in release 24.11 for a 2-days deadline overrun is quite sad) should I further alter the release notes to target 25.05?

@nessdoor
Copy link
Contributor Author

Moved the release notes to the 25.05 file, as it became highly unlikely that this change could land in 24.11 (and maybe that's for the better?).
Moving the release notes implied a rebase onto master, as the target release log file did not exist at the time this PR was created.

@wegank wegank removed the 12.approvals: 1 This PR was reviewed and approved by one person. label Nov 28, 2024
@spacefrogg
Copy link
Contributor

Yes, you did right. Although, I removed the backport label, because these kinds of improvements are not to be backported.

@nessdoor nessdoor added the 12.approvals: 1 This PR was reviewed and approved by one person. label Nov 28, 2024
@nessdoor
Copy link
Contributor Author

Sure, no offense taken, I understand my mistake, but please, if you modify something I did, let me at least know why you did it, however stupid my misstep might have been.

Anyway, thanks for sticking with me until this point! It is difficult to find people willing to review these niche systems and actually know what they're doing.

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 10, 2024
@nessdoor
Copy link
Contributor Author

Resolved merge conflict on release notes, all other modifications left unchanged.

@nessdoor nessdoor removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 30, 2024
@nixos-discourse
Copy link

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/5030

@wegank wegank removed the 12.approvals: 1 This PR was reviewed and approved by one person. label Dec 31, 2024
@nessdoor
Copy link
Contributor Author

Resolved merge conflict on release notes, all other modifications left unchanged.
Hopefully there will be no more conflicts on the release notes after this...

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 2, 2025
@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jun 25, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 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 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants