Commit Graph

44143 Commits

Author SHA1 Message Date
Franck Bui 5e37d1930b pid1: by default make user units inherit their umask from the user manager
This patch changes the way user managers set the default umask for the units it
manages.

Indeed one can expect that if user manager's umask is redefined through PAM
(via /etc/login.defs or pam_umask), all its children including the units it
spawns have their umask set to the new value.

Hence make user units inherit their umask value from their parent instead of
the hard coded value 0022 but allow them to override this value via their unit
file.

Note that reexecuting managers with 'systemctl daemon-reexec' after changing
UMask= has no effect. To take effect managers need to be restarted with
'systemct restart' instead. This behavior was already present before this
patch.

Fixes #6077.
2020-04-09 14:17:07 +02:00
Zbigniew Jędrzejewski-Szmek b94fb74bae manager: also log at debug level failure to read oom_score_adj 2020-04-09 14:08:48 +02:00
Zbigniew Jędrzejewski-Szmek ad21e542b2 manager: add CoredumpFilter= setting
Fixes #6685.
2020-04-09 14:08:48 +02:00
Lennart Poettering 4d1f2c621f
Merge pull request #15345 from keszybz/systemctl-show-spaces
Show Environment= entries with spaces in systemctl
2020-04-09 13:55:35 +02:00
Zbigniew Jędrzejewski-Szmek b34612bd5a Add parser and printer for coredump filter mask 2020-04-09 12:51:41 +02:00
Lennart Poettering 0be94a199e homed: when creating home directory as btrfs inside luks volume, place subvol inside it
When managing a home directory as LUKS image we currently place a
directory at the top that contains the actual home directory (so that
the home directory of the user won't be cluttered by lost-found and
suchlike). On btrfs let's make that a subvol though. This is a good idea
so that possibly later on we can make use of this for automatic history
management.

Fixes: #15121
2020-04-09 12:13:11 +02:00
Lennart Poettering 82c4440ddd import: use our new btrfs_subvol_make_fallback() at two places 2020-04-09 12:13:08 +02:00
Lennart Poettering d78a95d751 btrfs-util: define helper that creates a btrfs subvol if we can, and a directory as fallback 2020-04-09 12:12:52 +02:00
Luca Boccassi a1db42eb0b man: add missing varname around keywords in systemd.unit.xml 2020-04-09 11:55:07 +02:00
Luca Boccassi fe78538cab man: explicitly note that ExecSt*Post does count for After/Before ordering 2020-04-09 11:39:31 +02:00
Zbigniew Jędrzejewski-Szmek ce51632a35 basic/parse-util: add safe_atoux64() 2020-04-09 11:29:55 +02:00
Lennart Poettering 0ed4b54e05 sleep: improve log msg slightly
Let's make the log msgs a bit longer, to make clearer what is going on
here...

Prompted bymy attempts to debug #15354
2020-04-09 10:17:54 +02:00
Zbigniew Jędrzejewski-Szmek 302dc5b913
Merge pull request #15368 from poettering/color-fix
minor terminal ansi color seq fixes
2020-04-09 10:17:18 +02:00
Wen Yang f74349d88b mount-setup: change the system mount propagation to shared by default only at bootup
The commit b3ac5f8cb9 has changed the system mount propagation to
shared by default, and according to the following patch:
https://github.com/opencontainers/runc/pull/208
When starting the container, the pouch daemon will call runc to execute
make-private.

However, if the systemctl daemon-reexec is executed after the container
has been started, the system mount propagation will be changed to share
again by default, and the make-private operation above will have no chance
to execute.
2020-04-09 10:14:20 +02:00
Zbigniew Jędrzejewski-Szmek 241c4b6ada systemctl: show Environment entries with whitespace
This makes the Environment entries more round-trippable: a similar format is
used for input and output. It is certainly more useful for users, because
showing [unprintable] on anything non-trivial makes systemctl show -p Environment
useless in many cases.

Fixes: #14723 and https://bugzilla.redhat.com/show_bug.cgi?id=1525593.

