Commit Graph
264 Commits
Author SHA1 Message Date
Gabríel Arthúr Pétursson 47b425de0c shared: Move cryptsetup-tpm2.[ch] from systemd-cryptsetup 2024-02-01 11:57:52 +00:00
Lennart Poettering b68f4cade4 dissect: add --make-archive option to convert DDI to tarball 2024-01-25 18:47:39 +01:00
Zbigniew Jędrzejewski-Szmek 04a7790f23 meson: use a single line for one-item file lists
That file was mixing two styles, which looks ugly. Let's not make
the file unnecessarily long.
2024-01-25 13:50:09 +01:00
Lennart Poettering 0a6598bb38 hostnamed: add simple Varlink API, too 2024-01-09 10:46:25 +01:00
Lennart Poettering 76511c1bd3 shared: add new "vpick" concept for ".v/" directories that contain versioned resources
This adds a new concept for handling paths. At appropriate places, if a
path such as /foo/bar/baz.v/ is specified, we'll
automatically enumerate all entries in /foo/bar/baz.v/baz* and then
do a version sort and pick the newest file.

A slightly more complex syntax is available, too:

/foo/bar/baz.v/quux___waldo

if that's used, then we'll look for all files matching
/foo/bar/baz.v/quux*waldo, and split out the middle, and version sort
it, and pick the nwest.

The ___ wildcard indicates both a version string, and if needed an
architecture ID, in case per-arch entries shall be supported.

This is a very simple way to maintain versioned resources in a dir, and
make systemd's components automatically pick the newest. Example:

    /srv/myimages.v/foobar_1.32.65_x86-64.raw
    /srv/myimages.v/foobar_1.33.45_x86-64.raw
    /srv/myimages.v/foobar_1.31.5_x86-64.raw
    /srv/myimages.v/foobar_1.31.5_arm64.raw

If now nspawn is invoked like this:

    systemd-nspawn --image=/srv/myimages.v/foobar___.raw

Then it will automatically pick
/srv/myimages.v/foobar_1.33.45_x86-64.raw as the version to boot on
x86-64, and /srv/myimages.v/foobar_1.31.5_arm64.raw on arm64.

This commit only adds the basic implementation for picking files from a
dir, but no hook-up anywhere.
2024-01-03 18:38:46 +01:00
Lennart Poettering c5c74d85d3 networkd: add basic Varlink interface
Let's get networkd onto Varlink. This only adds the most basic of
operations.

I'd love to see networkd do Varlink for all its basic operations so that
networkctl can use that, and work correctly before D-Bus is up. Right
now, many of networkctls calls simply don't work before D-Bus, and I'd
like to see that improved.
2023-12-22 11:54:43 +09:00
Lennart Poettering aafd495af8 Merge pull request #30547 from poettering/uid0
add new "uid0" command as alternative multi-call interface for systemd-run, as sudo replacement
2023-12-21 22:45:15 +01:00
Lennart Poettering 644f19c75c creds: add varlink API for encrypting/decrypting credentials 2023-12-21 19:19:12 +01:00
Lennart Poettering eee799fa86 color-util: split out HSV color conversion into color-util.[ch] 2023-12-21 19:15:01 +01:00
Lennart Poettering aa25e19b47 util-lib: share plymouth client code
Let's add a new "plymouth-util.c" module with helpers for talking to
plymouth. We so far had three places for this, let's unify the code
doing this a bit.
2023-11-13 14:17:05 +00:00
Luca Boccassi 8d04721507 Merge pull request #28891 from poettering/pcrlock
new pcrlock tool for generating signed PCR policies for PCR 0, 1, 4, …
2023-11-03 16:07:43 +00:00
Luca Boccassi 1af46aecf5 Merge pull request #29508 from CodethinkLabs/systemd-vmspawn-pr
systemd-vmspawn implementation that only supports disk images
2023-11-03 16:04:38 +00:00
Lennart Poettering a63b260166 tpm2-util: add various uefi event log definitions 2023-11-03 11:19:46 +01:00
Lennart Poettering 5b5f8f8b9a firewall: make libiptc dependency a dlopen() one 2023-11-03 09:30:24 +01:00
Lennart Poettering 2bdd7a8ac9 meson: make sure we never actually link to libxenctrl
We don't make use of any of its symbols, we just want the headers, hence
make sure we never try to link against it.
2023-11-02 17:27:07 +00:00
Sam Leonard e8ac916ec3 nspawn: moved nspawn-creds.[ch] to shared/machine-credential.[ch]
This was done in order to allow sharing of this code between
systemd-nspawn and systemd-vmspawn.
2023-11-02 15:37:40 +00:00
David Tardon 4ffe0aedf9 varlink: define interface io.systemd.service 2023-10-31 12:49:16 +01:00
Lennart Poettering 4cdef9f08c pcrextend: split out word to measure code into shared helper file
Let's split out the logic that actually generates the word to measure to
PCRs into a new helper file pcrextend-util.[ch].

