Nix remote builder hardening

I have a Hetzner machine with 24 cores and want to share it with semi-trusted users as a remote nix build server.

Has anyone done some work to restrict the user access to only the nix daemon? I don’t want the user to run arbitrary commands after accessing the account over SSH.

What do you want to prevent? If you want to prevent people from reading or writing files, ACLs allow you to prohibit users from reading world-readable directories; CPU hogging seems to be exactly what you do want to allow, and please remember that network operations can be done inside fixed-output builds.

I think you (or they) can use a fixed-output build to slowly print meaningless log lines (to prevent silence timeout) and open shell access into the build sandbox. The necessary data can be preloaded as a dependency.