Commit Graph
51236 Commits
Author SHA1 Message Date
Peter Hutterer 305272ab2b logind: add support for hidraw devices
Add support for opening /dev/hidraw devices via logind's TakeDevice().
Same semantics as our support for evdev devices, but it requires the
HIDIOCREVOKE ioctl in the kernel.
2024-10-03 09:36:57 +01:00
Antonio Alvarez Feijoo 16b50d4018 core: fix copy/paste error 2024-10-02 22:15:41 +01:00
Luca Boccassi 394c61416c core: load IPE policy on boot
IPE is a new LSM being introduced in 6.12. Like IMA, it works based on a
policy file that has to be loaded at boot, the earlier the better. So
like IMA, if such a policy is present, load it and activate it.

If there are any .p7b files in /etc/ipe/, load them as policies.
The files have to be inline signed in DER format as per IPE documentation.

For more information on the details of IPE:

https://microsoft.github.io/ipe/
2024-10-02 18:29:43 +02:00
Daan De Meyer 5f44675120 homectl: Acquire bus connection after querying for user input
Otherwise when the user takes a long time to enter input the operation
to create the user's home will fail with "transport endpoint not connected".
2024-10-02 15:08:50 +02:00
Daan De Meyer 84edd52121 home: Prompt for shell in homectl firstboot 2024-10-02 15:08:35 +02:00
Daan De Meyer 164ca24d74 home: Prompt for auxiliary groups in homectl firstboot 2024-10-02 15:07:59 +02:00
Daan De Meyer ec75a254d2 Move show_menu() to terminal-util.h 2024-10-02 15:05:24 +02:00
Daan De Meyer c73d14c43e tree-wide: Fix Wformat warnings
The latest clang has started catching more integer promotions which
cause us to pass the wrong type to printf() format specifiers so let's
fix those.
2024-10-02 11:26:58 +02:00
Daan De Meyer f02f8b3ca7 Merge pull request #34546 from ikruglov/ikruglov/refactor-GetMachineAddresses
machine: generalise logic of GetMachineAddresses/GetOsRelease to later use it in corresponding varlink interfaces
2024-10-02 10:24:59 +02:00
Lennart Poettering bd4beaa2eb tree-wide: always do dlopen() with RTLD_NOW + RTLD_NODELETE
Let's systematically use RTL_NOW|RLTD_NODELETE as flags passed to
dlopen(), across our codebase.