$ systemctl --user show -p Environment run-*.service
Environment=ASDF=asfd "SPACE= "
Environment=ASDF=asfd "SPACE=\n\n\n"
Environment=ASDF=asfd "TAB=\t\\" "FOO=X X"
2020-04-09 09:58:17 +02:00
Zbigniew Jędrzejewski-Szmek 2b99f645c6 shared/escape: add new escape style with \n\t escaped 2020-04-09 09:58:10 +02:00
Zbigniew Jędrzejewski-Szmek ca03142040
Merge pull request #15331 from vcaputo/busdpi
bus: introduce some sd-bus convenience helpers
2020-04-09 09:32:58 +02:00
Marc-André Lureau 2c7039b316 systemd-run: add --slice-inherit
Add a new option to easily place a slice within the systemd-run slice.
2020-04-09 09:32:37 +02:00
Lennart Poettering ba45534917 man: correct the default slice for systemd-run units
As suggested in #15362
2020-04-09 09:32:13 +02:00
Lennart Poettering 876acda0ed
Merge pull request #15234 from ssahani/mud-lldp
LLDP : Introduce Manufacturer Usage Description (MUD)
2020-04-09 09:03:47 +02:00
Lennart Poettering a45aced09a test-terminal-util: fix typo 2020-04-08 19:45:08 +02:00
Lennart Poettering a851ba0795 terminal-util: fixate underlined yellow color too
non-underlined yellow uses RGB ANSI sequences while the underlined
version uses the paletted ANSI sequences. Let's unify that and use the
RGB sequence for both cases, so that underlined or not doesn't alter the
color.
2020-04-08 19:43:44 +02:00
Lennart Poettering ad313ec33b catalog: add entry for SD_MESSAGE_UNSAFE_USER_NAME 2020-04-08 17:30:04 +02:00
Lennart Poettering 887a8fa341 docs: hook up the new USER_NAMES document everywhere
(Also correct the set of names we accept in User=, which was forgotten
to be updated in ae480f0b09.
2020-04-08 17:30:04 +02:00
Lennart Poettering cafed7b32c docs: add a longer document explaining our rules on user/group names 2020-04-08 17:30:04 +02:00
Lennart Poettering 7a8867abfa user-util: rework how we validate user names
This reworks the user validation infrastructure. There are now two
modes. In regular mode we are strict and test against a strict set of
valid chars. And in "relaxed" mode we just filter out some really
obvious, dangerous stuff. i.e. strict is whitelisting what is OK, but
"relaxed" is blacklisting what is really not OK.

The idea is that we use strict mode whenver we allocate a new user
(i.e. in sysusers.d or homed), while "relaxed" mode is when we process
users registered elsewhere, (i.e. userdb, logind, …)

The requirements on user name validity vary wildly. SSSD thinks its fine
to embedd "@" for example, while the suggested NAME_REGEX field on
Debian does not even allow uppercase chars…

This effectively liberaralizes a lot what we expect from usernames.

The code that warns about questionnable user names is now optional and
only used at places such as unit file parsing, so that it doesn't show
up on every userdb query, but only when processing configuration files
that know better.

Fixes: #15149 #15090
2020-04-08 17:11:20 +02:00
Lennart Poettering 2aea5883f1 userdbctl: drop redundant user name validity check
The userdb_by_name() invocation immediately following does the same check
anyway, no need to do this twice.

(Also, make sure we exit the function early on failure)
2020-04-08 16:48:54 +02:00
Lennart Poettering b0c1a07654 units: make sure systemd-pstore stops at shutdown
This doesn't matter too much given that the service doesn't do anything
on shutdown, but let's still stop it to make things cleaner.
2020-04-08 16:29:58 +02:00
Lennart Poettering e0f968ad96 units: drop systemd-remount-fs.service dependency from more services
All services using StateDirectory= don't need the explicit dep anymore,
let's hence drop it everywhere.
2020-04-08 16:29:41 +02:00
Lennart Poettering 0c978faa16 units: drop dependency on systemd-remount-fs.service from systemd-pstore.service
This dependency is now generated automatically given we use
StateDirectory=. Moreover the combination of Wants= and After= was too
strong anway, as whether remount-fs is pulled in or not should not be up
to systemd-pstore.service, and in fact is part of the initial
transaction anyway.
2020-04-08 16:29:40 +02:00
Lennart Poettering f3b7a79b97 core: automatically add dependency on systemd-remount-fs.service if StateDirectory= is used
And similar for other settings that require a writable /var/.

Rationale: if these options are used for early-boot services (such as
systemd-pstore.service) we need /var/ writable. And if /var/ is on the
root fs, then systemd-remount-fs.service is the service that ensures
that /var/ is writable.

This allows us to remove explicit deps in services such as
systemd-pstore.service.
2020-04-08 16:29:25 +02:00
Lennart Poettering 167241912f units: pull in systemd-pstore.service from sysinit.target
sysinit.target is the target our early boot services are generally
pulled in from, make systemd-pstore.service not an exception of that.

Effectively this doesn't mean much, either way our unit is part of the
initial transaction.
2020-04-08 16:29:24 +02:00
Frantisek Sumsal e00e2e0b50 test: wait a bit after stopping the test service
Give systemd a chance to process the stop event before checking if the
PID has indeed leaked. This should fix the intermittent test fails in CI
even with a fixed systemd version, like this one:

```
Apr 08 10:22:09 testsuite-47.sh[345]: ++ cat /leakedtestpid
Apr 08 10:22:09 testsuite-47.sh[334]: + leaked_pid=342
Apr 08 10:22:09 testsuite-47.sh[334]: + systemctl stop testsuite-47-repro
Apr 08 10:22:10 testsuite-47.sh[334]: + ps -p 342
Apr 08 10:22:10 testsuite-47.sh[348]:     PID TTY          TIME CMD
Apr 08 10:22:10 testsuite-47.sh[348]:     342 ?        00:00:00 sleep
Apr 08 10:22:10 testsuite-47.sh[334]: + exit 42
```

Followup to 197298ff9f
2020-04-08 12:15:52 +02:00
Anita Zhang 8ff8ce6284
Merge pull request #15358 from poettering/preset-clean-up
preset: let's clean up preset list a bit
2020-04-07 17:52:45 -07:00
Susant Sahani e9a8c550c1 LLDP: Add support to transmit MUD URL 2020-04-08 00:20:54 +02:00
Lennart Poettering 9e27fd321c preset: let's clean up preset list a bit
let's make sure we list all singleton units we define in the preset
list, either as disable or as enable. Only four were missing, let's add
them in.

Also, let's group the pstore one with the other ones that are enabled,
right at the top.
2020-04-07 19:01:00 +02:00
Susant Sahani f69b4ae885 sd-lldp: Add support to receive MUD 2020-04-07 17:17:29 +02:00
Lennart Poettering 9afe05c149
Merge pull request #14930 from tomhughes/dnssec-canonicalise
Canonicalise names in DNS responses per RFC4034 requirements
2020-04-07 17:07:04 +02:00
Topi Miettinen cabc1c6d7a units: add ProtectClock=yes
Add `ProtectClock=yes` to systemd units. Since it implies certain
`DeviceAllow=` rules, make sure that the units have `DeviceAllow=` rules so
they are still able to access other devices. Exclude timesyncd and timedated.
2020-04-07 15:37:14 +02:00
Zbigniew Jędrzejewski-Szmek c3362c2f97 Remove message->priority field
A warning is emitted from sd_bus_message_{get,set}_priority. Those functions
are exposed by pystemd, so we have no easy way of checking if anything is
calling them.

Just making the functions always return without doing anything would be an
option, but then we could leave the caller with an undefined variable. So I
think it's better to make the functions emit a warnings and return priority=0
in the get operation.
2020-04-07 15:29:23 +02:00
Zbigniew Jędrzejewski-Szmek 6635f57d3e sysctl: enable coredump for suid binaries
Right now the kernel will not dump anything that went through setuid or
setgid. But it is routine for daemons to do that, and it makes things hard to
debug.

systemd-coredump saves the coredump readable by the users the process was
running as. This should be enough to avoid information leakage. So let's also
tell the kernel to do the coredump.

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

Both patterns are stored in the same file, so they are enabled or disabled
together. (Though suid_dumpable=2 is supposed to be safe even when writing to
plain files.)
2020-04-07 15:28:46 +02:00
root f9d29f6d06 fix manager_state 2020-04-07 15:27:50 +02:00
Hans de Goede e6b68254c2 hwdb: Add accel orientation quirk for MPMAN MPWIN895CL tablet
Add a quirk to fix the accelerometer orientation on the MPMAN MPWIN895CL
tablet.
2020-04-07 14:23:31 +02:00
Lennart Poettering 602235f27d
Merge pull request #15349 from keszybz/doc-work
Remove stray file and fix two minor issues in man pages
2020-04-07 14:10:56 +02:00
Zbigniew Jędrzejewski-Szmek 9aa822179b man: update rules
Apparently this step was forgotten in 935052a8aa.
2020-04-06 20:47:14 +02:00
Zbigniew Jędrzejewski-Szmek 326b1f897b Remove stray file 2020-04-06 20:45:41 +02:00
Zbigniew Jędrzejewski-Szmek bb288a2cb3 man: drop apostophe from section title
For whatever reason, this does not get rendered propely in the man
page and results in an invalid code:
W: manual-page-warning /usr/share/man/man7/systemd.special.7.gz 103: warning: macro `AQ' not defined

We say 'user manager' and 'system manager' in most other places, so let's just
use this form here too.
2020-04-06 20:45:41 +02:00
Marcel Holtmann 9fac14980d hwdb: Update database of Bluetooth company identifiers 2020-04-05 10:01:14 +02:00
Vito Caputo 219ab1fbd0 bus: introduce some sd-bus convenience helpers
Many of the convenience functions from sd-bus operate on verbose sets
of discrete strings for destination/path/interface/member.

For most callers, destination/path/interface are uniform, and just the
member is distinct.

This commit introduces a new struct encapsulating the
destination/path/interface pointers called BusAddress, and wrapper
functions which take a BusAddress* instead of three strings, and just
pass the encapsulated strings on to the sd-bus convenience functions.

Future commits will update call sites to use these helpers throwing
out a bunch of repetitious destination/path/interface strings littered
throughout the codebase, replacing them with some appropriately named
static structs passed by pointer to these new helpers.
2020-04-04 13:38:58 -07:00
Evgeny Vereshchagin 3c2a50c945 oss-fuzz: point the badge directly to our logs 2020-04-04 19:41:33 +02:00