Commit Graph

39030 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 19130626a0 nspawn-oci: use SYNTHETIC_ERRNO 2019-03-21 10:51:43 +01:00
Lennart Poettering a3fc6b55ac nspawn: mask out CAP_NET_ADMIN again if settings file turns off private networking
Fixes: #11755
2019-03-15 15:42:21 +01:00
Lennart Poettering 3d6c367510 man: document the various new options nspawn learnt 2019-03-15 15:42:21 +01:00
Lennart Poettering bd4b15f274 nspawn: use right constant for shifting for uint64_t caps 2019-03-15 15:42:20 +01:00
Lennart Poettering de40a3037a nspawn: add support for executing OCI runtime bundles with nspawn
This is a pretty large patch, and adds support for OCI runtime bundles
to nspawn. A new switch --oci-bundle= is added that takes a path to an
OCI bundle. The JSON file included therein is read similar to a .nspawn
settings files, however with a different feature set.

Implementation-wise this mostly extends the pre-existing Settings object
to carry additional properties for OCI. However, OCI supports some
concepts .nspawn files did not support yet, which this patch also adds:

1. Support for "masking" files and directories. This functionatly is now
   also available via the new --inaccesible= cmdline command, and
   Inaccessible= in .nspawn files.

2. Support for mounting arbitrary file systems. (not exposed through
   nspawn cmdline nor .nspawn files, because probably not a good idea)

3. Ability to configure the console settings for a container. This
   functionality is now also available on the nspawn cmdline in the new
   --console= switch (not added to .nspawn for now, as it is something
   specific to the invocation really, not a property of the container)

4. Console width/height configuration. Not exposed through
   .nspawn/cmdline, but this may be controlled through $COLUMNS and
   $LINES like in most other UNIX tools.

5. UID/GID configuration by raw numbers. (not exposed in .nspawn and on
   the cmdline, since containers likely have different user tables, and
   the existing --user= switch appears to be the better option)

6. OCI hook commands (no exposed in .nspawn/cmdline, as very specific to
   OCI)

7. Creation of additional devices nodes in /dev. Most likely not a good
   idea, hence not exposed in .nspawn/cmdline. There's already --bind=
   to achieve the same, which is the better alternative.

8. Explicit syscall filters. This is not a good idea, due to the skewed
   arch support, hence not exposed through .nspawn/cmdline.

9. Configuration of some sysctls on a whitelist. Questionnable, not
   supported in .nspawn/cmdline for now.

10. Configuration of all 5 types of capabilities. Not a useful concept,
    since the kernel will reduce the caps on execve() anyway. Not
    exposed through .nspawn/cmdline as this is not very useful hence.

Note that this only implements the OCI runtime logic itself. It does not
provide a runc-compatible command line tool. This is left for a later
PR. Only with that in place tools such as "buildah" can use the OCI
support in nspawn as drop-in replacement.

Currently still missing is OCI hook support, but it's already parsed and
everything, and should be easy to add. Other than that it's OCI is
implemented pretty comprehensively.

There's a list of incompatibilities in the nspawn-oci.c file. In a later
PR I'd like to convert this into proper markdown and add it to the
documentation directory.
2019-03-15 15:41:28 +01:00
Lennart Poettering 5ef4cb7ad0 nspawn: (void)ify more stuff 2019-03-15 15:33:09 +01:00
Lennart Poettering 61b4443361 nspawn: refactor setuid code a bit
Let's separate out the raw uid_t/gid_t handling from the username
handling. This is useful later on.

Also, let's use the right gid_t type for group types wherever
appropriate.
2019-03-15 15:33:09 +01:00
Lennart Poettering 5211445eae capability: let's protect against the kernel eventually doing more than 64 caps
Everyone will be in trouble then (as quite widely caps are store in
64bit fields). But let's protect ourselves at least to the point that we
ignore all higher caps for now.
2019-03-15 15:33:09 +01:00
Lennart Poettering 248dd94171 capability: deal with libcap being older than kernel 2019-03-15 15:33:09 +01:00
Lennart Poettering c8a79aa812 capability: add a way to get a uint64_t with all caps set 2019-03-15 15:33:09 +01:00
Lennart Poettering 9a2c59119c capability: keep CAP_SETPCAP while dropping bounding caps
The kernel only allows dropping bounding caps as long as we have
CAP_SETPCAP. Hence, let's keep that before dropping the bounding caps,
and afterwards drop them too.
2019-03-15 15:33:09 +01:00
Lennart Poettering 75910ed9f4
Merge pull request #12012 from keszybz/generator-man-docs
Generator and documentation improvements
2019-03-15 14:45:00 +01:00
Zbigniew Jędrzejewski-Szmek d323a99001 man: reorder and add examples to systemd-analyze(1)
The number of verbs supported by systemd-analyze has grown quite a bit, and the
man page has become an unreadable wall of text. Let's put each verb in a
separate subsection, grouping similar verbs together, and add a lot of examples
to guide the user.
2019-03-15 13:55:24 +01:00
Zbigniew Jędrzejewski-Szmek 827f62c3f2 man,units: document what user "default.target" is a bit 2019-03-15 13:55:24 +01:00
Lennart Poettering 9bbd37845c
Merge pull request #11988 from keszybz/test-binaries-installation
Install more requires binaries for tests
2019-03-15 13:06:11 +01:00
Lennart Poettering 1aac9f5dee
Merge pull request #12009 from mrc0mmand/bump-partition-size-for-TEST-02-CRYPTSETUP
test: fix LUKS2 support
2019-03-15 13:01:24 +01:00
Zbigniew Jędrzejewski-Szmek dea4bef0a2
Merge pull request #11658 from yuwata/systemd-id128
id128: several cleanups
2019-03-15 11:18:28 +01:00
Yu Watanabe 58a6c57b75 bash-completion: add systemd-id128 support 2019-03-15 18:54:53 +09:00
Yu Watanabe 8efb042e0c sd-id128: split the logic obtaining invocation ID from sd_id128_get_invocation() 2019-03-15 18:53:23 +09:00
Yu Watanabe 9363e2f499 id128: no command accepts additional arguments 2019-03-15 18:53:23 +09:00
Zbigniew Jędrzejewski-Szmek 2fffb93b32 analyze: reword explanation in critical-chain header
Let's try to make it a bit clearer.
2019-03-15 10:17:46 +01:00
Frantisek Sumsal 5b69d297c1 test: use PBKDF2 instead of Argon2 in cryptsetup...
to reduce memory requirements for volume manipulation. Also,
to further improve the test performance, reduce number of PBKDF
iterations to 1000 (allowed minimum).
2019-03-15 10:05:33 +01:00
Zbigniew Jędrzejewski-Szmek 9c5ac5ebba man: tell generator writers to provide authorship and source information
Our generators always put a comment who generated the file, but we didn't
recommend it to others.

Let's also strengthen the advice to use SourcePath=.
2019-03-15 08:19:07 +01:00
Zbigniew Jędrzejewski-Szmek 00068caf36 fstab-generator: do not print double header
$ /run/systemd/generator/dev-mapper-fedora_krowka\x2dswap.swap
  # Automatically generated by systemd-fstab-generator

  # Automatically generated by systemd-fstab-generator

  [Unit]
  ...
2019-03-15 08:04:54 +01:00
Frantisek Sumsal 32983312ed test: bump the second partition size to 50MB
10MB is not enough for a LUKS2 partition.
2019-03-15 06:12:23 +01:00
Zbigniew Jędrzejewski-Szmek de04bbdce1 tree-wide: spell "lifecycle" without hyphen everywhere
We had 10 instances of unhyphentated spelling, and 4 of the hyphenated one.
Consistency trumps ispell.
2019-03-14 22:47:44 +01:00
Van Laser 3ac35cbc2b Add accelerometer orientation quirk for the MYRIA MY8307 2-in-1. 2019-03-14 15:55:34 +01:00
Lennart Poettering b3f6c4531e
Merge pull request #12002 from keszybz/man-headers
Man headers
2019-03-14 15:55:04 +01:00
Zbigniew Jędrzejewski-Szmek 98b0439f08 tests: install /usr/bin/dbus-broker when using dbus-broker
We'd install the service file, and then dbus-broker-launcher because it is
mentioned in ExecStart=, but not the main executable, so nothing would work.
Let's just install dbus-broker executables if found. They are small, so this
doesn't matter much, and is much easier than figuring the exact conditions
under which dbus-broker will be used instead of dbus-daemon.
2019-03-14 15:52:38 +01:00
Lennart Poettering 72830b187f
Merge pull request #11989 from poettering/minimal-portable-image
various documentation updates
2019-03-14 15:43:03 +01:00
Lennart Poettering beb6196982
Merge pull request #11785 from dvdhrm/implicit-sasl
sd-bus: allow cross-uid-namespace connections
2019-03-14 15:42:03 +01:00
Lennart Poettering c4d4b5a708 man: say explicitly which settings are not available in --user services
Fixes: #3944
2019-03-14 15:13:33 +01:00
Lennart Poettering 2e34d21b70 man: document that if the main process exits after SIGTERM we go directly to SIGKILL
Fixes: #8122
2019-03-14 15:13:33 +01:00
Lennart Poettering c4a05aa1a8 networkd: clarify that IPv6 RA uses our own stack, no the kernel's
Fixes: #8906
2019-03-14 15:13:33 +01:00
Lennart Poettering 5f42830079 man: mention O_NOCTTY and it's importance in daemon(7)
Fixes: #9164
2019-03-14 15:13:33 +01:00
Lennart Poettering e178b335f5 docs: adjust the spec a bit with firmware authros in mind
This borrows heavily from Nico Huber's
https://github.com/systemd/systemd/pull/10398, but makes a number of
changes.

