Commit graph

28644 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 8f8cc84ba4 sd-login: get rid of seat_can_multi_session()
Follow-up for fa2cf64a91.
Backwards-compat is retained. A short note is added in docs, in case
people see sd_seat_can_multi_session() mentioned somewhere and wonder what
happened to it.

Also see https://github.com/systemd/systemd/pull/15337#issuecomment-610369404.
2020-04-17 16:15:30 +02:00
Lennart Poettering 0648f9beb9 errno-util: let's beef up ERRNO_IS_NOT_SUPPORTED() with socket not supported errors 2020-04-17 16:05:56 +02:00
Lennart Poettering 511e03a3ee journald: add configuration option for enabling/disabling audit during journald startup
Let's make it optional whether auditing is enabled at journald start-up
or not.

Note that this only controls whether audit is enabled/disabled in the
kernel. Either way we'll still collect the audit data if it is
generated, i.e. if some other tool enables it, we'll collect it.

Fixes: #959
2020-04-17 16:05:22 +02:00
Lennart Poettering 4444e8533f
Merge pull request #15454 from keszybz/codespell-fixes
Spelling fixes based on codespell suggestions
2020-04-17 15:53:01 +02:00
Zbigniew Jędrzejewski-Szmek a8cff0034c
Merge pull request #15347 from hakman/journald-upload-public-cloud
Support journal-upload HTTPS without key and certificate
2020-04-17 11:26:34 +02:00
Zbigniew Jędrzejewski-Szmek c3b22a92a9
Merge pull request #15452 from keszybz/fix-ipproto-assert
Fix static assertion failure with recent glibc
2020-04-17 11:25:40 +02:00
Zbigniew Jędrzejewski-Szmek f1e318f690 network: fix typo
I was worried about backwards compat, but this was only added
in af94bb24b5, and can be changed
with impunity.
2020-04-16 20:37:40 +02:00
Zbigniew Jędrzejewski-Szmek a942084057 resolved: fix typo in an unused function and add comment
Follow-up for 2615691003.
2020-04-16 20:30:50 +02:00
Zbigniew Jędrzejewski-Szmek b9a1ee32c4 shared/reboot-util: indentation update 2020-04-16 19:46:40 +02:00
Zbigniew Jędrzejewski-Szmek dad97f0425 manager: add dbus parameter names 2020-04-16 19:46:40 +02:00
Zbigniew Jędrzejewski-Szmek edc6a8031e resolved: add dbus parameter names 2020-04-16 19:46:40 +02:00
Lennart Poettering ce416f425c resolved: tone down comment in /run/systemd/{stub-,}resolve.conf
There are legitimate reasons to access the file directly, as currently
discussed on fedora-devel. Hence tone things down from "must" to "should
typically not".

