platform/upstream/systemd.git
4 years agoid128: fix initializer element is not constant
Anita Zhang [Wed, 20 Nov 2019 05:50:51 +0000 (21:50 -0800)]
id128: fix initializer element is not constant

Was getting:

  ../src/id128/id128.c:15:1: error: initializer element is not constant
   static sd_id128_t arg_app = SD_ID128_NULL;
    ^
when building on CentOS 7.

Other parts of the code initialize `static sd_id128_t` to {} and this
was the original setting before a19fdd66c22 anyways.

4 years agotest: make sure our tests get exclusive TTY access
Lennart Poettering [Tue, 19 Nov 2019 17:54:47 +0000 (18:54 +0100)]
test: make sure our tests get exclusive TTY access

This sould make our test suite a bit more robust if it is slow running.
A few of our test services use StandardOutput=tty or StandardError=tty
in the tests in order to connect test services to the container console.
This gets into conflict with the container getty which wants exclusive
access to the console. Since the container getty is started with
Type=idle it typically gets started after a timeout only if the TTY is
already used, which hence introduces a race: if the test finishes
earlier all is good, if not, then the test gets kicked off the TTY which
then causes bash to abort since it cannot write any error messages
anymore.

Let's fix this hence: all tests that connect to the tty are now
synchronized to getty-pre.target, so they finish before any getty is
started.

4 years agoMerge pull request #14085 from poettering/ask-password-api
Lennart Poettering [Tue, 19 Nov 2019 23:54:28 +0000 (00:54 +0100)]
Merge pull request #14085 from poettering/ask-password-api

make sure asking for a pw works in a container too if keyctl() and friends are blocked

4 years agopam_systemd: prolong method call timeout when allocating session
Lennart Poettering [Mon, 19 Aug 2019 13:15:13 +0000 (15:15 +0200)]
pam_systemd: prolong method call timeout when allocating session

Starting a session might involve starting the user@.service instance,
hence let's make the bus call timeout substantially longer.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=83828

4 years agoMerge pull request #14078 from poettering/cryptsetup-fixlets
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2019 19:46:53 +0000 (20:46 +0100)]
Merge pull request #14078 from poettering/cryptsetup-fixlets

trivial cryptsetup fixlets (mostly: use more STR_IN_SET())

4 years agoMerge pull request #14079 from poettering/pam-systemd-fixlets
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2019 19:45:15 +0000 (20:45 +0100)]
Merge pull request #14079 from poettering/pam-systemd-fixlets

trivial pam_systemd fixlets

4 years agoudev: do not propagate error in executing PROGRAM and IMPORT{program}
Yu Watanabe [Mon, 18 Nov 2019 11:56:33 +0000 (20:56 +0900)]
udev: do not propagate error in executing PROGRAM and IMPORT{program}

Also, this adds more logs.

Fixes #14027.

4 years agoask-password: skip kernel keyring logic if we see EPERM
Lennart Poettering [Tue, 19 Nov 2019 17:47:31 +0000 (18:47 +0100)]
ask-password: skip kernel keyring logic if we see EPERM

Let's improve compat with container managers that block the keyring
logic and return EPERM for them.

4 years agoerrno: add new ERRNO_IS_NOT_SUPPORTED() helper
Lennart Poettering [Mon, 15 Jul 2019 11:32:03 +0000 (13:32 +0200)]
errno: add new ERRNO_IS_NOT_SUPPORTED() helper

4 years agoupdate TODO
Lennart Poettering [Tue, 19 Nov 2019 14:42:55 +0000 (15:42 +0100)]
update TODO

4 years agoMerge pull request #14080 from poettering/table-uid-pid
Zbigniew Jędrzejewski-Szmek [Tue, 19 Nov 2019 14:35:25 +0000 (15:35 +0100)]
Merge pull request #14080 from poettering/table-uid-pid

format-table: introduce TABLE_UID/TABLE_GID to match TABLE_PID and use it

4 years agocryptsetup: use STR_IN_SET() where appropriate
Lennart Poettering [Wed, 21 Aug 2019 08:45:42 +0000 (10:45 +0200)]
cryptsetup: use STR_IN_SET() where appropriate

Note that this slightly changes behaviour: "none" is only allowed as
option, if it's the only option specified, but not in combination with
other options. I think this makes more sense, since it's the choice when
no options shall be specified.

4 years agocryptsetup: minor coding style clean-ups
Lennart Poettering [Wed, 21 Aug 2019 08:40:04 +0000 (10:40 +0200)]
cryptsetup: minor coding style clean-ups

