Commit graph

2328 commits

Author SHA1 Message Date
Gabriel Rauter a9d2d40dba networkctl: install zsh completion from #3062 (#4767)
zsh autocompletion provided by #3062 will be installed when networkd is
enabled.
2016-11-29 13:00:38 -05:00
Zbigniew Jędrzejewski-Szmek 953bf4604f units: add system-update-cleanup.service to guard against offline-update loops
Note: the name is "system-update-cleanup.service" rather than
"system-update-done.service", because it should not run normally, and also
because there's already "systemd-update-done.service", and having them named
so similarly would be confusing.

In https://bugzilla.redhat.com/show_bug.cgi?id=1395686 the system repeatedly
entered system-update.target on boot. Because of a packaging issue, the tool
that created the /system-update symlink could be installed without the service
unit that was supposed to perform the upgrade (and remove the symlink). In
fact, if there are no units in system-update.target, and /system-update symlink
is created, systemd always "hangs" in system-update.target. This is confusing
for users, because there's no feedback what is happening, and fixing this
requires starting an emergency shell somehow, and also knowing that the symlink
must be removed. We should be more resilient in this case, and remove the
symlink automatically ourselves, if there are no upgrade service to handle it.

This adds a service which is started after system-update.target is reached and
the symlink still exists. It nukes the symlink and reboots the machine. It
should subsequently boot into the default default.target.

This is a more general fix for
https://bugzilla.redhat.com/show_bug.cgi?id=1395686 (the packaging issue was
already fixed).
2016-11-29 01:40:34 -05:00
Martin Pitt 30dc7898d5 tests: add hwdb parsing test
This calls the built "systemd-hwdb update" on the source tree's hwdb/ in a
temporary directory and verifies that there are no error messages.
2016-11-24 11:46:03 +01:00
Martin Pitt 2c99aba726 networkd: allow networkd to set the timezone in timedated
systemd-networkd runs as user "systemd-network" and thus is not privileged to
set the timezone acquired from DHCP:

  systemd-networkd[4167]: test_eth42: Could not set timezone: Interactive authentication required.

Similarly to commit e8c0de912, add a polkit rule to grant
org.freedesktop.timedate1.set-timezone to the "systemd-network" system user.
Move the polkit rules from src/hostname/ to src/network/ to avoid too many
small distributed policy snippets (there might be more in the future), as it's
easier to specify the privileges for a particular subject in this case.

Add NetworkdClientTest.test_dhcp_timezone() test case to verify this (for
all people except those in Pacific/Honolulu, there the test doesn't prove
anything -- sorry ☺ ).
2016-11-23 16:32:06 +01:00
Martin Pitt e8c0de9127 hostnamed: allow networkd to set the transient hostname
systemd-networkd runs as user "systemd-network" and thus is not privileged to
set the transient hostname:

  systemd-networkd[516]: ens3: Could not set hostname: Interactive authentication required.

Standard polkit *.policy files do not have a syntax for granting privileges to
a user, so ship a pklocalauthority (for polkit < 106) and a JavaScript rules
file (for polkit >= 106) that grants the "systemd-network" system user that
privilege.

Add DnsmasqClientTest.test_transient_hostname() test to networkd-test.py to
cover this. Make do_test() a bit more flexible by interpreting "coldplug==None"
as "test sets up the interface by itself". Change DnsmasqClientTest to set up
test_eth42 with a fixed MAC address so that we can configure dnsmasq to send a
special host name for that.

Fixes #4646
2016-11-20 12:19:21 +01:00
Djalal Harouni 97e60383c0 test: add tests for RestrictNamespaces= 2016-11-15 15:50:19 +01:00
Tom Gundersen 23f53b99b1 networkd: clean up main header file a bit
Rename networkd.h to networkd-manager.h, to more accurately describe what it
contains.
2016-11-14 01:05:06 +01:00
Tom Gundersen 441e9ae4d9 networkd: netdev - move to separate subdirectory
This could (and should) be made into a separate daemon, at least move
the sourcefiles out for now.
2016-11-13 05:16:49 +01:00
Tom Gundersen c5fcf6e470 networkd-wait-online: move to separate subdirectory
Also clean up the header files a bit.
2016-11-13 01:29:30 +01:00
Zbigniew Jędrzejewski-Szmek 4318abe8d2 build-sys: do not install ctrl-alt-del.target symlink twice
It was a harmless but pointless duplication. Fixes #4655.