Also, let's use fputs() instead of fputs_unlocked() here,
fopen_temporary_label() turns off stdio locking anyway for the whole
FILE*, hence no need to do this manually each time.
2020-04-16 19:43:00 +02:00
Lennart Poettering b11b278097
Merge pull request #15448 from keszybz/logind-avoid-polkit-query
logind: avoid polkit query for SetWallMessage()
2020-04-16 19:42:42 +02:00
Zbigniew Jędrzejewski-Szmek 162392b75a tree-wide: spellcheck using codespell
Fixes #15436.
2020-04-16 18:00:40 +02:00
Zbigniew Jędrzejewski-Szmek fac2166359 network: use "FooOverUDP" as one word
The whole thing is one name, and I think it's confusing to break it
up into separate words.
2020-04-16 17:23:41 +02:00
Zbigniew Jędrzejewski-Szmek 3d58d7328a network: fix static assertion on IPPROTO_MAX range
Builds with recent glibc would fail with:
../src/network/netdev/fou-tunnel.c: In function ‘config_parse_ip_protocol’:
../src/basic/macro.h:380:9: error: static assertion failed: "IPPROTO_MAX-1 <= UINT8_MAX"
  380 |         static_assert(expr, #expr)
      |         ^~~~~~~~~~~~~
../src/network/netdev/fou-tunnel.c:161:9: note: in expansion of macro ‘assert_cc’
  161 |         assert_cc(IPPROTO_MAX-1 <= UINT8_MAX);
      |         ^~~~~~~~~

This is because f9ac84f92f151e07586c55e14ed628d493a5929d (present in
glibc-2.31.9000-9.fc33.x86_64) added IPPROTO_MPTCP=262, following
v5.5-rc5-1002-gfaf391c382 in the kernel.
2020-04-16 17:21:49 +02:00
Alin Popa c5f8a179a2 watchdog: reduce watchdog pings in timeout interval
The watchdog ping is performed for every iteration of manager event
loop. This results in a lot of ioctls on watchdog device driver
especially during boot or if services are aggressively using sd_notify.
Depending on the watchdog device driver this may have performance
impact on embedded systems.
The patch skips sending the watchdog to device driver if the ping is
requested before half of the watchdog timeout.
2020-04-16 16:32:05 +02:00
Zbigniew Jędrzejewski-Szmek 5644d47b7c logind: skip polkit query with --no-wall
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1800875.
2020-04-16 14:07:39 +02:00
Zbigniew Jędrzejewski-Szmek 8183ebcd45 loginctl: adjust indentation 2020-04-16 13:18:03 +02:00
Ciprian Hacman 3dadb54f5f Support journal-upload HTTPS without key and certificate 2020-04-16 14:05:41 +03:00
Susant Sahani ac24e418d9 network: Allow DHCPv6 client to be started even if no O or M bit in RA. 2020-04-16 09:32:19 +02:00
Chris Down 9b4f3fa3ea virt: Use cache for VIRTUALIZATION_PROOT
Of course, the very moment after I merged #15426, I noticed something
was off: everything works, but the cache isn't updated. 🙈
2020-04-16 08:55:32 +02:00
Jan Janssen 904ebcb200 sd-boot: Add → as alternative to boot selected entry
This is sometimes slightly more convenient to use
and is also what GRUB supports.
2020-04-15 21:29:41 +01:00
Chris Down 80cc3e3eab virt: Detect proot virtualisation by ptrace metadata
proot provides userspace-powered emulation of chroot and mount --bind,
lending it to be used on environments without unprivileged user
namespaces, or in otherwise restricted environments like Android.

In order to achieve this, proot makes use of the kernel's ptrace()
facility, which we can use in order to detect its presence. Since it
doesn't use any kind of namespacing, including PID namespacing, we don't
need to do any tricks when trying to get the tracer's metadata.

For our purposes, proot is listed as a "container", since we mostly use
this also as the bucket for non-container-but-container-like
technologies like WSL. As such, it seems like a good fit for this
section as well.
2020-04-15 18:36:35 +01:00
Lennart Poettering 6ab2e1178e
Merge pull request #15431 from poettering/lock-and-key-emoji
display lock/key emoji when prompting for passwords
2020-04-15 17:55:21 +02:00
Zbigniew Jędrzejewski-Szmek 3614df0575 meson,resolved: make default LLMNR= and MulticastDNS= values configurable
For https://fedoraproject.org/wiki/Changes/systemd-resolved.
2020-04-15 14:37:21 +02:00
Lennart Poettering e3ac53a27d ask-password-api: reword some debug messages
Otherwise, seeing this in the log output is confusing since we don't
know what kind of timeout or what kind if key we are adjusting here.
2020-04-15 12:04:35 +02:00
Lennart Poettering 52d199e318 ask-password: prefix password questions with lock and key emoji
It's pretty, and it highlights that the pw prompt is kinda special and
needs user input.

We suppress the emoji entirel if there's no emoji support (i.e. this
means we suppress the ASCII replacement), since it carries no additional
information, it is just decoration to highlight a line.
2020-04-15 12:04:23 +02:00
Lennart Poettering 539ee0989e locale-util: export emoji_enable() for other code to use 2020-04-15 12:04:08 +02:00
Lennart Poettering 48d70b4ac9 locale-util: add support for lock+key emoji
It looks pretty nice on gnome-terminal at least, let's make use of it
when asking for passwords.
2020-04-15 12:03:31 +02:00
Giedrius Statkevičius c90c597ee3 verify: ignore nonexistent executables if required
We provide a way via the '-' symbol to ignore errors when nonexistent
executable files are passed to Exec* parameters & so on. In such a case,
the flag `EXEC_COMMAND_IGNORE_FAILURE` is set and we go on happily with
our life if that happens. However, `systemd-analyze verify` complained
about missing executables even in such a case. In such a case it is not
an error for this to happen so check if the flag is set before checking
if the file is accessible and executable.

