Commit Graph
46055 Commits
Author SHA1 Message Date
Luca Boccassi 00666ec71f Merge pull request #6763 from kinvolk/iaguis/no-new-privs
core: allow using seccomp without no_new_privs when unprivileged
2023-11-07 21:34:49 +00:00
Luca Boccassi b485c1bf4e Merge pull request #29914 from yuwata/network-generator
network-generator: several cleanups and follow-ups for dns server handling
2023-11-07 20:51:21 +00:00
Zbigniew Jędrzejewski-Szmek ed739145fb xdg-autostart: downgrade warning for missing executables
On a system with a shared home directory, I'm getting a bunch of warnings:

systemd-xdg-autostart-generator[76]: Exec binary '/usr/bin/flatpak' does not exist: No such file or directory
systemd-xdg-autostart-generator[76]: /home/zbyszek/.config/autostart/org.signal.Signal.desktop: not generating unit, error parsing Exec= line: No such file or directory
systemd-xdg-autostart-generator[76]: Exec binary '/usr/bin/flatpak' does not exist: No such file or directory
systemd-xdg-autostart-generator[76]: /home/zbyszek/.config/autostart/im.riot.Riot.desktop: not generating unit, error parsing Exec= line: No such file or directory
systemd-xdg-autostart-generator[76]: Exec binary '/usr/libexec/gnome-tweak-tool-lid-inhibitor' does not exist: No such file or directory
systemd-xdg-autostart-generator[76]: /home/zbyszek/.config/autostart/ignore-lid-switch-tweak.desktop: not generating unit, error parsing Exec= line: No such file or directory
systemd-xdg-autostart-generator[76]: Exec binary '/usr/bin/flatpak' does not exist: No such file or directory
systemd-xdg-autostart-generator[76]: /home/zbyszek/.config/autostart/org.telegram.desktop.desktop: not generating unit, error parsing Exec= line: No such file or directory

This isn't really a problem. Let's just print an info message.
2023-11-07 20:47:04 +00:00
Lennart Poettering a338ccaa98 systemctl: grey out legend
The legend is not the primary information, but simply explanatory, hence
grey it out a bit.

This mimics what we do for pcrlock.
2023-11-07 20:07:43 +00:00
Yu Watanabe b86f60bfb3 network-generator: refuse unexpected trailing strings 2023-11-08 04:29:45 +09:00
Yu Watanabe 816c269e55 network-generator: allow to specify both IPv4 and IPv6 DNS servers
Follow-up for 923599523c.
2023-11-08 04:29:45 +09:00
Yu Watanabe 8ae81a1e00 network-generator: add missing assertions 2023-11-08 04:29:45 +09:00
Yu Watanabe 0b0865f509 network-generator: drop unused family argument 2023-11-08 04:29:45 +09:00
Yu Watanabe 13a462b9d5 network-generator: relax requirement for peer address, route destination, and gateway
No functional changes, as the caller already sets them.
2023-11-08 04:29:45 +09:00
Lennart Poettering 38bf0a2361 Merge pull request #29876 from poettering/kernel-install-all
add "kernel-install list" and "kernel-install add-all"
2023-11-07 18:29:47 +01:00
Frantisek Sumsal b2603465d4 coredumpctl: propagate SIGTERM to the debugger process
If we're waiting for the debugger process to exit and receive SIGTERM,
propagate it to all processes in our process group, including the
debugger, so we can follow it up with a proper cleanup.

Resolves: #28772
2023-11-07 15:41:33 +00:00
Yu Watanabe c4efe0e51e sd-dhcp-client: gracefully ignore OFFER with Rapid Commit option
Fixes #29904.
2023-11-07 16:13:54 +01:00
Lennart Poettering 8353229e10 update CI 2023-11-07 16:08:06 +01:00
Lennart Poettering 758d14767d kernel-install: make "inspect" work more like "add" regarding omission of parameters
This makes "kernel-install inspect" work more "kernel-install add": if
the version or kernel image is specified as "-" or omitted we'll make it
up.
2023-11-07 16:07:57 +01:00
Lennart Poettering ec1399f567 kernel-install: add add-all verb 2023-11-07 16:07:55 +01:00
Lennart Poettering 9d9e99a8f0 kernel-install: make version/kernel image parameters optional for "add"
Let's make kernel-install a bit easier to use:

If the kernel version is not specified, let's imply "uname -r", so that
we regnerate the entries for the current kernel.

If the kernel image is not specified let's imply using
/usr/lib/modules/$version/vmlinuz, i.e. the location distros like Fedora
drop the kernel into, which we generally recommend people to use.

If the kernel is not found there, don't try to automatically pick the
kernel path, and fail, as before.
2023-11-07 16:07:25 +01:00
Lennart Poettering 658e6cc4ae kernel-install: add command to list installed kernels
This simply dumps the dirs in /usr/lib/modules/ and whether they contain
a vmlinuz binary.
2023-11-07 16:07:05 +01:00
Lennart Poettering 9942f855a9 tree-wide: take in all *our* JSON structures also decimal strings
Let's be friendly in what we accept: whenever we define a JSON
structure, let's also allow decimal strings where we want an integer.

