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

nixos/memcached: Isolate the service #62936

Merged
merged 1 commit into from Aug 13, 2019
Merged

nixos/memcached: Isolate the service #62936

merged 1 commit into from Aug 13, 2019

Conversation

dasJ
Copy link
Member

@dasJ dasJ commented Jun 10, 2019

memcached is (as the name suggests) an in-memory database so FS access
is not required.

Motivation for this change
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.

memcached is (as the name suggests) an in-memory database so FS access
is not required.
Copy link
Member

@fpletz fpletz left a comment

Choose a reason for hiding this comment

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

Looks good in principle but haven't tested it.

@fpletz fpletz requested a review from roconnor June 10, 2019 14:40
@mmahut
Copy link
Member

mmahut commented Aug 12, 2019

@GrahamcOfBorg test memcached

@mmahut
Copy link
Member

mmahut commented Aug 12, 2019

@GrahamcOfBorg test nextcloud

@mmahut
Copy link
Member

mmahut commented Aug 13, 2019

Did some testing and it looks good.

@mmahut mmahut merged commit 4754ca7 into NixOS:master Aug 13, 2019
@dasJ dasJ deleted the sandbox-memcached branch August 14, 2019 15:36
@Izorkin
Copy link
Contributor

Izorkin commented Aug 15, 2019

Error work in hardened mode

diff --git a/nixos/tests/memcached.nix b/nixos/tests/memcached.nix
index b120599c51d..13e76b84b91 100644
--- a/nixos/tests/memcached.nix
+++ b/nixos/tests/memcached.nix
@@ -5,8 +5,9 @@ import ./make-test.nix ({ pkgs, ...} : {
     machine =
       { ... }:
       {
-        imports = [ ../modules/profiles/minimal.nix ];
+        imports = [ ../modules/profiles/minimal.nix <nixpkgs/nixos/modules/profiles/hardened.nix> ];
         services.memcached.enable = true;
+        nix.useSandbox = false;
       };
   };

Error:

machine# [   16.591869] systemd[657]: memcached.service: Failed to set up user namespacing: No space left on device
machine# [   16.594711] systemd[657]: memcached.service: Failed at step USER spawning /nix/store/nikl8awgqd0rhma7dpqq18l6ppi370bb-memcached-1.5.16/bin/memcached: No space left on                                                device
machine# [   16.611702] systemd[1]: memcached.service: Main process exited, code=exited, status=217/USER
machine# [   16.616513] systemd[1]: memcached.service: Failed with result 'exit-code'.

@Izorkin
Copy link
Contributor

Izorkin commented Aug 15, 2019

Error work with PrivateUsers = true;

@dasJ
Copy link
Member Author

dasJ commented Aug 15, 2019

@Izorkin so is the hardened error due to PrivateUsers? Or are these two unrelated?

@Izorkin
Copy link
Contributor

Izorkin commented Aug 16, 2019

I disabled PrivateUsers and the service worked. Checked with test nixos/tests/memcached.nix. Added to config memcached.nix <nixpkgs/nixos/modules/profiles/hardened.nix>

@Izorkin
Copy link
Contributor

Izorkin commented Aug 17, 2019

@dasJ is it possible to fix it?

@dasJ dasJ mentioned this pull request Aug 25, 2019
10 tasks
mmahut pushed a commit that referenced this pull request Aug 25, 2019
Seems to break systems using the hardened profile.
Ref #62936
cc @Izorkin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants