Commit graph

30114 commits

Author SHA1 Message Date
Lennart Poettering 2e7063777d Merge pull request #6772 from pfl/dnssl
networkd: DNSSL option for systemd-networkd prefix delegation
2017-09-15 13:17:36 +02:00
Zbigniew Jędrzejewski-Szmek fa69a4c74b man: update the description of machinectl -M
Fixes #6621.

Also rework the introduction a bit.
2017-09-15 11:47:46 +02:00
Zbigniew Jędrzejewski-Szmek 1c12694439 man: explain when networkd removed existing configuration and when not
Fixes #6693.
2017-09-15 11:23:57 +02:00
Patrik Flykt 760021c02c man: Document Domains for Router Advertisement network configuration 2017-09-15 10:34:57 +03:00
Patrik Flykt fa178dd2a2 test-ndisc-ra: Update test to include DNSSL option
Update the test to include the already provided DNSSL option.
2017-09-15 10:34:57 +03:00
Patrik Flykt 5e35aa815b networkd-radv: Set DNSSL information on Router Advertisement enabling 2017-09-15 10:34:57 +03:00
Patrik Flykt e965d6aba3 sd-radv: Add Router Advertisement DNS Search List option
Add Router Advertisement DNS Search List option as specified
in RFC 8106. The search list option uses and identical option
header as the RDNSS option and therefore the option header
structure can be reused.

If systemd is compiled with IDNA support, internationalization
of the provided search domain is applied, after which the search
list is written in wire format into the DNSSL option.
2017-09-15 10:34:57 +03:00
Patrik Flykt 700f1186e3 networkd: Parse DNS search domain information for Router Advertisement
Parse DNS search domains from .network files so that they are included
in Router Advertisement DNSSL options.

DNS search domains are added to the [IPv6PrefixDelegation] section using
the following syntax:

    Domains=foo.example.com bar.example.com

If IDNA libraries are enabled in systemd, international domain names
are supported.
2017-09-15 10:34:57 +03:00
Zbigniew Jędrzejewski-Szmek 6e2f5000c7 man: delete note about propagating signal termination
That advice is generally apropriate for "user" programs, i.e. programs which
are run interactively and used pipelines and such. But it makes less sense for
daemons to propagate the exit signal. For example, if a process receives a SIGTERM,
it is apropriate for it to exit with 0 code. So let's just delete the whole
paragraph, since this page doesn't seem to be the right place for the longer
discussion which would be required to mention all the caveats and considerations.

