Commit graph

18061 commits

Author SHA1 Message Date
Lennart Poettering 701afcbf12 Merge pull request #6659 from yuwata/econnrefused
networkd: do not fail manager_connect_bus() if dbus is not active yet
2017-08-30 12:17:53 +02:00
Jon Ringle e4f05508ad networkd: Honor configured DHCP ClientIdentifier on link_update (#6622)
We have an embedded board with a couple of ethernet ports. From the kernel
log, I can see that the ethernet drivers are obtaining their correct MAC
address, but for some reason, at first systemd-networkd doesn't see the
mac address for the ethernet port at the time that it looks at
dhcp_client_identifier configuration (it has 00:00:00:00:00:00 for mac).

Later on, systemd-networkd gets a link_update() call, and at this time, it
has the correct mac address for the ethernet port. However, in link_update()
the dhcp_client_identifier configuration is not being considered, and a call
to sd_dhcp_client_set_iaid_duid() is being done always
2017-08-30 11:38:00 +02:00
Lennart Poettering 30495cb0a7 Merge pull request #6691 from yuwata/man-journal-remote2
journal-remote: small fixes
2017-08-30 11:31:37 +02:00
Lennart Poettering 6d405b6909 Merge pull request #6672 from yuwata/drop-priv
use !! prefix in networkd and timesyncd
2017-08-30 10:45:24 +02:00
g0tar 73e669e0fd terminal reset should honour default_utf8 kernel setting (#6606)
terminal reset should honour default_utf8 kernel setting
2017-08-30 10:00:44 +02:00
Yu Watanabe cb30d3ba66 journal-remote: show error if SplitMode=host with 'active' source is specified 2017-08-30 16:56:41 +09:00
Yu Watanabe 53d133ea1b timesync: move stamp file to /var/lib/systemd/timesync/clock 2017-08-30 15:59:57 +09:00
Lennart Poettering 40cdf0c962 Merge pull request #6585 from poettering/seccomp-lock-personality
Seccomp lock personality
2017-08-29 18:58:56 +02:00
Lennart Poettering b1a05d7320 Merge pull request #6677 from yuwata/man-journal-remote
journal-remote: improve man page and error message
2017-08-29 18:04:50 +02:00
Topi Miettinen 07ce74074d namespace: avoid assertion failure (#6649)
If the root image is not decrypted, it must not be relinquished.
2017-08-29 17:31:24 +02:00
Lennart Poettering 3167f78a11 core: open up LockPersonality= for transient units
Let's make "systemd-run -p LockPersonality=1 -t /bin/sh" work.
2017-08-29 15:58:13 +02:00
Lennart Poettering 72eafe7159 seccomp: rework seccomp_lock_personality() to apply filter to all archs 2017-08-29 15:58:13 +02:00
Lennart Poettering e8132d63fe seccomp: default to something resembling the current personality when locking it
Let's lock the personality to the currently set one, if nothing is
specifically specified. But do so with a grain of salt, and never
default to any exotic personality here, but only PER_LINUX or
PER_LINUX32.
2017-08-29 15:56:57 +02:00
Topi Miettinen 78e864e5b3 seccomp: LockPersonality boolean (#6193)
Add LockPersonality boolean to allow locking down personality(2)
system call so that the execution domain can't be changed.
This may be useful to improve security because odd emulations
may be poorly tested and source of vulnerabilities, while
system services shouldn't need any weird personalities.
2017-08-29 15:54:50 +02:00
Lennart Poettering 54d564a212 Merge pull request #6636 from sourcejedi/fsync
"Don't fear the fsync()"
2017-08-29 15:19:44 +02:00
Alan Jenkins 265710c205 fileio: rename function parameter to avoid masking global symbol
> glibc exports a function called sync(), we should probably avoid
> overloading that as a variable here locally (gcc even used to warn about
> that, not sure why it doesn't anymore), to avoid confusion around what
> "if (sync)" actually means
2017-08-29 10:56:32 +01:00
Felipe Sateler 4f5993c3f4 shared: Add a linker script so that all functions are tagget @SD_SHARED instead of @Base (#6669)
This helps prevent symbol collisions with other programs and libraries. In particular,
because PAM modules are loaded into the process that is creating the session, and
systemd creates PAM sessions, the potential for collisions is high.

Disambiguate all systemd calls by tagging a 'version' SD_SHARED.

Fixes #6624
2017-08-28 18:49:03 +02:00
vliaskov 6c24adfd46 Revert "mount-setup: mount xenfs filesystem (#6491)" (#6662)
This reverts commit b305bd3aab.
2017-08-28 18:46:01 +02:00
Jason Gunthorpe 5570d7f956 Support 'rdma' as a ListenNetlink= argument (#6626)
NETLINK_RDMA has been in the kernel since v3.0.
2017-08-28 17:22:10 +02:00
Yu Watanabe 6b1b9f75c8 journal-remote: show error message if output file name does not end with .journal
`journalctl -o export | systemd-journal-remote -o /tmp/dir -`
gives the following error messages.
```
Failed to open output journal /tmp/dir: Invalid argument
Failed to get writer for source stdin: Invalid argument
Failed to create source for fd:0 (stdin): Invalid argument
```
And these are hard to understand what is the problem.
This commit makes journal-remote check whether the output file name
ends with .journal suffix or not, and if not, output error message.
2017-08-27 16:34:57 +09:00
Yu Watanabe 87a85e25a2 units: make use of !! ExecStart= prefix in systemd-timesyncd.service
Let's make use of !! to run timesyncd with ambient capabilities on
systems supporting them.
2017-08-27 01:41:12 +09:00
Yu Watanabe c61f302d3c units: make use of !! ExecStart= prefix in systemd-networkd.service
Let's make use of !! to run networkd with ambient capabilities on
systems supporting them.
2017-08-27 01:40:47 +09:00
Evgeny Vereshchagin 0c700d392d build-sys: fix the script used for generating load_fragment_gperf_nulstr (#6646)
This prevents `systemd --dump-configuration-items` from crashing.
Closes #6596.
2017-08-26 23:21:23 +09:00
Lennart Poettering 2e681921c9 logind: make sure we don't process the same method call twice (#6583)
Tiny mistake, big effect.

Fixes: #6375
2017-08-26 22:19:26 +09:00
Yu Watanabe 5ce96b141a Merge pull request #6582 from poettering/logind-tty
various tty path parsing fixes
2017-08-26 22:12:48 +09:00
Lennart Poettering 0f52f8e552 core: disable the effect of Restart= if there's a stop job pending for a service (#6581)
We shouldn't undo the job already enqueued, under any circumstances.

Fixes: #6504
2017-08-26 22:07:23 +09:00
Yu Watanabe 2c5ad0fd6d Merge pull request #6577 from poettering/more-exec-flags
add ! and !! ExecStart= flags to make ambient caps useful
2017-08-26 21:49:05 +09:00
Michal Sekletar b58aeb70db service: attempt to execute next main command only for oneshot services (#6619)
This commit fixes crash described in
https://github.com/systemd/systemd/issues/6533

Multiple ExecStart lines are allowed only for oneshot services
anyway so it doesn't make sense to call service_run_next_main() with
services of type other than SERVICE_ONESHOT.

Referring back to reproducer from the issue, previously we didn't observe
this problem because s->main_command was reset after daemon-reload hence
we never reached the assert statement in service_run_next_main().

Fixes #6533
2017-08-25 16:36:10 +03:00
Yu Watanabe d7ea7bb8a8 network,resolve: remove comments related to kdbus 2017-08-23 12:42:35 +09:00
Yu Watanabe fb72b1d99f networkd: do not fail manager_connect_bus() if dbus is not active yet
Fixes #6618.
2017-08-23 12:42:22 +09:00
Alan Jenkins 0675e94ab5 "Don't fear the fsync()"
For files which are vital to boot

1. Avoid opening any window where power loss will zero them out or worse.
   I know app developers all coded to the ext3 implementation, but
   the only formal documentation we have says we're broken if we actually
   rely on it.  E.g.

   * `man mount`, search for `auto_da_alloc`.
   * http://www.linux-mtd.infradead.org/faq/ubifs.html#L_atomic_change
   * https://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/

2. If we tell the kernel we're interested in writing them to disk, it will
   tell us if that fails.  So at minimum, this means we play our part in
   notifying the user about errors.

I refactored error-handling in `udevadm-hwdb` a little.  It turns out I did
exactly the same as had already been done in the `systemd-hwdb` version,
i.e. commit d702dcd.
2017-08-17 20:26:36 +01:00
Alan Jenkins dce892acef localed: don't remove xorg.conf.d/00-keyboard.conf on failures
One of the benefits of updating a file "atomically", is to avoid losing the
old version.  For example, if we run out of disk space half-way through.

Fix localed to enjoy this benefit.
2017-08-17 17:21:47 +01:00
Susant Sahani 499d555a79 networkd: fix spell DCHPClientIdentifier (DCHP => DHCP) 2017-08-15 10:20:25 +05:30
Lennart Poettering 635f3df5dc units: make use of the new !! ExecStart= prefix in systemd-resolved.service
Let's make use of !! to run resolved with ambient capabilities on
systems supporting them.
2017-08-10 15:04:32 +02:00
Lennart Poettering 165a31c0db core: add two new special ExecStart= character prefixes
This patch adds two new special character prefixes to ExecStart= and
friends, in addition to the existing "-", "@" and "+":

"!"  → much like "+", except with a much reduced effect as it only
       disables the actual setresuid()/setresgid()/setgroups() calls, but
       leaves all other security features on, including namespace
       options. This is very useful in combination with
       RuntimeDirectory= or DynamicUser= and similar option, as a user
       is still allocated and used for the runtime directory, but the
       actual UID/GID dropping is left to the daemon process itself.
       This should make RuntimeDirectory= a lot more useful for daemons
       which insist on doing their own privilege dropping.

"!!" → Similar to "!", but on systems supporting ambient caps this
       becomes a NOP. This makes it relatively straightforward to write
       unit files that make use of ambient capabilities to let systemd
       drop all privs while retaining compatibility with systems that
       lack ambient caps, where priv dropping is the left to the daemon
       codes themselves.

This is an alternative approach to #6564 and related PRs.
2017-08-10 15:04:32 +02:00
Lennart Poettering 39f608e4b0 capability: add new ambient_capabilities_supported() helper
This new function reports whether ambient caps are available, and should
be quick because the result is cached.
2017-08-10 15:02:50 +02:00
Lennart Poettering 6067611a08 capability: change capability_bounding_set_drop() to be work without privileges when executing a NOP
This way daemons which already dropped all caps may use the call to
drop priviliges again, which becomes a non-failing NOP.
2017-08-10 15:02:50 +02:00
Lennart Poettering 6eaaeee93a seccomp: add new @setuid seccomp group
This new group lists all UID/GID credential changing syscalls (which are
quite a number these days). This will become particularly useful in a
later commit, which uses this group to optionally permit user credential
changing to daemons in case ambient capabilities are not available.
2017-08-10 15:02:50 +02:00
Lennart Poettering 8f2c2f20b6 mkdir: chmod_and_chown() returns errors as "return -errno", not in errno itself 2017-08-10 15:02:50 +02:00
Lennart Poettering 43b1f7092d execute: needs_{selinux,apparmor,smack} → use_{selinux,apparmor,smack}
These booleans simply store whether selinux/apparmor/smack are supposed
ot be used, and chache the various mac_xyz_use() calls before we
transition into the namespace, hence let's use the same verb for the
variables and the functions: "use"
2017-08-10 15:02:50 +02:00
Lennart Poettering 9f6444eb92 execute: make use of IN_SET() where we can 2017-08-10 15:02:50 +02:00
Lennart Poettering 937ccce94c execute: simplify needs_sandboxing checking
Let's merge three if blocks that shall only run when sandboxing is applied
into one.

Note that this changes behaviour in one corner case: PrivateUsers=1 is
now honours both PermissionsStartOnly= and the "+" modifier in
ExecStart=, and not just the former, as before. This was an oversight,
so let's fix this now, at a point in time the option isn't used much
yet.
2017-08-10 15:02:50 +02:00
Lennart Poettering 1703fa41a7 core: rename EXEC_APPLY_PERMISSIONS → EXEC_APPLY_SANDBOXING
"Permissions" was a bit of a misnomer, as it suggests that UNIX file
permission bits are adjusted, which aren't really changed here. Instead,
this is about UNIX credentials such as users or groups, as well as
namespacing, hence let's use a more generic term here, without any
misleading reference to UNIX file permissions: "sandboxing", which shall
refer to all kinds of sandboxing technologies, including UID/GID
dropping, selinux relabelling, namespacing, seccomp, and so on.
2017-08-10 15:02:50 +02:00
Lennart Poettering f0d477979e core: introduce unit_set_exec_params()
The new unit_set_exec_params() call is to units what
manager_set_exec_params() is to the manager object: it initializes the
various fields from the relevant generic properties set.
2017-08-10 15:02:50 +02:00
Lennart Poettering 19bbdd985e core: manager_set_exec_params() cannot fail, hence make it void
Let's simplify things a bit.
2017-08-10 15:02:50 +02:00
Lennart Poettering 584b8688d1 execute: also fold the cgroup delegate bit into ExecFlags 2017-08-10 15:02:50 +02:00
Lennart Poettering ac6479781e execute: also control the SYSTEMD_NSS_BYPASS_BUS through an ExecFlags field
Also, correct the logic while we are at it: the variable is only
required for system services, not user services.
2017-08-10 15:02:49 +02:00
Lennart Poettering 5bf7569cf8 service: let's set EXEC_NEW_KEYRING through SET_FLAG()
Not that it really matters, but it matches how we set the flags in
manager_set_exec_params() too.
2017-08-10 15:02:49 +02:00
Lennart Poettering c71b2eb77e core: don't chown() the configuration directory
The configuration directory is commonly not owned by a service, but
remains root-owned, hence don't change the owner automatically for it.
2017-08-10 15:02:49 +02:00
Lennart Poettering 8679efde21 execute: add one more ExecFlags flag, for controlling unconditional directory chowning
Let's decouple the Manager object from the execution logic a bit more
here too, and simply pass along the fact whether we should
unconditionally chown the runtime/... directories via the ExecFlags
field too.
2017-08-10 14:44:58 +02:00