This patch purely replaces JSON_VARIANT_UNSIGNED by
_JSON_VARIANT_TYPE_INVALID in the various JsonDispatch[] tables, so that
we'll happily accept any type in json_dispatch(), so that
json_dispatch_uint64() and related tools can do their thing.

This does not switch over OCI (as a JSON structure not defined by us).
2023-11-07 14:25:40 +01:00
Lennart Poettering 67a3028555 json: teach dispatch logic to also take numbers formatted as strings
JSON famously is problematic with integers beyond 53 bits, because
JavaScript stores everything in double precision floating points.
Various implementations in other languages can deal with signed 64 bit
integers, and a few can deal with unsigned 64bit too (like ours).

Typically program that need more then 53 bit of accuracy encode integers
as decimal strings, to make sure that even if consumers can't really
process larger values they at least won't corrupt the data while passing
it along. This is also recommended by JSON-I (RFC 7493)

To maximize compatibility with other implementations let's add 1st class
parsing support for such objects in the json_dispatch() API.

This makes json_dispatch_uint64() and related calls parse such
integers-formatted-as-decimal-strings as uint64_t. This logic will only
be enabled if the "type" field of JsonDispatch is left unspecified (i.e.
set to negative/_JSON_VARIANT_TYPE_INVALID) though, hence alone does not
change anything in effect.

This purely is about consuming such values, whether we should genreate
them also is a discussion for a separate PR.
2023-11-07 14:25:40 +01:00
Lennart Poettering 6a20a9d286 string-util: add strdup_or_null() helper 2023-11-07 12:23:27 +01:00
Antonio Alvarez Feijoo 14ac242d50 bootspec: fix typo 2023-11-07 11:17:12 +00:00
Iago López Galeiras e720cebf7c test-execute: add no_new_privs tests for SystemCallFilter
When starting a service with a non-root user and a SystemCallFilter and
other settings (like ProtectClock), the no_new_privs flag should not be set.

Also, test that CapabilityBoundingSet behaves correctly, since we need
to preserve some capabilities to do the seccomp filter and restore the
ones set by the service before executing.
2023-11-07 11:31:53 +01:00
Iago López Galeiras 24832d10b6 core: allow using seccomp without no_new_privs when unprivileged
Until now, using any form of seccomp while being unprivileged (User=)
resulted in systemd enabling no_new_privs.

There's no need for doing this because:

* We trust the filters we apply
* If User= is set and a process wants to apply a new seccomp filter, it
will need to set no_new_privs itself

An example of application that might want seccomp + !no_new_privs is a
program that wants to run as an unprivileged user but uses file
capabilities to start a web server on a privileged port while
benefitting from a restrictive seccomp profile.

We now keep the privileges needed to do seccomp before calling
enforce_user() and drop them after the seccomp filters are applied.

If the syscall filter doesn't allow the needed syscalls to drop the
privileges, we keep the previous behavior by enabling no_new_privs.
2023-11-07 11:31:53 +01:00
Mike Yuan e592bf5d11 Merge pull request #29879 from Flowdalic/cgroup-memory-peak
cgroup: add support for memory.peak
2023-11-07 09:53:57 +08:00
Luca Boccassi 58a2ab5e9d Merge pull request #29888 from mrc0mmand/network-generator
test: add a couple of tests for systemd-network-generator
2023-11-07 00:10:43 +00:00
Daan De Meyer 04a8c2ce30 kernel-install: Add --root, --image and --image-policy
Currently only supported for the "inspect" verb as "add" and "remove"
require figuring out what to do with plugins.
2023-11-06 22:29:36 +01:00
Tad Fisher 4ca7c94e16 resolve: use exact-match domain as routing domain for single-labels
With ResolveUnicastSingleLabel=yes, a scope's search domains are affixed to the
query even when a routing domain matches the single-label query name,
preventing the use of dotless single-label domains entirely.

This changes dns_scope_name_wants_search_domain() to return false when the
scope contains an exact match of the single-label name in the query, allowing
lookups for dotless domains with ResolveUnicastSingleLabel enabled.
2023-11-06 22:27:12 +01:00
Luca Boccassi 4a5bf4896f Merge pull request #29882 from keszybz/documentation-cleanup
Documentation cleanup
2023-11-06 21:24:08 +00:00
Luca Boccassi 8691613c68 Merge pull request #29894 from bluca/typo
udev/man typos
2023-11-06 20:29:16 +00:00
Zbigniew Jędrzejewski-Szmek 55e40b0be8 tree-wide: s/life-cycle/lifecycle/g 2023-11-06 20:16:34 +01:00
Luca Boccassi 93c2d8d5c4 test: fix build without SBAT_DISTRO
Follow-up for c9bebec872
2023-11-06 19:05:47 +00:00
Luca Boccassi a6b8ecf304 udev: ressize -> result_size
Lintian flags it as a typo of 'resize', so rename it and make it clearer too
2023-11-06 18:48:25 +00:00
Florian Schmaus 324ec6b5d2 run: include peak memory in output
Fixes #28542.