4 years agopam_systemd: add one more assert
Lennart Poettering [Tue, 13 Aug 2019 12:14:42 +0000 (14:14 +0200)]
pam_systemd: add one more assert

4 years agopam_systemd: don't use PAM_SYSTEM_ERR for something that isn't precisely a system...
Lennart Poettering [Tue, 13 Aug 2019 12:14:47 +0000 (14:14 +0200)]
pam_systemd: don't use PAM_SYSTEM_ERR for something that isn't precisely a system error

It's not really clear which PAM errors to use for which conditions, but
something called PAM_SYSTEM_ERR should probably not be used when the
error is not the result of some system call failure.

4 years agopam-systemd: voidify pam_get_item() calls
Lennart Poettering [Mon, 12 Aug 2019 14:39:55 +0000 (16:39 +0200)]
pam-systemd: voidify pam_get_item() calls

4 years agopam-systemd: remove duplicate error logging
Lennart Poettering [Mon, 12 Aug 2019 14:39:40 +0000 (16:39 +0200)]
pam-systemd: remove duplicate error logging

4 years agologin: port tables over to use TABLE_UID/TABLE_PID
Lennart Poettering [Wed, 7 Aug 2019 12:50:01 +0000 (14:50 +0200)]
login: port tables over to use TABLE_UID/TABLE_PID

4 years agoformat-table: add UID/GID output support to format-table.h
Lennart Poettering [Wed, 7 Aug 2019 10:50:42 +0000 (12:50 +0200)]
format-table: add UID/GID output support to format-table.h

4 years agopam-systemd: include PAM error code in all our log messages where that makes sense
Lennart Poettering [Mon, 12 Aug 2019 14:38:21 +0000 (16:38 +0200)]
pam-systemd: include PAM error code in all our log messages where that makes sense

4 years agoNEWS: SendRawOption= -> SendOption=
Yu Watanabe [Tue, 19 Nov 2019 10:28:07 +0000 (19:28 +0900)]
NEWS: SendRawOption= -> SendOption=

4 years agoMerge pull request #14064 from yuwata/network-unify-send-option-and-send-raw-option
Zbigniew Jędrzejewski-Szmek [Mon, 18 Nov 2019 21:21:37 +0000 (22:21 +0100)]
Merge pull request #14064 from yuwata/network-unify-send-option-and-send-raw-option

network: unify SendOption= and SendRawOption=

4 years agoMerge pull request #14030 from keszybz/path-no-trigger
Zbigniew Jędrzejewski-Szmek [Mon, 18 Nov 2019 21:20:07 +0000 (22:20 +0100)]
Merge pull request #14030 from keszybz/path-no-trigger

Fix spurious triggering of PathExists=

4 years agoMerge pull request #14007 from keszybz/tasks-max-dynamic
Zbigniew Jędrzejewski-Szmek [Mon, 18 Nov 2019 21:18:33 +0000 (22:18 +0100)]
Merge pull request #14007 from keszybz/tasks-max-dynamic

Calculate fractional TasksMax= before actual use

4 years agoman: add entry about SpeedMeter=
Yu Watanabe [Mon, 18 Nov 2019 15:03:35 +0000 (00:03 +0900)]
man: add entry about SpeedMeter=

Closes #14002.

4 years agoudev: silence warning about PROGRAM+= or IMPORT+= rules
Yu Watanabe [Mon, 18 Nov 2019 10:28:11 +0000 (19:28 +0900)]
udev: silence warning about PROGRAM+= or IMPORT+= rules

Closes #14062.

4 years agoman: add entry for systemd-id128 --uuid
Zbigniew Jędrzejewski-Szmek [Mon, 18 Nov 2019 14:24:23 +0000 (15:24 +0100)]
man: add entry for systemd-id128 --uuid

4 years agoudevadm: ignore EROFS and return earlier
Yu Watanabe [Mon, 18 Nov 2019 09:47:16 +0000 (18:47 +0900)]
udevadm: ignore EROFS and return earlier

Fixes #14060.

4 years agonetwork: unify config_parse_dhcp_server_option_data() and config_parse_dhcp_send_option()
Yu Watanabe [Mon, 18 Nov 2019 09:29:29 +0000 (18:29 +0900)]
network: unify config_parse_dhcp_server_option_data() and config_parse_dhcp_send_option()

4 years agodhcp: remove struct sd_dhcp_raw_option
Yu Watanabe [Mon, 18 Nov 2019 09:14:18 +0000 (18:14 +0900)]
dhcp: remove struct sd_dhcp_raw_option

sd_dhcp_raw_option and sd_dhcp_option are essentially equivalent.