Various distros build with "-z now" anyway, hence it's weird to specify
RTLD_LAZY trying to override that (which it doesn't). Hence, let's
follow suit, and just do what everybody else does.

Also set RTLD_NODELETE, which is apparently what distros will probably
end up implying sooner or later anyway. Given that for pretty much all
our dlopen() calls we never call dlclose() anyway, let's just set this
everywhere too, to make things systematic.

This way, the flags we use by default match what distros such as fedora
do, there are no surprises, and read-only relocations can be a thing.

Fixes: #34537
2024-10-02 07:13:21 +02:00
Ivan Kruglov 31f9f589a8 machine: generalise logic GetOSRelease to later use it in varlink interface 2024-10-01 19:00:25 +02:00
Ivan Kruglov f1daf9fb74 machine: generalise logic GetMachineAddresses to later use it in varlink interface 2024-10-01 19:00:25 +02:00
Lennart Poettering 0a73c8e7b8 linux: import input.h and friends
The CIs apparently have rally old headers, where KEY_BRIGHTNESS_AUTO is
missing, let's hence ship our own copies from a current kernel.
2024-10-01 18:35:00 +02:00
Lennart Poettering 5b80cef69f Revert "Preset user units on first boot as well"
This reverts commit 0a40325573.
2024-10-01 17:33:44 +02:00
Daan De Meyer 9fd8a9dffe Add %posttrans versions of the systemd %postun scriptlets
On upgrades, only the %postun scriptlets of the old package version
run. This means that any changes related to restarting daemons require
two releases before they're actually used.

%postun is used because it runs after the old package has been removed,
which is important as it means any lingering dropins from the old package
will have been removed as well.

To allow deploying fixes in just a single release while still running after
the old package has been removed, let's introduce %posttrans versions of these
scriptlets as %posttrans of the new package runs on upgrade and install after
the old package has been removed.
2024-10-01 12:12:40 +02:00
Daniel Dawson 0c96911afb systemd-integritysetup: accept integrity-algorithm=xxhash64
Signed-off-by: Daniel Dawson <danielcdawson@gmail.com>
2024-10-01 11:16:14 +02:00
Daan De Meyer bfc48578eb Merge pull request #34582 from DaanDeMeyer/repart
repart: copy denylist fixes
2024-10-01 08:51:01 +02:00
Lennart Poettering 0376ef36a1 json: add json_dispatch_const_user_group_name()
This is the same as json_dispatch_user_group_name() but fills in the
string as "const char*" to the JSON field. Or in other words, it's what
sd_json_dispatch_const_string() is to sd_json_dispatch_string().

Note this drops the SD_JSON_STRICT flags from various dispatch tables
for these fields, and replaces this by SD_JSON_RELAX, i.e. the opposite
behaviour. As #34558 correctly suggests we should validate user names
in lookup functions using the lax rules, rather than the strict ones,
since clients not knowing the rules might ask us for arbitrary
resolution.

(SD_JSON_RELAX internally translates to valid_user_group_name() with the
VALID_USER_RELAX flag).

See: #34558
2024-10-01 08:32:00 +02:00
Daan De Meyer 86c4a000c4 Merge pull request #34583 from DaanDeMeyer/ukify
ukify: Use SizeOfImage from linux image as virtual size of .linux section
2024-09-30 19:54:37 +02:00
Mike Yuan a48c1699eb Merge pull request #34564 from YHNdnzj/systemctl-status-job-id
systemctl: also show job id in status output
2024-09-30 17:39:19 +02:00
Mike Yuan c52b2b6518 Merge pull request #34508 from intelfx/work/fix-io-reporting
core/cgroup: cache IO accounting data when pruning a cgroup
2024-09-30 17:38:00 +02:00
Daan De Meyer 7af304d3b6 ukify: Remove special casing for .linux section
Now that we properly leave sufficient space for inline execution of
the .linux section, let's remove the special casing of the .linux
section as it doesn't need to be the last section anymore now.
2024-09-30 16:15:16 +02:00
Daan De Meyer 2188c759f9 ukify: Use SizeOfImage from linux image as virtual size of .linux section
The SizeOfImage is bigger than the image itself so that space is
guaranteed to be available for in place execution of the linux image. Let's
make sure we take this into account and use SizeOfImage as the section's virtual
size instead of the size of the image itself.

Fixes #34578
2024-09-30 15:52:59 +02:00
Yu Watanabe 82f2c33db5 tpm2-util: show loaded libraries in 'systemd-analyze has-tpm2'
After 3b16e9f419, even the libraries are
documented in the man page, it is useful to mention which libraries are
checked in the command output.

Of course, the dependencies are kind of implementation detail, and may
be changed in the future version, but that's especially why I think
showing the library deps in the output is useful.

systemd-analyze is a debugging tool, and already shows many internal
states. I think there is nothing to prevent from showing the deps.

Prompted by #34477.
2024-09-30 15:40:14 +02:00
David Tardon cd9c3327cb logind-dbus: really cancel scheduled shutdown
Fixes #34554
2024-09-30 15:13:00 +02:00
Daan De Meyer 83d4c135e8 ukify: Drop unused size() method 2024-09-30 13:42:23 +02:00
Daan De Meyer 0bbe63fc66 repart: Apply denylist to individual files as well 2024-09-30 13:41:26 +02:00
Daan De Meyer dc4710ceb2 repart: Shortcut copy if source or target starts with exclude path
If the source or target we're copying to is a subdirectory of any of the
directories specified in ExcludeFiles= or ExcludeFilesTarget=, shortcut the
entire copy operation.
2024-09-30 13:41:11 +02:00
Zbigniew Jędrzejewski-Szmek d713c131a5 Merge pull request #34572 from keszybz/fix-printing-of-RootImageOptions
Fix printing of RootImageOptions
2024-09-28 17:23:44 +02:00
Mike Yuan 6fd58537e5 Merge pull request #34548 from SimonPilkington/fix-creds-cat
creds: fix cat with encrypted credentials
2024-09-27 20:51:57 +02:00
Zbigniew Jędrzejewski-Szmek 8dc40c25a4 shared: adjust whitespace and formatting 2024-09-27 20:19:58 +02:00
Zbigniew Jędrzejewski-Szmek 69c751c61c systemctl: fix printing of RootImageOptions
The type is a(ss), so a custom printer is required.

Fixes https://github.com/systemd/systemd/issues/33967.
2024-09-27 20:19:58 +02:00
Mickaël Salaün e996663475 seccomp-util: include @sandbox in @default
Every services and containers should be able to protect their users and
limit the impact of security bugs thanks to the security syscalls
provided by seccomp and Landlock.  The goal of these syscalls is to
improve security with additional restrictions.  They are designed to be
safely used by unprivileged (and then potentially malicious) users.

Remove the now-redundant "seccomp" entry for nspawn.
2024-09-27 12:37:37 +02:00
Mike Yuan b1ec48369c systemctl: also show job id in status output
Prompted by one ASG talk ;)
2024-09-26 17:59:00 +02:00
Mike Yuan cdf684fc00 shared/bus-map-properties: move bus_map_job_id() from wait-for-units 2024-09-26 17:59:00 +02:00
Simon Pilkington 32951fe4de creds: fix cat with encrypted credentials
Fixes: https://github.com/systemd/systemd/issues/34547
2024-09-25 11:25:48 +02:00
Daan De Meyer e11745d000 repart: Determine verity sig size based on partition designator
Verity= is an image build concept, not a first boot concept, whereas
a partition designator is always available, so let's do the size stuff
based on that.
2024-09-24 09:07:41 +02:00
Ivan Shapovalov 17bbdefd8c core/cgroup: cache IO accounting data when pruning a cgroup
When removing a cgroup in unit_prune_cgroup(), read IO metrics to cache
them similar to the existing treatment of the CPU and memory usage data.

