Commit Graph
172719 Commits
Author SHA1 Message Date
aszlig 46f7dd436f nixos/confinement: Allow to configure /bin/sh
Another thing requested by @edolstra in [1]:

  We should not provide a different /bin/sh in the chroot, that's just
  asking for confusion and random shell script breakage. It should be
  the same shell (i.e. bash) as in a regular environment.

While I personally would even go as far to even have a very restricted
shell that is not even a shell and basically *only* allows "/bin/sh -c"
with only *very* minimal parsing of shell syntax, I do agree that people
expect /bin/sh to be bash (or the one configured by environment.binsh)
on NixOS.

So this should make both others and me happy in that I could just use
confinement.binSh = "${pkgs.dash}/bin/dash" for the services I confine.

[1]: https://github.com/NixOS/nixpkgs/pull/57519#issuecomment-472855704

Signed-off-by: aszlig <aszlig@nix.build>
2019-03-14 19:14:05 +01:00
aszlig 0ba48f46da nixos/systemd-chroot: Rename chroot to confinement
Quoting @edolstra from [1]:

  I don't really like the name "chroot", something like "confine[ment]"
  or "restrict" seems better. Conceptually we're not providing a
  completely different filesystem tree but a restricted view of the same
  tree.

I already used "confinement" as a sub-option and I do agree that
"chroot" sounds a bit too specific (especially because not *only* chroot
is involved).

So this changes the module name and its option to use "confinement"
instead of "chroot" and also renames the "chroot.confinement" to
"confinement.mode".

[1]: https://github.com/NixOS/nixpkgs/pull/57519#issuecomment-472855704

Signed-off-by: aszlig <aszlig@nix.build>
2019-03-14 19:14:03 +01:00
aszlig ac64ce9945 nixos: Add 'chroot' options to systemd.services
Currently, if you want to properly chroot a systemd service, you could
do it using BindReadOnlyPaths=/nix/store (which is not what I'd call
"properly", because the whole store is still accessible) or use a
separate derivation that gathers the runtime closure of the service you
want to chroot. The former is the easier method and there is also a
method directly offered by systemd, called ProtectSystem, which still
leaves the whole store accessible. The latter however is a bit more
involved, because you need to bind-mount each store path of the runtime
closure of the service you want to chroot.

This can be achieved using pkgs.closureInfo and a small derivation that
packs everything into a systemd unit, which later can be added to
systemd.packages. That's also what I did several times[1][2] in the
past.

However, this process got a bit tedious, so I decided that it would be
generally useful for NixOS, so this very implementation was born.

Now if you want to chroot a systemd service, all you need to do is:

  {
    systemd.services.yourservice = {
      description = "My Shiny Service";
      wantedBy = [ "multi-user.target" ];

      chroot.enable = true;
      serviceConfig.ExecStart = "${pkgs.myservice}/bin/myservice";
    };
  }

If more than the dependencies for the ExecStart* and ExecStop* (which
btw. also includes "script" and {pre,post}Start) need to be in the
chroot, it can be specified using the chroot.packages option. By
default (which uses the "full-apivfs"[3] confinement mode), a user
namespace is set up as well and /proc, /sys and /dev are mounted
appropriately.

In addition - and by default - a /bin/sh executable is provided as well,
which is useful for most programs that use the system() C library call
to execute commands via shell. The shell providing /bin/sh is dash
instead of the default in NixOS (which is bash), because it's way more
lightweight and after all we're chrooting because we want to lower the
attack surface and it should be only used for "/bin/sh -c something".

Prior to submitting this here, I did a first implementation of this
outside[4] of nixpkgs, which duplicated the "pathSafeName" functionality
from systemd-lib.nix, just because it's only a single line.

However, I decided to just re-use the one from systemd here and
subsequently made it available when importing systemd-lib.nix, so that
the systemd-chroot implementation also benefits from fixes to that
functionality (which is now a proper function).

Unfortunately, we do have a few limitations as well. The first being
that DynamicUser doesn't work in conjunction with tmpfs, because it
already sets up a tmpfs in a different path and simply ignores the one
we define. We could probably solve this by detecting it and try to
bind-mount our paths to that different path whenever DynamicUser is
enabled.

The second limitation/issue is that RootDirectoryStartOnly doesn't work
right now, because it only affects the RootDirectory option and not the
individual bind mounts or our tmpfs. It would be helpful if systemd
would have a way to disable specific bind mounts as well or at least
have some way to ignore failures for the bind mounts/tmpfs setup.

Another quirk we do have right now is that systemd tries to create a
/usr directory within the chroot, which subsequently fails. Fortunately,
this is just an ugly error and not a hard failure.

[1]: https://github.com/headcounter/shabitica/blob/3bb01728a0237ad5e7/default.nix#L43-L62
[2]: https://github.com/aszlig/avonc/blob/dedf29e092481a33dc/nextcloud.nix#L103-L124
[3]: The reason this is called "full-apivfs" instead of just "full" is
     to make room for a *real* "full" confinement mode, which is more
     restrictive even.