This we can later reuse to calculate PCR measurement predictions ahead
of time.
2023-10-23 11:24:18 +01:00
Lennart Poettering f5151fb459 sysext: make some calls available via varlink 2023-10-16 12:08:39 +02:00
Lennart Poettering 4e16d5c69e pcrextend: make pcrextend tool acccessible via varlink
This is primarily supposed to be a 1st step with varlinkifying our
various command line tools, and excercise in how this might look like
across our codebase one day. However, at AllSystemsGo! 2023 it was
requested that we provide an API to do a PCR measurement along with a
matching event log record, and this provides that.
2023-10-06 11:49:38 +02:00
Lennart Poettering abef4a7b3c tree-wide: make all our Varlink APIs introspectable 2023-10-06 11:49:38 +02:00
Lennart Poettering f946d4c9ec varlink: add introspection data for the org.varlink.service and io.systemd interfaces
The official org.varlink.service interface definition, as per:

https://varlink.org/Service

And the io.systemd service where we carry some super generic errors our
Varlink implementation generates.
2023-10-06 11:49:38 +02:00
Lennart Poettering e50b2a93d6 varlink: add IDL/introspection logic 2023-10-06 11:49:38 +02:00
Yu Watanabe 1e09470303 journald: move and rename journal/managed-journal-file.[ch] -> shared/journal-file-util.[ch]
The files are used by both journald and journal-remote.
Let's move them to src/shared.
2023-10-02 10:52:45 +09:00
Mike Yuan 54d7fcc6a3 sleep-util: split into sleep-config and hibernate-util 2023-09-27 21:48:39 +08:00
Jan Janssen 90461ef56f meson: Fix version script handling
Build targets should have a link dependency on the version scripts they
use. This also uses absolute paths in anticipation for meson 1.3
needlessly deprecating file to string conversions.
2023-09-26 19:41:53 +02:00
Thorsten Kukuk 53c0397b1d shared/wall: use logind if build without utmp support
If systemd is build without utmp support, use sd_get_sessions() in
utmp_wall() to get a list of logged in users with the corresponding tty.
2023-09-06 13:19:26 +01:00
Lennart Poettering 0786b03969 shared: add common implementation of PE parser 2023-08-29 11:25:52 +02:00
Jan Janssen 9ee80846f8 meson: Convert fidsk to meson feature
By making this a disabler dependency, we can slightly simplify the code
and it als fixes the build for -Dfdisk=disabled as we failed to create a
fallback empty libshared_fdisk variable.
2023-08-23 14:45:02 +02:00
Yu Watanabe 40c7d3c713 meson: unconditionally add version dependency for all executables and libraries
Otherwise, we can easily forget the dependency.
No functional change, just refactoring.
2023-07-30 05:36:22 +09:00
Luca Boccassi b0d3095fd6 Drop split-usr and unmerged-usr support
As previously announced, execute order 66:

https://lists.freedesktop.org/archives/systemd-devel/2022-September/048352.html

The meson options split-usr, rootlibdir and rootprefix become no-ops
that print a warning if they are set to anything other than the
default values. We can remove them in a future release.
2023-07-28 19:34:03 +01:00
Egor IgnatovandDmitry V. Levin 1d8aae4327 shared: add libpasswdqc support
Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
Resolves: #15055
2023-07-06 10:59:41 +00:00
Egor IgnatovandDmitry V. Levin d34b1823ca shared: add password quality check abstraction layer to support both pwquality and passwdqc
Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2023-07-06 10:59:41 +00:00
Lennart Poettering f76ce81b91 execute: fix credential dir handling for fs which support ACLs
When the credential dir is backed by an fs that supports ACLs we must be
more careful with adjusting the 'x' bit of the directory, as any chmod()
call on the dir will reset the mask entry of the ACL entirely which we
don't want. Hence, do a manual set of ACL changes, that only add/drop
the 'x' bit but otherwise leave the ACL as it is.

This matters if we use tmpfs rather than ramfs to store credentials.
2023-07-04 22:58:01 +02:00
Lennart Poettering 7e14a308cf shared: move async.[ch] from src/basic/ → src/shared/
That way we can later add an async wrapper for rm_rf() which is in
src/shared/, too.
2023-06-23 10:02:15 +02:00
Lennart Poettering 4014172a8b sleep: rename sleep-config.[ch] → sleep-util.[ch]
The file long ceased to be exclusively about configuration of the sleep
operation. It contains many many calls for other purposes, hence give it
a more generic name.
2023-06-20 14:18:52 +02:00
Lennart Poettering 18cad4ebda Merge pull request #27846 from keszybz/link-mode-generation
Autogenerate list of link modes
2023-06-13 23:03:51 +02:00
Lennart Poettering 8a8b4a8784 shared: move uid-alloc-range.[ch] from src/shared/ → src/basic/
This way we can use it in libsystemd
2023-06-08 09:32:04 +02:00
Zbigniew Jędrzejewski-Szmek 1e473c2ebb meson: use "cpp -E -dM" to process header file
This was requested in review:
https://github.com/systemd/systemd/pull/27846#discussion_r1210383265