4 years agonetwork: rename SendRawOption= to SendOption=
Yu Watanabe [Mon, 18 Nov 2019 08:33:58 +0000 (17:33 +0900)]
network: rename SendRawOption= to SendOption=

As DHCPv4.SendOption= and DHCPServer.SendRawOption= take the same
format.

4 years agoMerge pull request #14040 from poettering/root-mount-deps
Zbigniew Jędrzejewski-Szmek [Mon, 18 Nov 2019 14:29:35 +0000 (15:29 +0100)]
Merge pull request #14040 from poettering/root-mount-deps

root mount dep fixes

4 years agonetwork: add more error logs
Yu Watanabe [Sun, 17 Nov 2019 13:39:42 +0000 (22:39 +0900)]
network: add more error logs

4 years agoMerge pull request #14046 from poettering/id128-uuid
Zbigniew Jędrzejewski-Szmek [Mon, 18 Nov 2019 14:19:43 +0000 (15:19 +0100)]
Merge pull request #14046 from poettering/id128-uuid

add "-u" switch to systemd-uuid for outputting ids in UUID format

4 years agotree-wide: clean up --help texts a bit
Lennart Poettering [Fri, 15 Nov 2019 17:38:44 +0000 (18:38 +0100)]
tree-wide: clean up --help texts a bit

This cleans up and unifies the outut of --help texts a bit:

1. Highlight the human friendly description string, not the command
   line via ANSI sequences. Previously both this description string and
   the brief command line summary was marked with the same ANSI
   highlight sequence, but given we auto-page to less and less does not
   honour multi-line highlights only the command line summary was
   affectively highlighted. Rationale: for highlighting the description
   instead of the command line: the command line summary is relatively
   boring, and mostly the same for out tools, the description on the
   other hand is pregnant, important and captions the whole thing and
   hence deserves highlighting.

2. Always suffix "Options" with ":" in the help text

3. Rename "Flags" →  "Options" in one case

4. Move commands to the top in a few cases

5. add coloring to many more help pages

6. Unify on COMMAND instead of {COMMAND} in the command line summary.
   Some tools did it one way, others the other way. I am not sure what
   precisely {} is supposed to mean, that uppercasing doesn't, hence
   let's simplify and stick to the {}-less syntax

And minor other tweaks.

4 years agocore/path: fix spurious triggering of PathExists= on restart/reload
Zbigniew Jędrzejewski-Szmek [Mon, 18 Nov 2019 13:20:05 +0000 (14:20 +0100)]
core/path: fix spurious triggering of PathExists= on restart/reload

Our handling of the condition was inconsistent. Normally, we'd only fire when
the file was created (or removed and subsequently created again). But on restarts,
we'd do a "recheck" from path_coldplug(), and if the file existed, we'd
always trigger. Daemon restarts and reloads should not be observeable, in
the sense that they should not trigger units which were already triggered and
would not be started again under normal circumstances.

Note that the mechanism for checks is racy: we get a notification from inotify,
and by the time we check, the file could have been created and removed again,
or removed and created again. It would be better if we inotify would give as
an unambiguous signal that the file was created, but it doesn't: IN_DELETE_SELF
triggers on inode removal, not directory entry, so we need to include IN_ATTRIB,
which obviously triggers on other conditions.

Fixes #12801.

4 years agocore/path: serialize the previous_exists state
Zbigniew Jędrzejewski-Szmek [Mon, 18 Nov 2019 13:13:05 +0000 (14:13 +0100)]
core/path: serialize the previous_exists state

Without that we are prone to generate spurious events after daemon
reload/restart.

4 years agoMerge pull request #14056 from yuwata/dhcp-debug-logs
Yu Watanabe [Mon, 18 Nov 2019 09:49:45 +0000 (18:49 +0900)]
Merge pull request #14056 from yuwata/dhcp-debug-logs

dhcp: add debug logs and propagate error in restarting client

4 years agoMerge pull request #14055 from yuwata/network-send-option-takes-type-field
Zbigniew Jędrzejewski-Szmek [Sun, 17 Nov 2019 18:17:38 +0000 (19:17 +0100)]
Merge pull request #14055 from yuwata/network-send-option-takes-type-field

network: make SendOption= also take type field