Note: in general we try to install as little as possible in
/etc/systemd/{system,user}. We only install .wants links there for units which
are "user configurable", i.e. which have an [Install] section. Most our units
and aliases are not user configurable, do not have an [Install] section, and
must be symlinked statically during installation. A few units do have an
[Install] section, and are enabled through symlinks in /etc/ during
installation using GENERAL_ALIASES. It *would* be possible to not create those
symlinks, and instead require 'systemctl preset' to be invoked after
installation, but GENERAL_ALIASES works well enough.
2016-11-12 10:14:10 -05:00
Zbigniew Jędrzejewski-Szmek d85a0f8028 Merge pull request #4536 from poettering/seccomp-namespaces
core: add new RestrictNamespaces= unit file setting

Merging, not rebasing, because this touches many files and there were tree-wide cleanups in the mean time.
2016-11-08 19:54:21 -05:00
Zbigniew Jędrzejewski-Szmek a809cee582 Merge pull request #4612 from keszybz/format-strings
Format string tweaks (and a small fix on 32bit)
2016-11-08 08:09:40 -05:00
Mike Gilbert d07903848f Adjust pkgconfig files to point at rootlibdir (#4584)
The .so symlinks got moved to rootlibdir in 082210c7.
2016-11-08 09:36:41 +01:00
Zbigniew Jędrzejewski-Szmek f97b34a629 Rename formats-util.h to format-util.h
We don't have plural in the name of any other -util files and this
inconsistency trips me up every time I try to type this file name
from memory. "formats-util" is even hard to pronounce.
2016-11-07 10:15:08 -05:00
Lennart Poettering add005357d core: add new RestrictNamespaces= unit file setting
This new setting permits restricting whether namespaces may be created and
managed by processes started by a unit. It installs a seccomp filter blocking
certain invocations of unshare(), clone() and setns().

RestrictNamespaces=no is the default, and does not restrict namespaces in any
way. RestrictNamespaces=yes takes away the ability to create or manage any kind
of namspace. "RestrictNamespaces=mnt ipc" restricts the creation of namespaces
so that only mount and IPC namespaces may be created/managed, but no other
kind of namespaces.

This setting should be improve security quite a bit as in particular user
namespacing was a major source of CVEs in the kernel in the past, and is
accessible to unprivileged processes. With this setting the entire attack
surface may be removed for system services that do not make use of namespaces.
2016-11-04 07:40:13 -06:00
Martin Pitt e2df6e90b2 build-sys: link test-seccomp against seccomp libs (#4560)
Fixes build error on recent toolchains:

  ../src/test/test-seccomp.c:35: error: undefined reference to 'seccomp_arch_native'
  collect2: error: ld returned 1 exit status
2016-11-03 23:15:33 +02:00
Djalal Harouni 5c67067f0e test: test DynamicUser= with SupplementaryGroups= 2016-11-03 08:38:28 +01:00
Djalal Harouni 2b9ac11ed9 test: test DynamicUser= with a fixed user 2016-11-03 08:37:15 +01:00
Lennart Poettering 515958c9eb build-sys: bump package and library version in preparation for v232 2016-11-02 16:04:40 -06:00
Zbigniew Jędrzejewski-Szmek 8d3eafa161 Merge pull request #4450 from poettering/seccompfixes
Various seccomp fixes and NEWS update.
2016-10-24 20:23:21 -04:00
Lennart Poettering 828d92acbc core: drop -.slice from shipped units
Since this unit is synthesized anyway there's no point in actually shipping it
on disk. This also has the benefit that "cd /usr/lib/systemd/system ; ls *"
won't be confused by the leading dash of the file name anymore.
2016-10-24 20:49:48 +02:00
Lennart Poettering f6281133de seccomp: add test-seccomp test tool
This validates the system call set table and many of our seccomp-util.c APIs.
2016-10-24 17:32:51 +02:00
Djalal Harouni 50ca7a35a1 test: lets add more tests to cover SupplementaryGroups= cases. 2016-10-24 12:38:53 +02:00
Zbigniew Jędrzejewski-Szmek 60f17f75d1 Merge pull request #4372 from evverx/fix-synced-cgroup-hierarchy-perms 2016-10-23 23:25:57 -04:00
Evgeny Vereshchagin 844da987ef tests/TEST-13-NSPAWN-SMOKE: remove an expected failure check
https://github.com/systemd/systemd/issues/4352 has been fixed
So, we don't need this workaround anymore
2016-10-23 23:23:43 -04:00
Djalal Harouni bf9ace96fc test: add more tests for SupplementaryGroups= 2016-10-23 23:27:16 +02:00
Djalal Harouni 86b838eaa3 test: Add simple test for supplementary groups 2016-10-23 23:27:14 +02:00
Lukas Nykryn 87a47f99bc failure-action: generalize failure action to emergency action 2016-10-21 15:13:50 +02:00
Evgeny Vereshchagin c7934185fe tests: add smoke test for systemd-nspawn
Basically, this test runs:
```
    systemd-nspawn --register=no -D "$_root" -b
    systemd-nspawn --register=no -D "$_root" --private-network -b
    systemd-nspawn --register=no -D "$_root" -U -b
    systemd-nspawn --register=no -D "$_root" --private-network -U -b
```
and exports the `UNIFIED_CGROUP_HIERARCHY=[yes|no]`, `SYSTEMD_NSPAWN_USE_CGNS=[yes|no]`

Inspired by
* systemd#3589 (comment)
* systemd#4372 (comment)
* systemd#4223 (comment)
* systemd#1555

and so on :-)
2016-10-17 16:50:09 +00:00
Lennart Poettering 8bfdf29b24 Merge pull request #4243 from endocode/djalal/sandbox-first-protection-kernelmodules-v1
core:sandbox: Add ProtectKernelModules= and some fixes
2016-10-13 18:36:29 +02:00
Felipe Sateler 651742d8ec build-sys: Allow disabling installation of pam config snippet 2016-10-12 14:09:14 -03:00
Djalal Harouni 4982dbcc30 test: add test to make sure that ProtectKernelModules=yes disconnect mount propagation 2016-10-12 14:12:36 +02:00
Djalal Harouni 3ae33295f0 test: add capability tests for ProtectKernelModules=
This just adds capabilities test.
2016-10-12 13:36:27 +02:00
Franck Bui 84a69ca9ba unit: drop console-shell.service (#4298) (#4325)
console-shell.service was supposed to be useful for normal clean boots
(i.e. multi-user.target or so), as a replacement for logind/getty@.service for
simpler use cases.

But due to the lack of documentation and sanity check one can easily be
confused and enable this service in // with getty@.service.

In this case we end up with both services sharing the same tty which ends up in
strange results.

Even worse, console-shell.service might be failing while getty@.service tries
to acquire the terminal which ends up in the system to poweroff since
console-shell.service uses:

  "ExecStopPost=-/usr/bin/systemctl poweroff".

Another issue: this service doesn't work well if plymouth is also used since it
lets the splash screen program run and mess the tty (at least a "plymouth quit"
is missing).

So let's kill it for now.
2016-10-10 12:06:26 +02:00
Zbigniew Jędrzejewski-Szmek 1ef11fb628 build-sys: use non-breaking spaces in contributor list
I think it's easier to read peoples' names with this change.
2016-10-03 07:36:59 -04:00
Djalal Harouni cdfbd1fb26 test: make sure that {readonly|inaccessible|readwrite}paths disconnect mount propagation
Better safe.
2016-09-27 09:24:46 +02:00
Djalal Harouni f78b36f016 test: add tests for simple ReadOnlyPaths= case 2016-09-27 09:24:43 +02:00
Djalal Harouni 615a1f4b26 test: add CAP_MKNOD tests for PrivateDevices= 2016-09-25 13:04:30 +02:00
Maciek Borzecki 082210c7a8 build-sys: get rid of move-to-rootlibdir
Replace move-to-rootlibdir calls in post-install hooks with explicitly
used ${rootlibdir} where needed.

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2016-09-24 15:15:01 +02:00
Maciek Borzecki af0a10bfa1 nss: install nss modules to ${rootlibdir}
NSS modules (libnss_*.so.*) need to be installed into
${rootlibdir} (typically /lib) in order to be used. Previously, the
modules were installed into ${libdir}, thus usually ending up in
/usr/lib, even on systems where split usr is enabled, or ${libdir} is
passed explicitly.

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2016-09-21 09:00:11 +02:00
Susant Sahani 92c918b06d networkd: add support to configure virtual CAN device (#4139)
1. add support for kind vcan
2. fixup indention netlink-types.c, networkd-netdev.c
2016-09-14 18:15:16 +02:00
Lennart Poettering 70cb8b7b16 sd-bus: add a small test case for sd_bus_track
This tests in particular that disconnecting results in the tracking object's
handlers to be called.
2016-08-22 17:31:36 +02:00
Evgeny Vereshchagin 29272c04a7 Merge pull request #3909 from poettering/mount-tool
add a new tool for creating transient mount and automount units
2016-08-19 23:33:49 +03:00
Zbigniew Jędrzejewski-Szmek de78fa9ba0 units: install user units as real files, not symlinks to ../system/
This was causing preset-all --global to create symlinks:

$ systemctl preset-all --global --root=/var/tmp/inst1
Created symlink /var/tmp/inst1/etc/systemd/user/shutdown.target → /usr/lib/systemd/user/../system/shutdown.target.
Created symlink /var/tmp/inst1/etc/systemd/user/sockets.target → /usr/lib/systemd/user/../system/sockets.target.
Created symlink /var/tmp/inst1/etc/systemd/user/timers.target → /usr/lib/systemd/user/../system/timers.target.
Created symlink /var/tmp/inst1/etc/systemd/user/paths.target → /usr/lib/systemd/user/../system/paths.target.
Created symlink /var/tmp/inst1/etc/systemd/user/bluetooth.target → /usr/lib/systemd/user/../system/bluetooth.target.
Created symlink /var/tmp/inst1/etc/systemd/user/printer.target → /usr/lib/systemd/user/../system/printer.target.
Created symlink /var/tmp/inst1/etc/systemd/user/sound.target → /usr/lib/systemd/user/../system/sound.target.
Created symlink /var/tmp/inst1/etc/systemd/user/smartcard.target → /usr/lib/systemd/user/../system/smartcard.target.
Created symlink /var/tmp/inst1/etc/systemd/user/busnames.target → /usr/lib/systemd/user/../system/busnames.target.

It is better to create units in a state that completely matches the presets, i.e.
preset-all should do nothing when invoked immediately after installation.

I'm sure it was confusing to users too, suggesting that system and user units
may somehow alias each other.
2016-08-19 09:55:55 -04:00
Zbigniew Jędrzejewski-Szmek 0064dcc0fc units: synchronize Makefile and presets settings
Enable reboot.target and disable exit.target: the first is used on normal
machines, the second only in containers, and the more general one
should be enabled by default.

Also fix the Makefile to match what preset-all does.

With this and the previous commits, doing "make instal DESTDIR=…" followed
by "systemctl preset-all --root=…" doesn't result in any changes.
2016-08-19 09:55:55 -04:00
Lennart Poettering 450442cf93 add a new tool for creating transient mount and automount units
This adds "systemd-mount" which is for transient mount and automount units what
"systemd-run" is for transient service, scope and timer units.

The tool allows establishing mounts and automounts during runtime. It is very
similar to the usual /bin/mount commands, but can pull in additional
dependenices on access (for example, it pulls in fsck automatically), an take
benefit of the automount logic.

This tool is particularly useful for mount removable file systems (such as USB
sticks), as the automount logic (together with automatic unmount-on-idle), as
well as automatic fsck on first access ensure that the removable file system
has a high chance to remain in a fully clean state even when it is unplugged
abruptly, and returns to a clean state on the next re-plug.

This is a follow-up for #2471, as it adds a simple client-side for the
transient automount logic added in that PR.

In later work it might make sense to invoke this tool automatically from udev
rules in order to implement a simpler and safer version of removable media
management á la udisks.
2016-08-18 22:41:19 +02:00
Zbigniew Jędrzejewski-Szmek c3f6a561e2 build-sys: hook up the hwdb parser to check 2016-08-09 00:42:52 -04:00
Jan Synacek 1259186355 test: fix test-execute personality tests on ppc64 and aarch64 (#3825) 2016-08-02 16:22:56 +02:00
Martin Pitt 98d2d46876 units: add graphical-session-pre.target user unit (#3848)
This complements graphical-session.target for services which set up the
environment (e. g. dbus-update-activation-environment) and need to run before
the actual graphical session.
2016-08-02 08:56:45 -04:00
Zbigniew Jędrzejewski-Szmek 0fbd465f41 Merge pull request #3742 from msoltyspl/vconfix2
vconsole-setup: updates & fixes V2
2016-07-28 23:59:06 -04:00