I kept this as separate commit because the change would impact both of
the previous commits and splitting it up seems like unnecessary work.
The result is unchanged.

v2:
- use universal_newlines=True to keep compat with Python 3.6 on C8S.
2023-06-07 10:48:36 +02:00
Lennart Poettering af4e8e86ec battery-util: split out code that checks AC power state into its own .c/.h pair
No code change, just some splitting out of the relevant code from
udev-util.[ch].

This makes sense on its own, but is also prepartion to move the code
that checks for low battery state into battery-util.[ch], too.
2023-06-05 12:18:21 +02:00
Daan De Meyer 0690160e2c label: Rename to label-util.h 2023-05-30 14:50:56 +02:00
Zbigniew Jędrzejewski-Szmek c18dde32e5 man: generate link mode list dynamically
The entries are sorted by speed. Some fields are left empty when there is no
clear value to use. The table is much longer now, but I think it's better to
document the allowed values, even if some are not terribly useful.

Fixes #26256.
2023-05-30 13:05:33 +02:00
Zbigniew Jędrzejewski-Szmek 6049ddcca2 shared/ethtool-util: autogenerate table of link mode names
We updated this table manually, but the kernel adds new modes periodically
and we forget to do that. So let that happen automatically whenever we import
new kernel headers.

C.f. 72dda93acb.

Effectively, this adds:
        [ETHTOOL_LINK_MODE_10baseT1L_Full_BIT]             = "10baset1l-full",
        [ETHTOOL_LINK_MODE_800000baseCR8_Full_BIT]         = "800000basecr8-full",
        [ETHTOOL_LINK_MODE_800000baseKR8_Full_BIT]         = "800000basekr8-full",
        [ETHTOOL_LINK_MODE_800000baseDR8_Full_BIT]         = "800000basedr8-full",
        [ETHTOOL_LINK_MODE_800000baseDR8_2_Full_BIT]       = "800000basedr8-2-full",
        [ETHTOOL_LINK_MODE_800000baseSR8_Full_BIT]         = "800000basesr8-full",
        [ETHTOOL_LINK_MODE_800000baseVR8_Full_BIT]         = "800000basevr8-full",

N_ADVERTISE needed to be increased because we need more bits.
2023-05-30 13:05:33 +02:00
Wolfgang Müller 38fc5e0314 cryptsetup-fido2: Depend on libcryptsetup
crypsetup-fido2 always depended on both libfido2 and libcryptsetup, but
0a8e026e82 forgot to make the then
implicit dependency on libcryptsetup explicit when moving it from
cryptsetup/ to shared/. This breaks builds when libfido2 is autodetected
but the system is missing libcryptsetup.

Introduce an explicit check for HAVE_LIBCRYPTSETUP such that
cryptsetup-fido2 is only built when both libraries are available.

Fixes #27374.
2023-04-25 02:00:16 +01:00
Lennart Poettering b3a062cb80 lsm-util: move detection of support of LSMs into a new lsm-util.[ch] helper
This makes the bpf LSM check generic, so that we can use it elsewhere.
it also drops the caching inside it, given that bpf-lsm code in PID1
will cache it a second time a stack frame further up when it checks for
various other bpf functionality.
2023-04-18 08:22:21 +02:00
Lennart Poettering d452335aa4 dissect: add image dissection policy framework 2023-04-05 20:44:36 +02:00
Luca Boccassi d51f8eb366 rename extension-release.[c|h] -> extension-util.[c|h]
It will be used for other extension DDI validation, not just for extension-release
validation
2023-03-30 11:25:17 +01:00
Yu Watanabe 9e43296fd2 bootctl: split-out entry token related definitions into boot-entry.[ch]
No functional change, just preparation for later commits.
These can be used in kernel-install later.

Note, unlike the our usual coding style, the arguments for
boot_entry_token_ensure() and parse_boot_entry_token_type() are
referenced, updated, and may freed, hence, always pass initialized
values. That's why they are not named as 'ret_xyz'.
2023-03-27 09:51:18 +02:00
Yu Watanabe 5689e161cf util: rename uki-util.[ch] -> kernel-image.[ch]
As the file contains functions not only for UKI.
2023-03-21 16:49:26 +09:00
Yu Watanabe 16af02cd97 uki-util: move functions for inspecting kernel to uki-util.[ch] 2023-03-17 20:40:34 +09:00