4 years agosd-dhcp-client: anonymize DHCPDISCOVER (fixes #13992)
Serge [Sat, 16 Nov 2019 12:22:35 +0000 (15:22 +0300)]
sd-dhcp-client: anonymize DHCPDISCOVER (fixes #13992)

According to RFC7844 section 3 the DHCPDISCOVER message should not contain option 50 («Requested IP Address») when Anonymize is true

4 years agodhcp6: add debug logs
Yu Watanabe [Sun, 17 Nov 2019 14:57:50 +0000 (23:57 +0900)]
dhcp6: add debug logs

4 years agodhcp4: propagate error in restarting DHCPv4 client
Yu Watanabe [Sun, 17 Nov 2019 14:52:46 +0000 (23:52 +0900)]
dhcp4: propagate error in restarting DHCPv4 client

4 years agodhcp4: add debug logs
Yu Watanabe [Sun, 17 Nov 2019 14:48:46 +0000 (23:48 +0900)]
dhcp4: add debug logs

4 years agonetwork: make SendOption= also take type field
Yu Watanabe [Sun, 17 Nov 2019 14:09:53 +0000 (23:09 +0900)]
network: make SendOption= also take type field

This makes SendOption= and SendRawOption= takes values in the same
format.

4 years agonetwork: rename DHCPRawOption to DHCPOptionDataType
Yu Watanabe [Sun, 17 Nov 2019 13:59:58 +0000 (22:59 +0900)]
network: rename DHCPRawOption to DHCPOptionDataType

And moves the definition from networkd-dhcp-server.[ch] to networkd-dhcp-common.[ch].

4 years agonetwork: fix logged error value
Yu Watanabe [Sun, 17 Nov 2019 13:51:06 +0000 (22:51 +0900)]
network: fix logged error value

4 years agonetwork: fix indentation
Yu Watanabe [Sun, 17 Nov 2019 13:45:38 +0000 (22:45 +0900)]
network: fix indentation

4 years agoError, rather than warn, if failing to start DHCP server
Tom Fitzhenry [Sat, 16 Nov 2019 15:04:18 +0000 (02:04 +1100)]
Error, rather than warn, if failing to start DHCP server

This would have made diagnosing https://github.com/systemd/systemd/issues/14050 easier.

4 years agobasic: add vmware hypervisor detection from device-tree
Cyprien Laplace [Thu, 14 Nov 2019 14:42:14 +0000 (09:42 -0500)]
basic: add vmware hypervisor detection from device-tree

Allow ConditionVirtualization=vmware to work on ESXi on arm VMs
using device-tree.

4 years agomount: do not update exec deps on mountinfo changes
Lennart Poettering [Fri, 15 Nov 2019 13:00:54 +0000 (14:00 +0100)]
mount: do not update exec deps on mountinfo changes

Fixes: #13978

4 years agomount: extend list of extrinsic mounts a bit
Lennart Poettering [Fri, 15 Nov 2019 13:00:12 +0000 (14:00 +0100)]
mount: extend list of extrinsic mounts a bit

4 years agoMerge pull request #14038 from keszybz/hwdb-update
Lennart Poettering [Sat, 16 Nov 2019 12:49:01 +0000 (13:49 +0100)]
Merge pull request #14038 from keszybz/hwdb-update

hwdb update

4 years agoNEWS: more items
Zbigniew Jędrzejewski-Szmek [Fri, 15 Nov 2019 13:16:06 +0000 (14:16 +0100)]
NEWS: more items

Also reorder some entries to restore the grouping by subject.

4 years agoMerge pull request #14043 from poettering/shutdown-noswap-fix
Lennart Poettering [Sat, 16 Nov 2019 12:48:25 +0000 (13:48 +0100)]
Merge pull request #14043 from poettering/shutdown-noswap-fix

shutdown: it's OK if /proc/swaps is missing

4 years agoMerge pull request #14039 from keszybz/systemd-man
Lennart Poettering [Sat, 16 Nov 2019 12:47:59 +0000 (13:47 +0100)]
Merge pull request #14039 from keszybz/systemd-man

systemd(1) and journalctl(1) improvements

4 years agosd-bus: invalidate connection when Hello() fails
Lennart Poettering [Fri, 15 Nov 2019 13:23:53 +0000 (14:23 +0100)]
sd-bus: invalidate connection when Hello() fails

Fixes: #13969

4 years agoid128: drop "MESSAGE_" prefix of pretty output
Lennart Poettering [Fri, 15 Nov 2019 18:04:21 +0000 (19:04 +0100)]
id128: drop "MESSAGE_" prefix of pretty output

Using these IDs for message identication is one use case, but there are
others, hence let's drop the prefix, it only made sense to have while
the tool was part of journalctl.

4 years agoid128: add new "-u" switch for outputting Ids in UUID format
Lennart Poettering [Fri, 15 Nov 2019 18:02:55 +0000 (19:02 +0100)]
id128: add new "-u" switch for outputting Ids in UUID format

For some unrelated stuff I wanted the machine ID in UUID format, and it
was annoying doing that manually. So let's add a switch for this, so
that this works:

    systemd-id128 machine-id -u

4 years agoMerge pull request #14037 from poettering/machinectl-pw-agent
Lennart Poettering [Fri, 15 Nov 2019 15:59:49 +0000 (16:59 +0100)]
Merge pull request #14037 from poettering/machinectl-pw-agent

spawn ask pw tty agent from "machinectl start"

4 years agoMerge pull request #13940 from keur/protect_kernel_logs
Lennart Poettering [Fri, 15 Nov 2019 15:26:10 +0000 (16:26 +0100)]
Merge pull request #13940 from keur/protect_kernel_logs

Add ProtectKernelLogs to systemd.exec

4 years agoumount: log on all errors
Lennart Poettering [Fri, 15 Nov 2019 13:58:06 +0000 (14:58 +0100)]
umount: log on all errors

4 years agoumount: be happy if /proc/swaps doesn't exist
Lennart Poettering [Fri, 15 Nov 2019 13:57:27 +0000 (14:57 +0100)]
umount: be happy if /proc/swaps doesn't exist

Kernels work without swap just fine.

Fixes: #13993

4 years agoshutdown: make logging more useful if NULL swap/mount table files are specified
Lennart Poettering [Fri, 15 Nov 2019 13:56:35 +0000 (14:56 +0100)]
shutdown: make logging more useful if NULL swap/mount table files are specified

Makes the error output seen in #13993 more readable.

4 years agoRemove path_compare_func() alias for path_compare()
Zbigniew Jędrzejewski-Szmek [Thu, 14 Nov 2019 14:23:05 +0000 (15:23 +0100)]
Remove path_compare_func() alias for path_compare()

Non sunt multiplicanda entia sine necessitate.

4 years agoman: significantly downgrade the Options section in systemd(1)
Zbigniew Jędrzejewski-Szmek [Fri, 15 Nov 2019 12:30:02 +0000 (13:30 +0100)]
man: significantly downgrade the Options section in systemd(1)

This structure of the man page originates from the time when systemd was
installed on top of sysvinit systems, and users had an actual chance to
interact with the systemd binary directly. Nowadays it is almost never called
directly, so let's properly explain this in the overview.

The Options section is moved down below the kernel command line, those options
are only needed in special circumstances. Let's refer the reader to the
description of the kernel command line options, and not duplicate the
descriptions (which makes the text longer than necessary and increases chances
for discrepancies).

Systemd is also prominently used as the user manager, let's mention that in the
Overview.

While at it, use "=" only when an argument is required as we nowadays do.

4 years agoman: share description of $SYSTEMD_COLORS in other tools
Zbigniew Jędrzejewski-Szmek [Fri, 15 Nov 2019 10:59:34 +0000 (11:59 +0100)]
man: share description of $SYSTEMD_COLORS in other tools

It was only described in systemd(1), making it hard to discover.
Fixes #13561.

The same for $SYSTEMD_URLIFY.

I think all the tools whose man pages include less-variables.xml support
those variables.

4 years agohwdb: update
Zbigniew Jędrzejewski-Szmek [Fri, 15 Nov 2019 10:35:27 +0000 (11:35 +0100)]
hwdb: update

As before, the net change seems to be almost only additions, with some
minor removals that seems to be corrections of incomplete entries.

4 years agomeson: add target to update the chromiumos rules
Zbigniew Jędrzejewski-Szmek [Fri, 15 Nov 2019 10:32:24 +0000 (11:32 +0100)]
meson: add target to update the chromiumos rules

There is no change in the file right now, but the download seems to work
OK.

It's funny that the biggest company in the world cannot provide a
download link in plain text.

4 years agomachinectl: spawn ask password agent on "start"
Lennart Poettering [Fri, 15 Nov 2019 10:12:34 +0000 (11:12 +0100)]
machinectl: spawn ask password agent on "start"

We start units in the background, hence it is wise to also have the
ask pasword agent around.

Fixes: #13587

4 years agoask-password-agent: introduce ask_password_agent_open_if_enabled()
Lennart Poettering [Fri, 15 Nov 2019 10:11:52 +0000 (11:11 +0100)]
ask-password-agent: introduce ask_password_agent_open_if_enabled()

This makes the ask-password agent handling more alike the polkit agent
handling again, and introduces ask_password_agent_open_if_enabled() that
works just like the already existing polkit_agent_open_if_enabled().

4 years agopolkit-agent: don't use an inline function
Lennart Poettering [Fri, 15 Nov 2019 10:11:10 +0000 (11:11 +0100)]
polkit-agent: don't use an inline function

This is long enough to just be a regular function, and is never called
in inner loops, let's hence just make this a plain function.

4 years agonspawn: Allow Capability= to overrule private network setting
Torsten Hilbrich [Tue, 12 Nov 2019 07:36:06 +0000 (08:36 +0100)]
nspawn: Allow Capability= to overrule private network setting

The commit:

a3fc6b55ac nspawn: mask out CAP_NET_ADMIN again if settings file turns off private networking

turned off the CAP_NET_ADMIN capability whenever no private networking
feature was enabled. This broke configurations where the CAP_NET_ADMIN
capability was explicitly requested in the configuration.

Changing the order of evalution here to allow the Capability= setting
to overrule this implicit setting:

Order of evaluation:

1. if no private network setting is enabled, CAP_NET_ADMIN is removed
2. if a private network setting is enabled, CAP_NET_ADMIN is added
3. the settings of Capability= are added
4. the settings of DropCapability= are removed

This allows the fix for #11755 to be retained and to still allow the
admin to specify CAP_NET_ADMIN as additional capability.

Fixes: a3fc6b55acd3f37e50915304d87bed100efa9d9d
Fixes: #13995

4 years agosystemd-analyze: Add ProtectKernelLogs to security
Kevin Kuehler [Thu, 14 Nov 2019 01:37:05 +0000 (17:37 -0800)]
systemd-analyze: Add ProtectKernelLogs to security

4 years agounits: set ProtectKernelLogs=yes on relevant units
Kevin Kuehler [Thu, 14 Nov 2019 00:56:23 +0000 (16:56 -0800)]
units: set ProtectKernelLogs=yes on relevant units

We set ProtectKernelLogs=yes on all long running services except for
udevd, since it accesses /dev/kmsg, and journald, since it calls syslog
and accesses /dev/kmsg.

4 years agotest-namespace: Add test for ProtectKernelLogs=
Kevin Kuehler [Thu, 14 Nov 2019 00:38:33 +0000 (16:38 -0800)]
test-namespace: Add test for ProtectKernelLogs=

4 years agocore: do not propagate polkit error to caller
Zbigniew Jędrzejewski-Szmek [Thu, 14 Nov 2019 13:28:05 +0000 (14:28 +0100)]
core: do not propagate polkit error to caller

If we fail to start polkit, we get a message like
"org.freedesktop.DBus.Error.NameHasNoOwner: Could not activate remote peer.",
which has no meaning for the caller of our StartUnit method. Let's just
return -EACCES.

$ systemctl start apache
Failed to start apache.service: Could not activate remote peer. (before)
Failed to start apache.service: Access denied                   (after)

Fixes #13865.

4 years agoseccomp: more comprehensive protection against libseccomp's __NR_xyz namespace invasion
Lennart Poettering [Thu, 14 Nov 2019 16:51:30 +0000 (17:51 +0100)]
seccomp: more comprehensive protection against libseccomp's __NR_xyz namespace invasion

A follow-up for 59b657296a2fe104f112b91bbf9301724067cc81, adding the
same conditioning for all cases of our __NR_xyz use.

Fixes: #14031

4 years agoPrefixDelegationHint-section: typo
Tommy J [Fri, 15 Nov 2019 01:25:17 +0000 (02:25 +0100)]
PrefixDelegationHint-section: typo

4 years agoman: Add description for ProtectKernelLogs=
Kevin Kuehler [Mon, 11 Nov 2019 05:27:29 +0000 (21:27 -0800)]
man: Add description for ProtectKernelLogs=

4 years agotest/test-seccomp: add test_protect_syslog
Kevin Kuehler [Mon, 11 Nov 2019 04:37:20 +0000 (20:37 -0800)]
test/test-seccomp: add test_protect_syslog

4 years agocore: ProtectKernelLogs= mask kmsg in proc and sys
Kevin Kuehler [Sun, 10 Nov 2019 09:17:01 +0000 (01:17 -0800)]
core: ProtectKernelLogs= mask kmsg in proc and sys

Block access to /dev/kmsg and /proc/kmsg when ProtectKernelLogs is set.

4 years agologind: drop unused user_tasks_max field
Zbigniew Jędrzejewski-Szmek [Tue, 5 Nov 2019 19:48:42 +0000 (20:48 +0100)]
logind: drop unused user_tasks_max field

We would only write to the field, and take the address. All *readers* were
removed in 284149392755f086d0a714071c33aa609e61505e. (The explanation for why
the field wasn't removed back then is that the patch underwent a few iterations,
with the initial version adding translation back and forth. Later versions of
the patch simply emit a warning and ignore the old value. Apparently nobody
noticed that the value became unused.)

4 years agocore: write cgroup limits as permilles
Zbigniew Jędrzejewski-Szmek [Tue, 5 Nov 2019 19:18:11 +0000 (20:18 +0100)]
core: write cgroup limits as permilles

We allow expressing configuration as a fraction with granularity of 0.001, but
when writing out the unit file, we'd round that up to 0.01.

Longer term, I think it'd be nicer to simply use floats and do away with
arbitrary restrictions on precision.

4 years agocore/dbus-cgroup: use %.*s instead of strndupa()
Zbigniew Jędrzejewski-Szmek [Tue, 5 Nov 2019 17:15:46 +0000 (18:15 +0100)]
core/dbus-cgroup: use %.*s instead of strndupa()

4 years agocore/dbus-cgroup: drop unnecessary parens
Zbigniew Jędrzejewski-Szmek [Tue, 5 Nov 2019 17:08:15 +0000 (18:08 +0100)]
core/dbus-cgroup: drop unnecessary parens

'mask' is a macro parameter, so it cannot have commas. We don't need to
parenthesize.

4 years agocore: make TasksMax a partially dynamic property
Zbigniew Jędrzejewski-Szmek [Tue, 5 Nov 2019 12:50:28 +0000 (13:50 +0100)]
core: make TasksMax a partially dynamic property

TasksMax= and DefaultTasksMax= can be specified as percentages. We don't
actually document of what the percentage is relative to, but the implementation
uses the smallest of /proc/sys/kernel/pid_max, /proc/sys/kernel/threads-max,
and /sys/fs/cgroup/pids.max (when present). When the value is a percentage,
we immediately convert it to an absolute value. If the limit later changes
(which can happen e.g. when systemd-sysctl runs), the absolute value becomes
outdated.

So let's store either the percentage or absolute value, whatever was specified,
and only convert to an absolute value when the value is used. For example, when
starting a unit, the absolute value will be calculated when the cgroup for
the unit is created.

Fixes #13419.

4 years agoMerge pull request #14003 from keszybz/user-path-configurable
Zbigniew Jędrzejewski-Szmek [Thu, 14 Nov 2019 09:08:40 +0000 (10:08 +0100)]
Merge pull request #14003 from keszybz/user-path-configurable

meson: make user $PATH configurable

4 years agoask-password: don't hit assert() when we query pw which the user C-d and caching...
Lennart Poettering [Wed, 13 Nov 2019 19:07:31 +0000 (20:07 +0100)]
ask-password: don't hit assert() when we query pw which the user C-d and caching is enabled

4 years agoboot: Add ARM64 support to the EFI stub
Dimitri John Ledkov [Wed, 13 Nov 2019 01:20:44 +0000 (17:20 -0800)]
boot: Add ARM64 support to the EFI stub

4 years agoMerge pull request #14013 from keszybz/cryptsetup-keyfile-with-colons
Zbigniew Jędrzejewski-Szmek [Thu, 14 Nov 2019 09:02:20 +0000 (10:02 +0100)]
Merge pull request #14013 from keszybz/cryptsetup-keyfile-with-colons

Support cryptsetup keyfiles with colons agains

4 years agoboot: Load LoadOptions cmdline, if none is available.
Dimitri John Ledkov [Wed, 13 Nov 2019 01:08:57 +0000 (17:08 -0800)]
boot: Load LoadOptions cmdline, if none is available.

Fixes #13694

4 years agotest: Disable LUKS devices from initramfs in QEMU tests
Filipe Brandenburger [Wed, 13 Nov 2019 18:46:08 +0000 (10:46 -0800)]
test: Disable LUKS devices from initramfs in QEMU tests

We currently use the host's kernel and initramfs in our QEMU tests.

If the host is running on an encrypted LUKS partition, then the initramfs
will have a crypttab setup looking for the particular root disk it needs to
encrypt before booting into the system.

However, this disk obviously doesn't exist in our QEMU VM, so it turns out
our tests end up waiting for this device to become available, which will
never actually happen, and boot hangs for 90s until that service times out.

[***   ] A start job is running for /dev/disk/by-uuid/01234567-abcd-1234-abcd-0123456789ab (20s / 1min 30s)

In order to prevent this issue, let's pass "rd.luks=0" to disable LUKS in
the initramfs only as part of our default kernel command-line in our QEMU
tests.

This is enough to disable this behavior and prevent the timeout, while at
the same time doesn't conflict with our tests that actually check for LUKS
behavior in the systemd running under test (such as TEST-02-CRYPTSETUP).

Tested: `sudo make -C TEST-02-CRYPTSETUP/ clean setup run`

4 years agoBe more specific in resolved.conf man page with regard to DNSOverTLS
Riccardo Schirone [Wed, 13 Nov 2019 16:37:15 +0000 (17:37 +0100)]
Be more specific in resolved.conf man page with regard to DNSOverTLS

DNSOverTLS in strict mode (value yes) does check the server, as it is said in
the first few lines of the option documentation. The check is not performed in
"opportunistic" mode, however, as that is allowed by RFC 7858, section "4.1.
Opportunistic Privacy Profile".

> With such a discovered DNS server, the client might or might not validate the
> resolver. These choices maximize availability and performance, but they leave
> the client vulnerable to on-path attacks that remove privacy.

4 years agomeson: avoid ternary op in .format()
Zbigniew Jędrzejewski-Szmek [Wed, 13 Nov 2019 21:22:58 +0000 (22:22 +0100)]
meson: avoid ternary op in .format()

meson 0.49 can't parse that for some reason. I'm keeping this separate so it
can be reverted easily when we bump required meson version.

4 years agomeson: make user $PATH configurable
Zbigniew Jędrzejewski-Szmek [Tue, 12 Nov 2019 14:38:19 +0000 (15:38 +0100)]
meson: make user $PATH configurable

This partially reverts db11487d1062655f17db54c4d710653f16c87313 (the logic to
calculate the correct value is removed, we always use the same setting as for
the system manager). Distributions have an easy mechanism to override this if
they wish.

I think making this configurable is better, because different distros clearly
want different defaults here, and making this configurable is nice and clean.
If we don't make it configurable, distros which either have to carry patches,
or what would be worse, rely on some other configuration mechanism, like
/etc/profile. Those other solutions do not apply everywhere (they usually
require the shell to be used at some point), so it is better if we provide
a nice way to override the default.

Fixes  #13469.

4 years agoverify: fix segmentation fault
HATAYAMA Daisuke [Wed, 13 Nov 2019 11:30:58 +0000 (06:30 -0500)]
verify: fix segmentation fault

systemd-analyze verify command now results in segmentation fault if two
consecutive non-existent unit file names are given:

    # ./build/systemd-analyze a.service b.service
    ...<snip irrelevant part>...
    Unit a.service not found.
    Unit b.service not found.
    Segmentation fault (core dumped)

The cause of this is a wrong handling of return value of
manager_load_startable_unit_or_warn() in verify_units() in failure case.

It looks that the current logic wants to assign the first error status
throughout verify_units() into variable r and count up variable count only when
a given unit file exists.

However, due to the wrong handling of the return value of
manager_load_startable_unit_or_warn() in verify_units(), the variable count is
unexpectedly incremented even when there is no such unit file because the
variable r already contains non-zero value in the 2nd failure, set by the 1st
failure, and then the condition k < 0 && r == 0 evaluates to false.

This commit fixes the wrong handling of return value of
manager_load_startable_unit_or_warn() in verify_units().

4 years agoman: mention $RUNTIME_DIRECTORY & friends in environment list
Zbigniew Jędrzejewski-Szmek [Wed, 13 Nov 2019 20:55:30 +0000 (21:55 +0100)]
man: mention $RUNTIME_DIRECTORY & friends in environment list

4 years agoAllow overriding /etc/fstab with $SYSTEMD_FSTAB
Zbigniew Jędrzejewski-Szmek [Wed, 13 Nov 2019 16:36:46 +0000 (17:36 +0100)]
Allow overriding /etc/fstab with $SYSTEMD_FSTAB

4 years agocryptsetup-generator: guess whether the keyfile argument is two items or one
Zbigniew Jędrzejewski-Szmek [Wed, 13 Nov 2019 09:32:30 +0000 (10:32 +0100)]
cryptsetup-generator: guess whether the keyfile argument is two items or one

Fixes #13615.

See the inline comment for documentation.

4 years agocryptsetup-generator: allow overriding /run/systemd/cryptsetup with $RUNTIME_DIRECTORY
Zbigniew Jędrzejewski-Szmek [Wed, 13 Nov 2019 11:06:58 +0000 (12:06 +0100)]
cryptsetup-generator: allow overriding /run/systemd/cryptsetup with $RUNTIME_DIRECTORY

I added a fairly vague entry to docs/ENVIRONMENT because I think it is worth
mentioning there (in case someone is looking for any environment variable that
might be relevant).