Note that we do not do this for the IP metrics as the firewall objects
are only destroyed in unit_free() and thus stay alive long enough to
be read out directly by all interested parties.

Fixes #26988.
2024-09-23 20:12:58 +02:00
Daan De Meyer 942eba930b repart: Use swap format for swap partition even if encrypted 2024-09-23 10:44:37 +02:00
Daan De Meyer f3b8e81f54 repart: Add a log message when we're about to fsync(). 2024-09-23 10:43:42 +02:00
Daan De Meyer 0a40325573 Preset user units on first boot as well
We need to make sure the presets from /usr/lib/systemd/user-preset
are applied as well. Currently only the ones from
/usr/lib/systemd/system-preset are applied.
2024-09-21 13:57:29 +09:00
Yu Watanabe bfa834f138 Merge pull request #34511 from YHNdnzj/strv-extend-strv-consume
basic/strv: introduce strv_extend_strv_consume()
2024-09-21 13:57:02 +09:00
Yu Watanabe f48bc69ca1 Merge pull request #34502 from yuwata/strv_find_closest
strv: introduce strv_find_closest()
2024-09-21 13:56:34 +09:00
Ivan Shapovalov a0020ad84b core/cgroup: drop allow_cache parameter in unit_get_io_accounting()
The name of the parameter is misleading and it does not save us much
work because it is not used during regular unit property queries.
It is only used during unit_log_resources(), and the cgroup is already
dead by that point so it won't be read anyway.
2024-09-21 05:45:36 +02:00
Mike Yuan a2c8652a2a tree-wide: use strv_extend_strv_consume() where appropriate 2024-09-21 00:53:50 +02:00
Mike Yuan 8a7ade7427 basic/strv: introduce strv_extend_strv_consume() 2024-09-21 00:53:49 +02:00
Mike Yuan f3270bed48 machined-dbus: move manager_add_machine() and _get_machine_by_pid() to -core 2024-09-21 00:35:38 +02:00
Mike Yuan 85ab917bc8 machined: rename machine_{units,leaders} to machines_by_*
Also port machines_by_leader to store PidRef-s.
2024-09-21 00:35:38 +02:00
Mike Yuan 533c20ca5b machined: fix bogus error check for machine_link() 2024-09-21 00:18:41 +02:00
Mike Yuan 527b9e2437 basic/strv: make string_strv_hash_ops static, add missing assertions 2024-09-20 22:44:35 +02:00