Add some small tests to check this condition.

Closes #15218.
2020-04-14 21:23:31 +02:00
Jakov Smolic 5fa5c3e2d0 Add meson build option to prevent building kernel-install
This commit introduces new meson build option "kernel-install" to prevent kernel-install from building if the user
sets the added option as "false".
Signed-off-by: Jakov Smolic <jakov.smolic@sartura.hr>
Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
2020-04-14 20:22:32 +02:00
Zbigniew Jędrzejewski-Szmek 3cfb7cc507
Merge pull request #15417 from poettering/fileno-can-fail
fileio: fileno() can realistically return -1
2020-04-14 12:54:27 +02:00
Anita Zhang a3af963958
Merge pull request #15414 from mrc0mmand/coredumpctl-file
coredumpctl: support --file=PATH
2020-04-13 13:54:24 -07:00
Joel Shapiro 332f38d084 Fix pam_systemd_home's debug parameter to match man page description 2020-04-13 17:41:27 +02:00
Susant Sahani 76643fedc8 sd-network: DHCPv6 - Add status codes
https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml#dhcpv6-parameters-5
2020-04-13 17:40:00 +02:00
Lennart Poettering daf8f72b4e core: make sure ProtectHostname= is handled gracefully in containers lacking seccomp
Fixes: #15408
2020-04-13 17:32:27 +02:00
Frantisek Sumsal aeb5645082 coredumpctl: support --file=PATH
Let's match journalctl's functionality by throwing --file for
coredumpctl into the mix, so we can work on a single journal file
as well.
2020-04-13 17:10:27 +02:00
Lennart Poettering 648ba0ee81 hwdb: optimize isatty()-per-line away
Fixes: #15407
2020-04-13 11:27:35 +02:00
Lennart Poettering 451fcbfc58 fileio: extend comment a bit 2020-04-13 11:27:31 +02:00
Lennart Poettering 609ae0f596 fileio: optionally allow telling read_line_full() whether we are processing a tty or not 2020-04-13 11:27:07 +02:00
Lennart Poettering 14f594b995 fileio: fileno() can realistically return -1
An stdio FILE* stream usually refers to something with a file
descriptor, but that's just "usually". It doesn't have to, when taking
fmemopen() and similar into account. Most of our calls to fileno()
assumed the call couldn't fail. In most cases this was correct, but in
some cases where we didn't know whether we work on files or memory we'd
use the returned fd as if it was unconditionally valid while it wasn't,
and passed it to a multitude of kernel syscalls. Let's fix that, and do
something reasonably smart when encountering this case.