Fixes #6415.
2017-09-15 09:33:25 +02:00
Martin Pitt 6d44591141 Revert "device : reload when udev generates a "changed" event" (#6836)
This reverts commit 0ffddc6e2c. That
causes a rather severe disruption of D-Bus and other services when e. g.
restarting local-fs.target (as spotted by the "storage" test regression).

Fixes #6834
2017-09-15 09:21:49 +02:00
Lennart Poettering ab2116b140 core: make sure that $JOURNAL_STREAM prefers stderr over stdout information (#6824)
If two separate log streams are connected to stdout and stderr, let's
make sure $JOURNAL_STREAM points to the latter, as that's the preferred
log destination, and the environment variable has been created in order
to permit services to automatically upgrade from stderr based logging to
native journal logging.

Also, document this behaviour.

Fixes: #6800
2017-09-15 08:26:38 +02:00
Martin Pitt 2e914ef433 cryptsetup: fix unused variable (#6833)
When building without veracrypt, gcc warns

    ../src/cryptsetup/cryptsetup.c:55:13: warning: ‘arg_tcrypt_veracrypt’ defined but not used [-Wunused-variable]
      static bool arg_tcrypt_veracrypt = false;

Fix this by conditionalizing the declaration.
2017-09-15 07:32:50 +02:00
Susant Sahani bce67bbee3 networkd: add support to configure IP Rule (#5725)
Routing Policy rule manipulates rules in the routing policy database control the
route selection algorithm.

This work supports to configure Rule
```
[RoutingPolicyRule]
TypeOfService=0x08
Table=7
From= 192.168.100.18

```

```
ip rule show
0:	from all lookup local
0:	from 192.168.100.18 tos 0x08 lookup 7
```

V2 changes:

1. Added logic to handle duplicate rules.
2. If rules are changed or deleted and networkd restarted
   then those are deleted when networkd restarts next time

V3:

1. Add parse_fwmark_fwmask
2017-09-14 21:51:39 +02:00
Alan Jenkins f1e24a259c units: don't kill the emergency shell when sysinit.target is triggered (#6765)
Why
---

The advantage of this is that starting sysinit.target from the emergency
shell will no longer kill the emergency shell and lock you out of the
system.  Our docs already claimed that emergency.target was useful for
"starting individual units in order to continue the boot process in steps".
This resolves #6509 for my purposes.

Remaining limitation
--------------------

Starting getty.target will still kill the shell, and if you don't have a
root password you will then be locked out at that point.  This is relevant
to distributions which patch the sulogin system to permit logins when the
root password is locked.  Both Debian and RedHat used to follow this
behaviour!  Debian have been discussing what they could replace it with at
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806852

So this doesn't quite achieve perfection, but I think it's a worthwhile
change.  It should be easier to understand the logic now it doesn't have
such a big hole in it.  Repairing the sysinit stage of the boot is the main
reason we have emergency.target.  And as discussed in the issue,
sysinit.target gets pulled in implicitly as soon as any DefaultDependencies
service is activated.

How
---

sysinit.target only needs to conflict with emergency.target.  It didn't
need to conflict with emergency.service as well.  In theory the conflicts
are pointless, we could just change the dependency of sysinit.target on
local-fs.target from Wants to Requires.  However, doing so would mean that
when local-fs fails, the screen is flooded with yellow [DEPEND] failures.
That would hinder the poor unfortunate admin, so let's not do that.

There is no additional ordering requirement against emergency.  If the
failure happens, the job for sysinit will be cancelled instantly.  We don't
need to worry about when sysinit.target and its dependents would be
stopped, because sysinit waits for local-fs before it starts.

emergency.target is still necessarily stopped once we reach sysinit
(you can't express a one-way conflict in pure unit directives).
This is largely cosmetic... though perhaps it symbolizes that you're no
longer in Emergency Mode if System Initialization is successful ;-).

As a secondary advantage, the getty's which conflict on rescue.service now
need to conflict on emergency.service as well.  This makes the system more
uniform and simpler to understand.

The only other effect this should have is that
`systemctl start emergency.target` is now practically the same as
`systemctl start rescue.target`.  The only units this command will stop are
the conflicting getty units.  Neither of those commands should ever be
used.  E.g. they will not stop the gdm.service unit on Fedora 26.
2017-09-14 21:43:43 +02:00
Lennart Poettering 21f0669163 Merge pull request #6801 from johnlinp/master
man: explicitly distinguish "implicit dependencies" and "default dependencies"
2017-09-14 21:41:13 +02:00
Zbigniew Jędrzejewski-Szmek b74e0b1565 Merge pull request #6826 from poettering/empty-list-conf
don't unnecessarily create empty but allocated strv in config_parse_strv()
2017-09-14 20:14:37 +02:00
Felipe Sateler 038492aed3 shared: end string with % if one was found at the end of a expandible string (#6828)
Current behavior is that %X where X is an unidentified specifier, then the result is
the same %X string. This was not the case when the string ended with a stray %, where
the character would have not been output. Lets add that missing character.

Fixes: #6374
2017-09-14 19:51:19 +02:00
Zbigniew Jędrzejewski-Szmek 8b5c528ce8 Merge pull request #6818 from poettering/nspawn-whitelist
convert nspawn syscall blacklist into a whitelist (and related stuff)
2017-09-14 19:47:59 +02:00
Zbigniew Jędrzejewski-Szmek 6579a622ec Merge pull request #6790 from poettering/unit-unsetenv
add UnsetEnvironment= unit file setting, in order to fix #6407
2017-09-14 19:46:55 +02:00
Lennart Poettering bff8f2543b units: set LockPersonality= for all our long-running services (#6819)
Let's lock things down. Also, using it is the only way how to properly
test this to the fullest extent.
2017-09-14 19:45:40 +02:00
Zbigniew Jędrzejewski-Szmek a1f31f4715 core/manager: when running in test mode, use a temp dir for generated stuff
When running through systemd-analyze verify or with --test, we would
not run generators (environment or unit). But at the end, we would nuke
the generator dirs anyway.

Simplify things by actually running generators of both types, but redirecting
their output to a temporary directory. This has the advantage that we test more
code, and the verification is more complete.

Since now we are not touching the real generator directories, we also don't
delete them, which fixes #5609.
2017-09-14 19:41:24 +02:00
Lennart Poettering 71b514298b Merge pull request #6820 from keszybz/sysusers-doc-update
Assorted updates to man pages
2017-09-14 19:12:51 +02:00
Zbigniew Jędrzejewski-Szmek 81fe6cdee2 pid1: improve the check guarding unit_file_preset_all()
When running in systemd-analyze verify, first_boot was initialized to -1
and never changed, so we'd try to run unit_file_preset_all(). Change the
check to > 0 which is more correct. Also, add a separate test for !test_run,
since we wouldn't want to run presets even if we were in first boot
(or /etc was empty for whatever other reason).
2017-09-14 19:07:44 +02:00
Lennart Poettering 77542a7905 timer: don't use persietent file timestamps from the future (#6823)
Also, use the mtime rather than the atime of the timestamp file. While
the atime is not completely wrong, the mtime appears more appropriate
as that's what we actually explicitly change, and is not effected by
mere reading.

Fixes: #6821
2017-09-14 18:26:10 +02:00
Lennart Poettering 40fdd636ad conf-parser: when the empty string assigned to Personality= reset it
Let's support assigning the empty string to reset things in one more
place.
2017-09-14 16:54:32 +02:00
Lennart Poettering 8249bb728d core: don't synthesize empty list when empty string is read in config_parse_strv()
This was added to make
https://bugs.freedesktop.org/show_bug.cgi?id=62558 work, which has long
been removed, hence let's revert to the original behaviour and fully
flush out the list when an empty string is assigned.
2017-09-14 16:53:34 +02:00
Lennart Poettering 60c776fd75 Merge pull request #6746 from yuwata/parse-empty-string
allow to input empty string to config_parse_xxx()
2017-09-14 16:49:09 +02:00
Lennart Poettering 960d20e1a9 man: minor correction for systemd-run
The meaning was acidentally inverted in
156d6036be, let's correct this.
2017-09-14 15:45:21 +02:00
Lennart Poettering 96bedbe2e5 nspawn: replace syscall blacklist by a whitelist
Let's lock things down a bit, and maintain a list of what's permitted
rather than a list of what's prohibited in nspawn (also to make things a
bit more like Docker and friends).

Note that this slightly alters the effect of --system-call-filter=, as
now the negative list now takes precedence over the positive list.
However, given that the option is just a few days old and not included
in any released version it should be fine to change it at this point in
time.

Note that the whitelist is good chunk more restrictive thatn the
previous blacklist. Specifically:

- fanotify is not permitted (given the buffer size issues it's
  problematic in containers)
- nfsservctl is not permitted (NFS server support is not virtualized)
- pkey_xyz stuff is not permitted (really new stuff I don't grok)
- @cpu-emulation is prohibited (untested legacy stuff mostly, and if
  people really want to run dosemu in nspawn, they should use
  --system-call-filter=@cpu-emulation and all should be good)
2017-09-14 15:45:21 +02:00
Lennart Poettering cff7bff880 seccomp: improve debug logging
Let's log explicitly at debug level if we encounter a syscall or group
that doesn#t exist at all.
2017-09-14 15:45:21 +02:00
Lennart Poettering 25e94f8c75 tests: let's make sure the seccomp filter lists remain properly ordered
It's too easy to corrupt the order, hence let's check for the right
order automatically as part of testing.
2017-09-14 15:45:21 +02:00
Lennart Poettering cd0ddf6f75 seccomp: add four new syscall groups
These groups should be useful shortcuts for sets of closely related
syscalls where it usually makes more sense to allow them altogether or
not at all.
2017-09-14 15:45:21 +02:00
Lennart Poettering 0963c053fa seccomp: augment the @resources group a bit
Given that sched_setattr/sched_setparam/sched_setscheduler are already
in the group the closely related nice + ioprio_set should also be
included.

Also, order things alphabetically.
2017-09-14 15:45:21 +02:00
Lennart Poettering b887d2ebfe seccomp: beef up @process group a bit
Include the waid syscalls. If we permit forking then we should also
permit waiting for a process.

Similar to that: also permit determining the usage counters for
processes.

Include calls to determine process/thread identity. They have little
impact security-wise, but are very likely used when process management
of any form is done.

Also, add rt_sigqueueinfo + rt_tgsigqueueinfo as they are similar to
kill() and friends, but permit passing along a userdata ptr.
2017-09-14 15:45:21 +02:00
Lennart Poettering 7e0c3b8fda seccomp: "idle" is another obsolete syscall 2017-09-14 15:45:21 +02:00
Lennart Poettering 215728ff39 seccomp: order the syscalls in more groups alphabetically
No changes besides reordering.
2017-09-14 15:45:21 +02:00
Lennart Poettering ceaa6aa76b seccomp: let's update @file-system a bit
Let's add fremovexattr which was the only xattr syscall so far missing
from the group, even though lremovexattr and friends where included.

Add inotify_init, which is an older (but still supported) version of
inotify_init1.

Add oldfstat, oldlstat, oldstat which are old versions of the stat
syscalls on some archs.

Add utime, which is an older more limited version of utimes and
utimensat.

Enclose the "statx" entry in some ifdeffery to ensure libseccomp
actually knows the syscall. If libseccomp doesn't know it, then we'd get
EINVAL rather than EDOM (which is what is returned if a syscall is known
but not available on the local system) when resolving the syscall name
and we really don't want that, as we use the EDOM vs. EINVAL check for
determining whether a syscall makes sense at all.

Also, order things alphabetically.
2017-09-14 15:45:21 +02:00
Lennart Poettering 648a0ed0d7 seccomp: let's update base-io a bit
Let's add _llseek which is the syscall name on some archs that on others
is simply lseek (due to 64bit vs 32bit off_t confusion). Also, let's
sort things alphabetically.
2017-09-14 15:45:21 +02:00
Lennart Poettering e41b0f42a8 seccomp: update "@default" seccomp group a bit
Let's add more of the most basic operations to "@default" as absolute
baseline needed by glibc and such to operate. Specifically:

futex, get_robust_list, get_thread_area, membarrier, set_robust_list,
set_thread_area, set_tid_address are all required to properly implement
mutexes and other thread synchronization logic. Given that a ton of
datastructures are protected by mutexes (such as stdio and such), let's
just whitelist this by default, so that things can just work.

restart_syscall is used to implement EAGAIN SA_RESTART stuff in some
archs, and synthesized by the kernel without any explicit user logic,
hence let's make this work out of the box.
2017-09-14 15:45:21 +02:00
Lennart Poettering 1c68232ee2 core: rework how we treat specifiers in Environment= of transient units
Let's validate the data passed in after resolving specifiers, but let's
write out to the unit snippet the list without specifiers applied. This
way the pre-existing comment actually starts matching what is actually
implemented.
2017-09-14 15:17:40 +02:00
Lennart Poettering 41de9cc29e core: support specifier expansion in PassEnvironment=
I can't come up with any usecase for this, but let's add this here, to
match what we support for Environment=. It's kind surprising if we
support specifier expansion for some environment related settings, but
not for others.
2017-09-14 15:17:40 +02:00
Lennart Poettering f7f3f5c35c core: print the right string when we fail to replace specifiers in config_parse_environ() 2017-09-14 15:17:40 +02:00
Lennart Poettering 82f93439af units: properly unset the l10n environment variables where we need to
Now that we have UnsetEnvironment=, let's make proper use of it for
unsetting l10n settings for console gettys.

Fixes: #6407
2017-09-14 15:17:40 +02:00
Lennart Poettering 42cc99d5ec test: add test case for UnsetEnvironment= 2017-09-14 15:17:40 +02:00
Lennart Poettering 00819cc151 core: add new UnsetEnvironment= setting for unit files
With this setting we can explicitly unset specific variables for
processes of a unit, as last step of assembling the environment block
for them. This is useful to fix #6407.

While we are at it, greatly expand the documentation on how the
environment block for forked off processes is assembled.
2017-09-14 15:17:40 +02:00
Michael Grzeschik dbbf424c8b rules: ubi mtd - add link to named partitions (#6750)
[zjs:
- rebase onto recent master
- drop signed-off-by]
2017-09-14 14:53:07 +02:00
Lennart Poettering 3b22864e20 Merge pull request #6428 from boucman/device_reload
device : reload when udev generates a "changed" event
2017-09-14 12:46:23 +02:00
Zbigniew Jędrzejewski-Szmek 1b934761ae man: add a note about Name=eth0 being bad
Fixes #2657.
2017-09-14 12:13:31 +02:00
Zbigniew Jędrzejewski-Szmek 07970eecbf man: reformat table in sysusers.d(5)
I think it's quite a bit easier to read in this way.
2017-09-14 11:57:12 +02:00
Zbigniew Jędrzejewski-Szmek 8165be2edf man: unify titling, fix description of precedence in sysusers.d(5)
Fixes #6639.

(This behaviour of systemd-sysusers is long established, so it's better
to adjust the documentation rather than change the code. If there are any
situations out there where it matters, users must have adjusted to the
current behaviour.)
2017-09-14 11:55:57 +02:00