[4]: https://github.com/aszlig/avonc/blob/92a20bece4df54625e/systemd-chroot.nix

Signed-off-by: aszlig <aszlig@nix.build>
2019-03-14 19:14:01 +01:00
Matthew Bauer b703c4d998 plasma5: fix typo from pr #57037
Thanks @Yarny0
2019-03-14 14:09:13 -04:00
Robert SchützandGitHub badca37c51 Merge pull request #57621 from dtzWill/update/pyxlib-0.25
pythonPackages.xlib: 0.17 -> 0.25, enable tests
2019-03-14 18:20:46 +01:00
Robert Schütz ec95b91b30 plover.stable: add setuptools_scm to nativeBuildInputs 2019-03-14 18:17:34 +01:00
Will DietzandRobert Schütz 5a302b2005 pythonPackages.xlib: 0.17 -> 0.25, enable tests
https://github.com/python-xlib/python-xlib/releases/tag/0.25

(and the releases along the way)
2019-03-14 18:17:28 +01:00
Jörg ThalheimandGitHub 8f9e283f92 Merge pull request #56959 from ck3d/ghidra
initial ghidra-9.0
2019-03-14 15:54:30 +00:00
Ryan MulliganandGitHub 8c0abe74f0 Merge pull request #57366 from r-ryantm/auto-update/pius
pius: 2.2.6 -> 2.2.7
2019-03-14 07:41:32 -07:00
Tim Steinbach c22922e251 linux: 5.0.1 -> 5.0.2 2019-03-14 09:13:17 -04:00
Tim Steinbach ef53c6dd07 linux: 4.20.15 -> 4.20.16 2019-03-14 09:13:07 -04:00
Tim Steinbach 82d6e57943 linux: 4.19.28 -> 4.19.29 2019-03-14 09:12:51 -04:00
Tim Steinbach 85924d84fc linux: 4.14.105 -> 4.14.106 2019-03-14 09:12:37 -04:00
Tim Steinbach c130cb7374 linux: 4.9.162 -> 4.9.163 2019-03-14 09:12:19 -04:00
Andreas RammholdandGitHub a050cb9dc9 Merge pull request #57526 from xantoz/qtwebengine-fix-CVE-2019-5785
qt512: patch qtwebengine against CVE-2019-5786
2019-03-14 13:56:22 +01:00
Michael Weiss 871cd756c8 python.pkgs.distro: Re-enable the package for now
Most tests are fine (only 20 out of 173 fail, 10 because lsb_release is
not available or returns exit code 3 and the other 10 might also fail
due to the sandboxed build environment).
Manual tests show that distro works as intended in a normal environment.

