Commit Graph

2392 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 5a664ca10f rules: add a rule to set /dev/kvm access mode and ownership (#5597)
Kernel default mode is 0600, but distributions change it to group kvm, mode
either 0660 (e.g. Debian) or 0666 (e.g. Fedora). Both approaches have valid
reasons (a stricter mode limits exposure to bugs in the kvm subsystem, a looser
mode makes libvirt and other virtualization mechanisms work out of the box for
unprivileged users over ssh).

In Fedora the qemu package carries the relevant rule, but it's nicer to have it
in systemd, so that the permissions are not dependent on the qemu package being
installed. Use of packaged qemu binaries is not required to make use of
/dev/kvm, e.g. it's possible to use a self-compiled qemu or some alternative.

https://bugzilla.redhat.com/show_bug.cgi?id=1431876

To accomodate both approaches, add a rule to set the mode in 50-udev-default.rules,
but allow the mode to be overridden with a --with-dev-kvm-mode configure rule.
The default is 0660, as the (slightly) more secure option.
2017-03-27 12:34:24 +02:00
Thomas Haller 1539a651a9 basic: don't link "libm.so" into "libbasic.so" (#5628)
Very few parts of the systemd source require <math.h> or "libm.so".
Linking libbasic with -lm drags the mathematical library in for all
systemd components, and in turn for all users of systemd libraries.

It's just unneeded.
2017-03-24 15:36:06 +01:00
Michael Biebl 29f3265584 units: simplify rescue.service and emergency.service (#5623)
The emergency.service and rescue.service units have become rather
convoluted. We spawn multiple shells and the help text spans multiple lines
which makes the units hard to read.

Move the logic into a single shell script and call that via ExecStart.
2017-03-22 23:37:06 -04:00
Michael Biebl 1de2fef652 build-sys: minor indentation fix 2017-03-22 18:59:09 +01:00
steelman ff2e33db54 build-sys: make RPM macros installation path configurable (#5564)
--with-rpmmacrosdir=no disables installation of the macros.
2017-03-14 19:16:47 -04:00
Zbigniew Jędrzejewski-Szmek 1e7a425100 build-sys: add helper command to sign tarballs 2017-03-11 19:17:38 -05:00
Zbigniew Jędrzejewski-Szmek 92f58d6647 build-sys: simplify git tar invocation
git is nowadays nice enough to compress based on the output file suffix,
let's make use of that.
2017-03-11 19:09:27 -05:00
Zbigniew Jędrzejewski-Szmek d5e15d2fd7 build-sys: make more targets .PHONY 2017-03-11 19:01:43 -05:00
Martin Pitt 37377227ff build-sys: only install legacy *.pkla files with old polkit versions (#5555)
The legacy *.pkla files are not required when running against polkit ≥ 106,
and we want to avoid shipping files in /var if possible (but pkla files
can only be in /etc/ or /var).

Only install the *.pkla files if we detect an old polkit version during
configure. Don't install them if polkit isn't installed during build, as
distributions other than Debian-based ones have moved to the new polkit
long ago.

Fixes #5523
2017-03-08 08:20:11 -05:00
AsciiWolf 7ebf71ee03 sd-bus: drop kdbus-related docs (#5533) 2017-03-07 07:51:35 +01:00
Michael Biebl dcce98a4bd Avoid strict DM interface version dependencies (#5519)
Compiling against the dm-ioctl.h header as provided by the Linux kernel
will embed the DM interface version number. Running an older kernel can
result in an error like this on shutdown:

Could not detach DM dm-11: ioctl mismatch, kernel(4.34.4), user(4.35.4)

Work around this by shipping a local copy of dm-ioctl.h. We need at
least the version from 3.13 for DM_DEFERRED_REMOVE [1], so bump the
requirements in README accordingly.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2c140a246dc0bc085b98eddde978060fcec1080c

Fixes: #5492
2017-03-02 19:11:37 +01:00
Zbigniew Jędrzejewski-Szmek 09c1102496 build-sys: do not require everything to be rebuild to push man pages (#5521)
When the doc-sync target was created, we didn't have man target yet.
2017-03-02 17:55:45 +01:00
Zbigniew Jędrzejewski-Szmek 4317cf9026 Revert "environment.d: fix date"
This reverts commit 46987593cc.

Pushed to the wrong repo, sorry.
2017-03-01 19:27:54 -05:00
Zbigniew Jędrzejewski-Szmek 46987593cc environment.d: fix date 2017-03-01 19:27:09 -05:00
Zbigniew Jędrzejewski-Szmek 4f37cbd911 journalctl: move access_check() to shared/
The only functional change is that log_notice("No journal files were found.")
is not printed any more with --quiet. log_error("No journal files were opened
due to insufficient permissions.") is still printed.

I wasn't quite sure where to put this function, but shared/ seems to be the
right place and none of the existing files seem to fit too well.

v2: rename journal_access_check to journal_access_check_and_warn.
2017-02-28 21:37:35 -05:00
Lennart Poettering b90ef60fbc Revert "udev: Introduce UDEV_PROPAGATE_LOG macro (#5302)"
This reverts commit c22569eeea.

Let's revert this for now, since it apparently doesn't fix the problem
at hand.
2017-02-23 12:36:25 +01:00
Lennart Poettering 070251f36b Revert "Makefile.am: add a `\` (#5422)"
This reverts commit 00d1e0c9de.
2017-02-23 12:36:04 +01:00
Susant Sahani 00d1e0c9de Makefile.am: add a `\` (#5422)
fixes: #5419
2017-02-21 23:04:02 -05:00
Susant Sahani c22569eeea udev: Introduce UDEV_PROPAGATE_LOG macro (#5302)
As per commit 25e773e "udev: switch to systemd logging functions"
Now log_set_max_level() in udev_new() overwites system wide log level.

Propagate the udev.conf setting to log_set_max_level()
only if udev_new() is called from within udevd or one of its helpers.

Introduce a UDEV_PROPAGATE_LOG macro that we set with -D on
the gcc command line for all udev binaries we build, but not
for any others. The log_set_max_level() call is guarded by an
ifdef check for that macro, so that it only effects the various
udev binaries.

closes: #4525
2017-02-22 00:16:13 +01:00
Lennart Poettering e7034ee0ad build-sys: bump package version 2017-02-21 14:01:09 +01:00
Lennart Poettering a4dde27d73 Merge pull request #5131 from keszybz/environment-generators
Environment generators
2017-02-21 11:11:44 +01:00
Zbigniew Jędrzejewski-Szmek 51e76f7cd1 build-sys: make environment.d support conditional
We have ./configure switches for various parts of non-essential functionality,
let's add one for this new stuff too. Support for environment generators is
not conditional — if you don't want them, just don't install any.
2017-02-20 23:32:53 -05:00
Ray Strode 79d615d56c build-sys,man: load /etc/environment and describe the new environment.d syntax
Add support for /etc/environment and document the changes to the user manager
to automatically import environment *.conf files from:

        ~/.config/environment.d/
        /etc/environment.d/
        /run/environment.d/
        /usr/local/lib/environment.d/
        /usr/lib/environment.d/
        /etc/environment
2017-02-20 18:49:14 -05:00
Zbigniew Jędrzejewski-Szmek f63c4aabb2 environment-generator: new generator to peruse environment.d
Why the strange name: the prefix is necessary to follow our own advice that
environment generators should have numerical prefixes. I also put -d- in the
name because otherwise the name was very easy to mistake with
systemd.environment-generator. This additional letter clarifies that this
on special generator that supports environment.d files.
2017-02-20 18:49:14 -05:00
Zbigniew Jędrzejewski-Szmek 1bd2d4e31b man: add systemd.environment-generator(7) with two examples
v2:
  - add example files to EXTRA_DIST
v3:
  - rework for the new scheme where nothing is written to disk
v4:
  - use separate dirs for system and user env generators
2017-02-20 18:49:14 -05:00
Zbigniew Jędrzejewski-Szmek 64691d2024 manager: run environment generators
Environment file generators are a lot like unit file generators, but not
exactly:

1. environment file generators are run for each manager instance, and their
   output is (or at least can be) individualized.

   The generators themselves are system-wide, the same for all users.

2. environment file generators are run sequentially, in priority order.

Thus, the lifetime of those files is tied to lifecycle of the manager
instance. Because generators are run sequentially, later generators can use or
modify the output of earlier generators.

Each generator is run with no arguments, and the whole state is stored in the
environment variables. The generator can echo a set of variable assignments to
standard output:

  VAR_A=something
  VAR_B=something else

This output is parsed, and the next and subsequent generators run with those
updated variables in the environment. After the last generator is done, the
environment that the manager itself exports is updated.

Each generator must return 0, otherwise the output is ignored.

The generators in */user-env-generator are for the user session managers,
including root, and the ones in */system-env-generator are for pid1.
2017-02-20 18:49:14 -05:00
Lennart Poettering 4d1f490c93 units: enable resolved bus activation though a symlink in /etc
The change:
-/usr/lib/systemd/system/dbus-org.freedesktop.resolve1.service
+/etc/systemd/system/dbus-org.freedesktop.resolve1.service

If resolved is disabled, without this, talking to the resolved bus API will
activate it regardless whether it is enabled or not, let's fix that.
2017-02-17 16:03:47 -05:00
Evgeny Vereshchagin f73e6ee687 Merge pull request #5338 from mbiebl/fix-install-tests-target
Fix "make install-tests" when srcdir != builddir, fix valgrind-tests
2017-02-17 11:38:23 +03:00
Zbigniew Jędrzejewski-Szmek e53bcabb4b build-sys: drop now-unneeded $SYSTEMD_TEST_DATA when running tests 2017-02-17 08:42:15 +01:00
Zbigniew Jędrzejewski-Szmek 1f35a3b2a4 tests: look for tests relative to source dir when running from build dir
automake helpfully sets a few variables for during build. When our executable
is in a directory underneath $(abs_top_builddir), we know that we're in the
build environment $(abs_top_srcdir) contains the sources, and test data is
under $(abs_top_srcdir)/test. This remains true no matter where the build
directory is relative to the source directory. It also works if the test
executable is invoked as ./test-whatever or .libs/test-whatever, since the
relative path is not used at all.

When running from outside of the build directory, we should be running from the
installed location and we can look for ../testdata relative to the location of
the exe file.

Of course, $SYSTEMD_TEST_DATA always overrides this logic.
2017-02-16 21:36:31 +01:00
Zbigniew Jędrzejewski-Szmek 94fa1497ba Rename $TEST_DIR to $SYSTEMD_TEST_DATA, document it
TEST_DIR is rather generic, and we prefix all variables used by installed
executables with "SYSTEMD_".
2017-02-16 21:36:31 +01:00
Martin Pitt 916b500286 test: run valgrind-tests under $TESTS_ENVIRONMENT
Otherwise we are missing $TEST_DIR for the test data and run the test
against the system-installed binaries and keyboard/locale maps.
2017-02-16 21:36:30 +01:00
Michael Biebl 28d6adfcbd build-sys: fix "make install-tests" when srcdir != builddir
Follow-up for 4f8425b8d5
2017-02-16 21:36:30 +01:00
Evgeny Vereshchagin 77153e3f1b build-sys: add exec-privatedevices-[yes|no]-capability-sys-rawio to TEST_DATA_FILES
This is a follow-up for 625d8769fa
2017-02-16 19:28:17 +00:00
Evgeny Vereshchagin 870a76f7ba build-sys: treat journal-data/journal-[12].txt as TEST_DATA_FILES
Fixes:
```
Found container virtualization none.
Assertion 'imp.fd >= 0' failed at ../src/test/test-journal-importer.c:43, function test_basic_parsing(). Aborting.
FAIL: test-journal-importer (code: 134)
```
See https://github.com/systemd/systemd/pull/5366#issuecomment-280353804
2017-02-16 19:17:19 +00:00
Zbigniew Jędrzejewski-Szmek f06a6bcd76 test-journal-importer: add a test case with broken input 2017-02-15 00:31:55 -05:00
Zbigniew Jędrzejewski-Szmek 48ccb60d45 test-journal-importer: new test file to check the newly exported importer code
Only one test case is added, but it is enough to check basic sanity of the
code (single-line and binary fields and trusted fields, allocation and freeing).
2017-02-15 00:29:57 -05:00
Zbigniew Jędrzejewski-Szmek b18453eda6 Move export format parsing from src/journal-remote/ to src/basic/
No functional change.
2017-02-14 23:56:48 -05:00
Martin Pitt 4f8425b8d5 buildsys: add "install-tests" target
Add a new "install-tests" make target that installs our unit test-*
executables and their test data files into /usr/lib/systemd/tests/.
This is useful for packaging the tests to run them with root privileges
or in CI.

Fixes #5257
2017-02-13 22:40:11 +01:00
Martin Pitt f853c6efb5 test: make unit tests relocatable
It is useful to package test-* binaries and run them as root under
autopkgtest or manually on particular machines. They currently have a
built-in hardcoded absolute path to their test data, which does not work
when running the test programs from any other path than the original
build directory.

By default, make the tests look for their data in
<test_exe_directory>/testdata/ so that they can be called from any
directory (provided that the corresponding test data is installed
correctly). As we don't have a fixed static path in the build tree (as
build and source tree are independent), set $TEST_DIR with "make check"
to point to <srcdir>/test/, as we previously did with an automake
variable.
2017-02-13 22:31:13 +01:00
Martin Pitt ee3c7ff7c3 test: move resolved test data into test/
Moe test-resolve's test data from src/resolve/test-data to
test/test-resolve/ to be consistent with test/test-{execute,path}/. This
will make it easier to make the tests relocatable.
2017-02-13 22:23:48 +01:00
Lennart Poettering 6818c54ca6 core: skip ReadOnlyPaths= and other permission-related mounts on PermissionsStartOnly= (#5309)
ReadOnlyPaths=, ProtectHome=, InaccessiblePaths= and ProtectSystem= are
about restricting access and little more, hence they should be disabled
if PermissionsStartOnly= is used or ExecStart= lines are prefixed with a
"+". Do that.

(Note that we will still create namespaces and stuff, since that's about
a lot more than just permissions. We'll simply disable the effect of
the four options mentioned above, but nothing else mount related.)

This also adds a test for this, to ensure this works as intended.

No documentation updates, as the documentation are already vague enough
to support the new behaviour ("If true, the permission-related execution
options…"). We could clarify this further, but I think we might want to
extend the switches' behaviour a bit more in future, hence leave it at
this for now.

Fixes: #5308
2017-02-12 00:44:46 -05:00
Zbigniew Jędrzejewski-Szmek 89711996b3 basic/util: move execute_directory() to separate file
It's a fairly specialized function. Let's make new files for it and the tests.
2017-02-11 18:21:06 -05:00
Zbigniew Jędrzejewski-Szmek 050db122ba Merge pull request #5250 from ddstreet/test-sys-nodes-script
replace test/sys.tar.xz with script to create test/sys/ contents
2017-02-10 19:52:58 -05:00
Florian Klink a0e5c15d4f networkd: add IPv6ProxyNDPAddress support (#5174)
IPv6 Neighbor discovery proxy is the IPv6 equivalent to proxy ARP for IPv4.
It is required when ISPs do not unconditional route IPv6 subnets
to their designated target, but expect neighbor solicitation messages
for every address on a link.

A variable IPv6ProxyNDPAddress= is introduced to the [Network] section,
each representing a IPv6 neighbour proxy entry in the neighbour table.
2017-02-11 00:47:55 +01:00
Dan Streetman 741111c2ed test: change Makefile.am to use sys-script.py instead of sys.tar.xz 2017-02-10 15:29:46 -05:00
Zbigniew Jędrzejewski-Szmek 9c0f732c62 Introduce '## ' as internal comment prefix in .in files and filter out a comment (#5289)
Sometimes we have comments which don't make sense outside of the systemd
codebase, so let's filter them out from the user-visible files.

Fixes #5286.
2017-02-09 16:28:37 +01:00
Zbigniew Jędrzejewski-Szmek d20a328f97 build-sys,man: describe systemd-umount and hook it up to installation (#5227) 2017-02-05 22:27:38 +01:00
Lennart Poettering 2f3dfc6fb4 verity: add support for setting up verity-protected root disks in the initrd
This adds a generator and a small service that will look for "roothash="
on the kernel command line and use it for setting up a very partition
for the root device.

This provides similar functionality to nspawn's existing --roothash=
switch.
2016-12-21 19:09:30 +01:00
Lennart Poettering 91214a37ef fstab-generator: add support for volatile boots
This adds support for a new kernel command line option "systemd.volatile=" that
provides the same functionality that systemd-nspawn's --volatile= switch
provides, but for host systems (i.e. systems booting with a kernel).

It takes the same parameter and has the same effect.

In order to implement systemd.volatile=yes a new service
systemd-volatile-root.service is introduced that only runs in the initrd and
rearranges the root directory as needed to become a tmpfs instance. Note that
systemd.volatile=state is implemented different: it simply generates a
var.mount unit file that is part of the normal boot and has no effect on the
initrd execution.

The way this is implemented ensures that other explicit configuration for /var
can always override the effect of these options.  Specifically, the var.mount
unit is generated in the "late" generator directory, so that it only is in
effect if nothing else overrides it.
2016-12-21 19:09:29 +01:00