Signed-off-by: Florian Schmaus <flo@geekplace.eu>
2023-11-06 18:10:06 +01:00
Florian Schmaus 0531bded79 core: include peak memory in unit_log_resources()
Signed-off-by: Florian Schmaus <flo@geekplace.eu>
2023-11-06 18:08:33 +01:00
Florian Schmaus 6c71db763c cgroup: add support for memory.peak
Linux's Control Group v2 interfaces exposes memory.peak, which contains the
"max memory usage recorded for the cgroup and its descendants since the
creation of the cgroup."

This commit adds a new property "MemoryPeak" for units and makes "systemctl
show" display this value if it is available.

Fixes #29878.

Signed-off-by: Florian Schmaus <flo@geekplace.eu>
2023-11-06 18:08:33 +01:00
Frantisek Sumsal cc5244716b network-generator: allow specifying MAC address without MTU
Also, don't panic when both optional arguments are empty. This should
make the syntax compatible-ish with the dracut one from dracut.cmdline(7).

Resolves: #29855
2023-11-06 17:46:59 +01:00
Frantisek Sumsal 923599523c network-generator: correctly handle IPv6 DNS servers in ip=
IPv6 addresses in the ip= assignment need to be enclosed in [], which
was handled for all IP-related fields except for the two optional DNS
fields.
2023-11-06 17:45:57 +01:00
Peter Hutterer 351072ed71 login: switch an if condition to a switch statement
No functional changes but makes the code more readable once we expand
the list of device types.
2023-11-06 17:42:28 +01:00
jjimbo137 b55ca26f5b tcrypt: try all entered passphrases instead of just the first one (#29837)
Previously only the first entered passphrase would be used.  Add the ability to check all the passwords entered by the user.  The total number of passwords entered is still limited by passphrase entry limit.
2023-11-06 16:39:01 +00:00
Antonio Alvarez Feijoo 4697ee9f43 bootctl: fix -q option
Follow up to 14e6e444dd
2023-11-06 16:36:38 +00:00
Yu Watanabe 3296b13b26 Merge pull request #29675 from DaanDeMeyer/kernel-install-json
kernel-install: Add --json option for inspect verb
2023-11-07 01:07:03 +09:00
Luca Boccassi 1e70a3c84f Merge pull request #29872 from yuwata/udevadm-trigger-receive-buffer-size
udevadm-trigger: extend receive buffer size
2023-11-06 14:43:23 +00:00
Lennart Poettering c5d77694eb pcrlock: show emojis for each PCR line
I am sorry, I totally forgot adding emojis reflecting the state of each
PCR. I hope I can do better in future, and hereby I'd like to rectify
the situation a bit.
2023-11-06 14:42:20 +00:00
Daan De Meyer bdd36c003d kernel-install: Add --json option for inspect verb
In mkosi, we can't use kernel-install directly but we do want to
mimick its behavior as much as possible. Let's make that easier by
making it easy to fetch data from kernel-install as JSON.

To get all the necessary data, we extend the inspect verb to also
allow passing in a kernel version and initrds, to mimick the "add"
verb. The kernel version is used to determine the "Entry Directory",
and in absence of auto-detection of kernel version in kernel-install
we have to allow users to pass it.

We also add --no-pager while we're at it.
2023-11-06 14:43:09 +01:00
Daan De Meyer ad6216cbc7 boot-entry: Add boot_entry_token_type_to_string() 2023-11-06 14:39:01 +01:00
Sam Leonard 4291f4461e vmspawn: extend kernel cmdline with extra args
This changes how the "extra" command line arguments passed to vmspawn
are handled.

Previously they were appended to the QEMU command line directly.
Now they are appended to the kernel command line using SMBIOS instead.
2023-11-06 11:46:38 +00:00
Yu Watanabe eba449fa81 sd-device-monitor: unconditionally increase buffer size by sd_device_monitor_new()
As suggested at https://github.com/systemd/systemd/pull/29872#discussion_r1382932633:
> socket memory is these days accounted to the process that owns a socket,
> hence we shouldn't be too concerned that this might waste memory.
2023-11-06 20:39:51 +09:00
Yu Watanabe 986e182352 network: do not try to set invalid value for IPv6 hop limit 2023-11-06 15:53:25 +09:00
Yu Watanabe 39713b075f network: fix indentation
Follow-up for f141b2c053.
2023-11-06 15:53:01 +09:00
Yu Watanabe 93e583aaba Revert "ndisc: Also set link hoplimit"
This reverts commit 0ba8374bb8.

- link->network->ipv6_hop_limit must not be updated, as it may be used
  by multiple interfaces,
- We may receive multiple RA from multiple routers with different hop
  limit, and we should not make the default hop limit flicking,
- First of all, there is no reason that we need to update the default hop
  limit,
- The original issue should be caused by the hash and compare functions
  for Route object.
2023-11-06 15:33:10 +09:00