See https://github.com/NixOS/nixpkgs/commit/9382d2ea762302c7a7a5c970679e4fca14256eca
2019-03-14 13:14:52 +01:00
Michael Weiss 0e0a00bb6f gns3Packages.{server,gui}Preview: 2.2.0a1 -> 2.2.0a2 2019-03-14 12:54:11 +01:00
Jörg ThalheimandGitHub e66a47263f Merge pull request #57544 from kim0/xmr-stak-2.10.1
xmr-stak: 2.8.3 -> 2.10.1
2019-03-14 11:44:29 +00:00
Jörg ThalheimandGitHub 4d2fe32784 Merge pull request #57635 from Mic92/engineio
python3.pkgs.python-engineio: 3.0.0 -> 3.4.3
2019-03-14 11:28:24 +00:00
Jörg Thalheim 42bc96105f python3.pkgs.engineio: limit to linux
probably has never build on macOS.
2019-03-14 11:23:14 +00:00
Nathan van DoornandRobert Schütz 512833807d pythonPackages.cbor2: init at 4.1.2 (#57507) 2019-03-14 12:22:29 +01:00
Robert SchützandGitHub aacd06eb5a Merge pull request #57594 from nyanloutre/electron-cash-update
Electron cash update
2019-03-14 12:15:45 +01:00
Jörg Thalheim f94dc01e75 python3.pkgs.python-engineio: 3.0.0 -> 3.4.3
fixes build of python-socketio
2019-03-14 11:14:43 +00:00
Michael Weiss c4c37f3414 tdesktopPackages.preview: 1.5.15 -> 1.5.17 2019-03-14 12:00:08 +01:00
nyanloutre 32c205789e electron-cash: 3.3.2 -> 3.3.6
Missing dependency and cleanup of the build process
2019-03-14 11:54:38 +01:00
nyanloutre 9b9f4d9005 pythonPackages.qdarkstyle: init at 2.6.5 2019-03-14 11:54:38 +01:00
Gabriel Ebner be261a1ede isabelle: refactor
Fixes #33337
2019-03-14 11:48:30 +01:00
Gabriel EbnerandGitHub 308456a7a7 Merge pull request #57567 from gebner/isabelle-2018
isabelle: 2017 -> 2018
2019-03-14 11:25:02 +01:00
Robert SchützandGitHub 5ee0125268 python.pkgs.shapely: fix tests on Darwin (#57630) 2019-03-14 10:28:43 +01:00
Ihar HrachyshkaandMichael Raskin 4730466366 xscreensaver: Enable perl modules needed for RSS image fetch (#57629) 2019-03-14 08:20:51 +00:00
Will DietzandBjørn Forsman 4a7a9d1650 ethtool: 4.19 -> 5.0 2019-03-14 08:17:48 +01:00
Elis HirwingandGitHub 894eee60a7 Merge pull request #57245 from Izorkin/php-options
php: add custom options
2019-03-14 08:13:22 +01:00
Matthew BauerandGitHub 92ec809473 Merge pull request #56686 from r-ryantm/auto-update/gorm
gnustep.gorm: 1.2.23 -> 1.2.24
2019-03-14 00:18:28 -04:00
Ryan MulliganandGitHub d5c6f5fd03 Merge pull request #57612 from dywedir/tiled
tiled: 1.2.2 -> 1.2.3
2019-03-13 20:54:16 -07:00
Ryan MulliganandGitHub e20ee8a710 Merge pull request #57386 from kierdavis/pius-fix-dependencies
pius: fix dependencies
2019-03-13 19:44:26 -07:00
worldofpeace 44298e76d5 lightdm: disable writing dmrc files to home
Can cause issues where lightdm prefers the last saved session in .dmrc
even if it doesn't exist anymore, preventing people from logging in to
a session.
2019-03-13 21:19:23 -04:00
Edmund Wuandworldofpeace ecc6ee8f1d vscode: 1.32.1 -> 1.32.2 2019-03-13 20:42:33 -04:00
Robert Schütz 40d96815a1 home-assistant: 0.89.1 -> 0.89.2 2019-03-14 00:52:17 +01:00
dywedir 92ea2c2ffd tiled: 1.2.2 -> 1.2.3 2019-03-14 01:41:25 +02:00
R. RyanTMandxeji 0a8d74d957 pywal: 3.2.1 -> 3.3.0 (#54685)
Semi-automatic update generated by
https://github.com/ryantm/nixpkgs-update tools. This update was made
based on information from
https://repology.org/metapackage/pywal/versions
2019-03-14 00:15:51 +01:00
Robert SchützandGitHub 098cb9f63a Merge pull request #56082 from Ma27/fix-pyopencl
python3Packages.pyopencl: fix build
2019-03-14 00:11:22 +01:00
R. RyanTMandxeji 39789683d0 tgt: 1.0.74 -> 1.0.75 (#57489)
Semi-automatic update generated by
https://github.com/ryantm/nixpkgs-update tools. This update was made
based on information from
https://repology.org/metapackage/tgt/versions
2019-03-14 00:09:50 +01:00
R. RyanTMandxeji ca713ac877 worker: 3.15.3 -> 3.15.4 (#57506)
Semi-automatic update generated by
https://github.com/ryantm/nixpkgs-update tools. This update was made
based on information from
https://repology.org/metapackage/worker/versions
2019-03-14 00:08:37 +01:00
R. RyanTMandxeji c2d40b8790 xosview2: 2.3.0 -> 2.3.1 (#57515)
Semi-automatic update generated by
https://github.com/ryantm/nixpkgs-update tools. This update was made
based on information from
https://repology.org/metapackage/xosview2/versions
2019-03-14 00:07:02 +01:00
jD91mZM2andxeji b9887d9fd1 xidlehook: v0.6.1 -> v0.6.2 (#57599) 2019-03-13 23:59:39 +01:00
Will Dietzandxeji 4d82af0250 inter-ui: 3.1 -> 3.3 (#57605)
FWIW new name but not sure worth renaming attribute
(to 'inter' or maybe 'inter-font'?)

https://github.com/rsms/inter/releases/tag/v3.3
https://github.com/rsms/inter/releases/tag/v3.2
2019-03-13 23:59:03 +01:00
Ethan Glasser-CampandRobert Schütz 2556b7bfad virtualenv: Update patch for 16.2.0 (#57533) 2019-03-13 23:58:52 +01:00
Mario Rodasandxeji da7d91017c pgmetrics: 1.5.0 -> 1.6.1 (#57575) 2019-03-13 23:49:53 +01:00
Robert Schütz f721655455 python.pkgs.cairosvg1: remove
Make python2.pkgs.cairosvg refer to what previously was cairosvg1 instead.
2019-03-13 23:49:35 +01:00
Robert Schütz 22877838fa python.pkgs.cssselect2: add pytest to checkInputs 2019-03-13 23:49:35 +01:00