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

xrdp: fix rsakey.ini permissions #61160

Open
wants to merge 1 commit into
base: master
from

Conversation

@grwlf
Copy link
Contributor

commented May 8, 2019

Motivation for this change

We discovered that xrdp service on nixos-19.03 (19.03.git.22b639eb3ea (Koi)) doesn't work if enabled like this:

  services.xrdp = {
    enable = true;
  };

but works if one run corresponding systemd command as root. After enabling logs we found that xrdp reported about incorrect permissions of rsakey.ini file. This PR fixes the permissions at service startup.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@volth

This comment has been minimized.

Copy link
Contributor

commented May 8, 2019

Hm.

https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/xrdp.nix worked with just services.xrdp.enable = true;
Perhaps it is broken since some xrdp version update.


Does it work with

          chown root:xrdp /var/run/xrdp/rsakeys.ini
          chmod 440 /var/run/xrdp/rsakeys.ini

?

It is so with cfg.sslKey cfg.sslCert few lines above, that's why I offer to do the same with rsakeys.ini. Only for consistency. After few years it will be difficult to recall why some files are 440 and other 600, as I do not remember where I copy-pasted that 440 from. Maybe from Ubuntu?

root:xrdp+440 might have a small security advantage: xrdp user has no rights to change the file.

@volth

This comment has been minimized.

Copy link
Contributor

commented May 8, 2019

Also I remember someone did massive /var/run -> /run replacement, but this file is still full of /var/run

@volth

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

@GrahamcOfBorg test xrdp

@volth

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

Interesting.
The test works well even if there is no /var/run/rsakeys.ini at all, no claims in logs
xrdp 0.9.9

@volth

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

nixos-19.03 works too, without rsakeys.ini as well as with 600 permissions.
No errors in the log.
Could provide a testcase to reproduce the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.