(Running test-fileio with this patch applied will remove tons of ioctl()
calls on -1).
2020-04-13 11:26:49 +02:00
Lennart Poettering 9d5dac4dce
Merge pull request #15411 from ssahani/systemd-issue-15375
sd-network: DHCPv6 - Add NoPrefixAvail to error code
2020-04-13 10:58:38 +02:00
Lennart Poettering d9235719f2
Merge pull request #15397 from ssahani/vxlan
network: VXlan group and remote fixes
2020-04-13 10:47:40 +02:00
Zbigniew Jędrzejewski-Szmek 38cd55b007 Remove unneded {}s
$ perl -i -0pe 's|\s+{\n([^\n]*;)\n\s+}\n|\n\1\n|gms' **/*.c

Inspired by ea7cbf5bdd.
2020-04-13 09:31:49 +02:00
Susant Sahani 667ceb9d9d sd-network: DHCP6 - Use readable error status rather than numeric
value in the log message
2020-04-13 06:06:14 +02:00
Zbigniew Jędrzejewski-Szmek 5cc34d6d1a localed: add dbus parameter names 2020-04-12 19:48:01 +02:00
Zbigniew Jędrzejewski-Szmek 599c99ee3b timedated: add dbus parameter names 2020-04-12 19:48:01 +02:00
Zbigniew Jędrzejewski-Szmek 106d79be06 hostnamed: add dbus parameter names 2020-04-12 19:48:01 +02:00
Zbigniew Jędrzejewski-Szmek 956ecd3cd3 importd: add dbus parameter names 2020-04-12 19:48:01 +02:00
Zbigniew Jędrzejewski-Szmek bbe17ca1cb machined: add dbus parameter names 2020-04-12 19:48:01 +02:00
Zbigniew Jędrzejewski-Szmek 4cb5fd0da8 logind: add dbus parameter names 2020-04-12 19:48:01 +02:00
Zbigniew Jędrzejewski-Szmek 92cad3f82d
Merge pull request #15406 from DaanDeMeyer/sd-bus-set-exec-docs
Add sd_bus_set_exec docs
2020-04-12 18:38:49 +02:00
Vito Caputo ea7cbf5bdd home: switch to BusLocator-oriented helpers
Remove some unnecessary verbosity, largely mechanical change with
no functional difference.
2020-04-12 17:24:00 +02:00
Zbigniew Jędrzejewski-Szmek a1a11d5610
Merge pull request #15365 from poettering/remount-fs-pstore-fix
pid1: automatically generate systemd-remount-fs.service deps, plus enable systemd-pstore from sysinit.target
2020-04-12 17:16:07 +02:00
Susant Sahani 7a0f1895d3 sd-network: DHCPv6 - Add NoPrefixAvail to error code 2020-04-12 14:14:52 +02:00
Daan De Meyer 59a77060e0 sd-bus: Use pointer syntax for sd_bus_set_exec argv parameter 2020-04-11 21:57:28 +02:00
Zbigniew Jędrzejewski-Szmek bba97c98b8
Merge pull request #15376 from poettering/homed-btrfs-subvol-luks
homed: when doing luks homedir with btrfs inside, place subvol at top of fs
2020-04-11 16:26:01 +02:00
Susant Sahani 659f85a519 networkctl: Add support to display VXLan remote address 2020-04-11 16:12:42 +02:00
Zbigniew Jędrzejewski-Szmek 2d9123cebd
Merge pull request #15377 from poettering/userdb-no-shadow
don't try to access shadow from logind
2020-04-11 16:08:33 +02:00
Zbigniew Jędrzejewski-Szmek edc8dd26e2
Merge pull request #15392 from keszybz/flag-helper
Flag setting helper and some other minor cleanups
2020-04-11 16:05:11 +02:00
Susant Sahani fc1d9c7b0c network: VXLan - Add support for remote address 2020-04-11 06:11:51 +02:00
Zbigniew Jędrzejewski-Szmek 24e6f45842 network: use a loop for repetitive operation
This should hopefully help us avoid c&p mistakes. And there are plans to
add more settings like this, which should then be rather straightforward.

There is a slight functional change: the code got uplink handling wrong
and run manager_find_uplink() repeatedly. That part is fixed.
2020-04-10 17:57:31 +02:00
Zbigniew Jędrzejewski-Szmek c1997a5bf7 network: add helper to extract server lists
This code is repeable enough to define a common implementation.
2020-04-10 17:57:19 +02:00
Zbigniew Jędrzejewski-Szmek ddc026f303 network: define string lookup table for the DHCP info bits 2020-04-10 17:53:10 +02:00
Zbigniew Jędrzejewski-Szmek c8407baf30 sd-dhcp-server: add a meta-setter to simplify setting of server lists 2020-04-10 17:52:59 +02:00
Zbigniew Jędrzejewski-Szmek 8541db8f59 sd-dhcp-lease: add a meta-getter to simplify querying of server lists 2020-04-10 17:45:46 +02:00
Zbigniew Jędrzejewski-Szmek 0da965037e Add yet another tiny helper to manipulate flags 2020-04-10 16:40:48 +02:00
Zbigniew Jędrzejewski-Szmek 16c347b3b6 busctl: wrap long lines 2020-04-10 16:40:48 +02:00
Zbigniew Jędrzejewski-Szmek 8722b297e5 busctl: use the pager everywhere
There is no reason to assume that the user doesn't want the pager
even if they are looking at xml output or such.
2020-04-10 16:40:29 +02:00
Susant Sahani 7c9b26900c network: VXLan - fix adding Group address 2020-04-10 15:29:10 +02:00
nerdopolis fa2cf64a91 login: Fix incorrect reporting of CanMultiSession=no on non-seat0 seats 2020-04-10 14:22:27 +02:00
Vito Caputo df91e319a9 bus: add sd_bus_message_new_method_call() helper
adds BusLocator variant called bus_message_new_method_call()
2020-04-10 11:30:05 +02:00
Vito Caputo a028ef14c9 bus: s/BusAddress/BusLocator/
Mechanical rename in response to
https://github.com/systemd/systemd/pull/15331#issuecomment-611472240
2020-04-10 09:16:43 +02:00
Lennart Poettering c46db6c0a2 bootctl: fix assert issue
Follow-up for b46c3e4913
2020-04-09 11:22:40 -07:00
Lennart Poettering 9b3c65ed36
Merge pull request #15352 from poettering/user-group-name-valdity-rework
user/group name validity rework
2020-04-09 18:49:22 +02:00
Lennart Poettering 611cb82612
Merge pull request #15318 from fbuihuu/inherit-umask-for-user-units
pid1: by default make user units inherit their umask from the user ma…
2020-04-09 17:15:55 +02:00
Lennart Poettering f58921bde3
Merge pull request #15332 from keszybz/coredump-filter
CoredumpFilter=
2020-04-09 17:15:26 +02:00
Lennart Poettering b062ca616c logind: avoid shadow lookups when doing userdb client side
Let's not trigger MACs needlessly.

Ideally everybody would turn on userdb, but if people insist in not
doing so, then let's not attempt to open shadow.

It's a bit ugly to implement this, since shadow information is more than
just passwords (but accound validity metadata), and thus userdb's own
"privieleged" scheme is orthogonal to this, but let's still do this for
the client side.

Fixes: #15105
2020-04-09 14:38:14 +02:00
Lennart Poettering ed30170ea0 userdb: when doing client-side NSS look-ups optionally avoid shadow look-ups 2020-04-09 14:38:02 +02:00
Lennart Poettering a1792d1ada pam-systemd-home: drop redundant newline 2020-04-09 14:37:50 +02:00
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
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 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 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 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
Susant Sahani e9a8c550c1 LLDP: Add support to transmit MUD URL 2020-04-08 00:20:54 +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
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
root f9d29f6d06 fix manager_state 2020-04-07 15:27:50 +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
Zbigniew Jędrzejewski-Szmek a2f838d590 detect-virt: also detect "microsoft" as WSL
From https://github.com/microsoft/WSL/issues/423#issuecomment-221627364:
> it's unlikely we'll change it to something that doesn't contain "Microsoft"
> or "WSL".

... but well, it happened. If they change it incompatibly w/o adding an stable
detection mechanism, I think we should not add yet another detection method.
But adding a different casing of "microsoft" is not a very big step, so let's
do that.

Follow-up for #11932.
2020-04-04 16:52:32 +02:00
Lennart Poettering 4c39820562
Merge pull request #15298 from keszybz/show-property-value
systemctl --property-value as shortcut for --property --value
2020-04-04 11:22:59 +02:00
Anita Zhang 3d9489ee45
Merge pull request #15321 from topimiettinen/dbus-execute-add-protect-clock
dbus-execute: show also ProtectClock
2020-04-03 16:15:51 -07:00
Anita Zhang 4fbf39926e
Merge pull request #15290 from keszybz/unrelated-fixes
Three unrelated minor tweaks
2020-04-03 15:54:38 -07:00
Anita Zhang 3adb304ae6
Merge pull request #15297 from poettering/homed-no-fallocate
homed: fall back to ftruncate() if fallocate() is not supported on ba…
2020-04-03 15:49:43 -07:00
Zbigniew Jędrzejewski-Szmek 5292c24047 systemctl: add -P as short for --value --property= 2020-04-03 18:24:20 +02:00
Zbigniew Jędrzejewski-Szmek 1b87e27999
Merge pull request #15315 from DaanDeMeyer/deprecate-sd-bus-priority
sd-bus: Deprecate priority functions
2020-04-03 18:07:54 +02:00
Lennart Poettering c4b2371263 capability: don't skip ambient caps setup if we actually have something to set
Follow-up for 7ea4392f1e

Let's not hide errors needlessly aggressively.
2020-04-03 18:02:08 +02:00
Topi Miettinen 1887032f71 shared/dissect-image: log messages from cryptsetup
Before:
```
write(2, "Device /dev/loop1p1 is too small.\n", 34) = -1 ENOTCONN (Transport
endpoint is not connected)
```

After:
```
$ journalctl -b -e | grep 'too small'
Apr 02 16:53:30 loora systemd[343579]: Device /dev/loop1p1 is too small.
```
2020-04-03 17:44:20 +02:00
Giedrius Statkevičius aa5408e2e8 resolve: reload /etc/hosts on inode change
On certain distributions such as NixOS the mtime of `/etc/hosts` is
locked to a fixed value. In such cases, only checking the last mtime of
`/etc/hosts` is not enough - we also need to check if the st_ino/st_dev
match up. Thus, let's make sure make sure that systemd-resolved also
rereads `/etc/hosts` if the inode or the device containing `/etc/hosts` changes.

Test script:

```bash
hosts="/etc/hosts"
echo "127.0.0.1 testpr" > "hosts_new"
mv "hosts_new" "$hosts"
resolvectl query testpr || exit 1
mtime="$(stat -c %y "$hosts")"
echo "127.0.0.1 newhost" > "hosts_tmp"
touch -d "$mtime" "hosts_tmp"
install -p "hosts_tmp" "$hosts"
sleep 10
resolvectl query newhost || exit 1
rm -f "hosts_tmp"
```

Closes #14456.
2020-04-03 17:34:10 +02:00
Topi Miettinen b8b7b838fd
dbus-execute: show also ProtectClock
Show also `ProtectClock=` setting. This also lets `systemd-analyze security`
get the correct state for it.
2020-04-03 16:32:10 +03:00
Daan De Meyer 1e9a7c44a9 sd-bus: remove unused priority logic 2020-04-02 21:42:32 +02:00
Daan De Meyer 11a177d9de sd-bus: Deprecate priority functions 2020-04-02 21:36:59 +02:00
Lennart Poettering 82aa14e2a3 string-util: make clear that split() + FOREACH_WORD() should die 2020-04-02 16:43:39 +02:00
Lennart Poettering 29965a2a6e string-util: make sure we eat even half complete words in split()
split() and FOREACH_WORD really should die, and everything be moved to
extract_first_word() and friends, but let's at least make sure that for
the remaining code using it we can't deadlock by not progressing in the
word iteration.

Fixes: #15305
2020-04-02 16:43:36 +02:00
Lennart Poettering 5fed82c642 string-util: some minor coding style updates 2020-04-02 16:43:24 +02:00
Zbigniew Jędrzejewski-Szmek c83a5ead31 Merge pull request #15210 from ssahani/networkctl-up-down
Merging by hand because github refuses merging because "Rebasing the commits of
this branch on top of the base branch cannot be performed automatically as this
would create a different result than a regular merge.".
2020-04-02 11:21:25 +02:00
Vito Caputo 935052a8aa sd-bus: add va_list variants of variadic convenience functions
Consumers of the sd-bus convenience API can't make convenience
helpers of their own without va_list variants.

This commit is a mechanical change splitting out the existing function
bodies into bare va_list variants having a 'v' suffixed to the names.

The original functions now simply create the va_list before forwarding
the call on to the va_list variant, and the va_list variants dispense
with those steps.
2020-04-02 10:26:18 +02:00
Zbigniew Jędrzejewski-Szmek c51c6f2f57
Merge pull request #15252 from ssahani/dhcpv6-mud
DHCPv6: Add support to send MUD URL
2020-04-02 10:23:15 +02:00
Lénaïc Huard 61fd7d6720 udev: Fix SIGSEGV in AlternativeNamesPolicy handling
The function sd_device_get_property_value has some paths where it exits without
touching the n pointer. In those cases, n remained uninitialized until it was
eventually read inside isempty where it caused the segmentation fault.

Fixes #15078
2020-04-02 10:18:56 +02:00
Richard Petri 7e025e9cdb network: can: add support for CAN-FD related properties 2020-04-01 20:07:20 +02:00
Richard Petri 74a2726869 network: can: introduce a config parser function for bitrates
For now, this function is nearly equivalent to the si_uint64 parser, except for
an additional range check as Linux only takes 32-bit values as bitrates. In
future, this may also be used to introduce fancier bitrate config formats.
2020-04-01 20:07:20 +02:00
Lennart Poettering e46f877c5c homed: fall back to ftruncate() if fallocate() is not supported on backing fs
This means "discard" mode is enabled implicitly on such simpler backing
fs.

Fixes: #15059
2020-04-01 18:19:07 +02:00
Susant Sahani 3175a8c21b network: DHCPv6 Add support to send MUD URL 2020-04-01 17:01:12 +02:00
Susant Sahani de8d6e5563 sd-dhcpv6: Add support to set request MUD URL 2020-04-01 16:59:29 +02:00
Zbigniew Jędrzejewski-Szmek c083264115
Merge pull request #15278 from vcaputo/more-trivial-cleanups
Expand use of _cleanup_close_ where trivial
2020-04-01 00:16:56 +02:00
Zbigniew Jędrzejewski-Szmek b1b9e829c2
Merge pull request #15229 from ssahani/mud
network: Introduce MUD
2020-04-01 00:10:13 +02:00
Zbigniew Jędrzejewski-Szmek 82b2281dd5 journal-remote: fix description of option
We use whatever compression is configured, most often not XZ.
2020-03-31 22:19:22 +02:00
Zbigniew Jędrzejewski-Szmek 934cf0a9c7 sd-bus: simplify bus_maybe_reply_error
sd_bus_reply_method_errno already does the same two checks
(sd_bus_error_is_set(error), r < 0) internally. But it did them in opposite
order. The effect is the same, because sd_bus_reply_method_errno falls back to
sd_bus_reply_method_error, but it seems inelegant. So let's simplify
bus_maybe_reply_error() to offload the job fully to sd_bus_reply_method_errno().

No functional change.
2020-03-31 22:19:22 +02:00
Vito Caputo 8e06af804b *: use _cleanup_close_ with fdopendir() where trivial
Also convert these to use take_fdopendir().
2020-03-31 06:48:03 -07:00
Vito Caputo b46c3e4913 *: use _cleanup_close_ with fdopen() where trivial
Also convert these to use take_fdopen().
2020-03-31 06:48:03 -07:00
Vito Caputo 9f81a592c1 *: convert amenable fdopendir() calls to take_fdopendir()
Some fdopendir() calls remain where safe_close() is manually
performed, those could be simplified as well by converting to
use the _cleanup_close_ machinery, but makes things less trivial
to review so left for a future cleanup.
2020-03-31 06:48:03 -07:00
Vito Caputo f61457b0fe fileio: add take_fdopendir() variant
fdopendir() wrapper analogous to take_fdopen()
2020-03-31 06:48:03 -07:00
Vito Caputo 4fa744a35c *: convert amenable fdopen calls to take_fdopen
Mechanical change to eliminate some cruft by using the
new take_fdopen{_unlocked}() wrappers where trivial.
2020-03-31 06:48:03 -07:00
Vito Caputo 3ebbb6cb39 fileio: introduce take_fdopen{_unlocked}() variant
With the addition of _cleanup_close_ there's a repetitious
pattern of assigning -1 to the fd after a successful fdopen
to prevent its close on cleanup now that the FILE * owns the
fd.

This introduces a wrapper that instead takes a pointer to the
fd being opened, and always overwrites the fd with -1 on success.

A future commit will cleanup all the fdopen call sites to use the
wrapper and elide the manual -1 fd assignment.
2020-03-31 06:48:00 -07:00
Zbigniew Jędrzejewski-Szmek f5d9daaea3 Merge pull request #15268 from poettering/sigusr1-sigusr2
Doing manual merge because github thinks there's a conflict.
2020-03-31 15:33:05 +02:00
Vito Caputo 80ace4f25e home: fix several typos 2020-03-31 15:16:36 +02:00
Lennart Poettering a85daa0dfb user-util: switch order of checks in valid_user_group_name_or_id_full()
When we are supposed to accept numeric UIDs formatted as string, then
let's check that first, before passing things on to
valid_user_group_name_full(), since that might log about, and not the
other way round.

See: #15201
Follow-up for: 93c23c9297
2020-03-31 11:25:01 +02:00
Vito Caputo 3aeea37d88 home: narrow scope of 'size_t n'
trivial cosmetic cleanup
2020-03-31 00:29:26 -07:00
Piero La Terza 36e4a8f22a homectl: fix a typo
stroage -> storage
2020-03-31 09:24:38 +02:00
Susant Sahani 7b8d23a9bb network: DHCPv4 - introduce The Manufacturer Usage Description (MUD) 2020-03-30 20:27:48 +02:00
Susant Sahani d11d4a6459 sd-dhcpv4: introduce The Manufacturer Usage Description (MUD) 2020-03-30 19:16:01 +02:00