Replaces: #10398
2019-03-14 15:13:33 +01:00
Lennart Poettering 6cc68362d5 man: document the network interface size limits --network-veth= enforces
Fixes: #10721
2019-03-14 15:13:33 +01:00
Lennart Poettering fba10579f1 man: document that Anonymize=yes makes DHCP leases grow in size
Fixes: #11551
2019-03-14 15:13:33 +01:00
Lennart Poettering 957848db22 docs: comprehensively document what a minimal portable service image needs to include
The docs were incomplete on this. Let's fix that.

Fixes: #11870
2019-03-14 15:13:33 +01:00
Zbigniew Jędrzejewski-Szmek 9e9213cd08
Merge pull request #12000 from poettering/split-more-util
split more files in src/basic/
2019-03-14 15:00:04 +01:00
Zbigniew Jędrzejewski-Szmek 3a54a15760 man: use same header for all files
The "include" files had type "book" for some raeason. I don't think this
is meaningful. Let's just use the same everywhere.

$ perl -i -0pe 's^..DOCTYPE (book|refentry) PUBLIC "-//OASIS//DTD DocBook XML V4.[25]//EN"\s+"http^<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"\n  "http^gms' man/*.xml
2019-03-14 14:42:05 +01:00
Zbigniew Jędrzejewski-Szmek 0307f79171 man: standarize on one-line license header
No need to waste space, and uniformity is good.

$ perl -i -0pe 's|\n+<!--\s*SPDX-License-Identifier: LGPL-2.1..\s*-->|\n<!-- SPDX-License-Identifier: LGPL-2.1+ -->|gms' man/*.xml
2019-03-14 14:29:37 +01:00
David Rheinsberg 1ed4723d38 sd-bus: skip sending formatted UIDs via SASL
The dbus external authentication takes as optional argument the UID the
sender wants to authenticate as. This uid is purely optional. The
AF_UNIX socket already conveys the same information through the
auxiliary socket data, so we really don't have to provide that
information.

Unfortunately, there is no way to send empty arguments, since they are
interpreted as "missing argument", which has a different meaning. The
SASL negotiation thus changes from:

    AUTH EXTERNAL <uid>
    NEGOTIATE_UNIX_FD                   (optional)
    BEGIN

to:

    AUTH EXTERNAL
    DATA
    NEGOTIATE_UNIX_FD                   (optional)
    BEGIN

And thus the replies we expect as a client change from:

    OK <server-id>
    AGREE_UNIX_FD                       (optional)

to:

    DATA
    OK <server-id>
    AGREE_UNIX_FD                       (optional)

Since the old sd-bus server implementation used the wrong reply for
"AUTH" requests that do not carry the arguments inlined, we decided to
make sd-bus clients accept this as well. Hence, sd-bus now allows
"OK <server-id>\r\n" replies instead of "DATA\r\n" replies.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2019-03-14 13:34:13 +01:00
David Rheinsberg 2010873b4b sd-bus: fix SASL reply to empty AUTH
The correct way to reply to "AUTH <protocol>" without any payload is to
send "DATA" rather than "OK". The "DATA" reply triggers the client to
respond with the requested payload.

In fact, adding the data as hex-encoded argument like
"AUTH <protocol> <hex-data>" is an optimization that skips the "DATA"
roundtrip. The standard way to perform an authentication is to send the
"DATA" line.

This commit fixes sd-bus to properly send the "DATA" line. Surprisingly
no existing implementation depends on this, as they all pass the data
directly as argument to "AUTH". This will not work if we want to pass
an empty argument, though.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2019-03-14 13:33:28 +01:00
David Rheinsberg 3cacdab925 sd-bus: avoid magic number in SASL length calculation
Lets avoid magic numbers and use a constant `strlen()` instead.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2019-03-14 13:31:14 +01:00
Lennart Poettering c3b6a348c0 main: use _exit() rather than exit() in code potentially caled from signal handler 2019-03-14 13:25:52 +01:00
Lennart Poettering d8b4d14df4 util: split out nulstr related stuff to nulstr-util.[ch] 2019-03-14 13:25:52 +01:00
Lennart Poettering 090a9c1eba util: move some raw memory functions from string-util.h → memory-util.h 2019-03-14 13:25:51 +01:00
Lennart Poettering cfb4a84942 util: don't include util.h from def.h
Nothing it defines is used in it.
2019-03-14 13:25:51 +01:00
Lennart Poettering 47094ce067 util: move dbus specific definition into bus-internal.h
It shouldn't be defined globally, since it's pretty much an
implementation detail of DBus.
2019-03-14 13:25:51 +01:00