Commit Graph
7247 Commits
Author SHA1 Message Date
Aleksa Sarai 44cc69769d hostnamed: expose parsed TAGS in Describe
The DBus API already exposes the parsed machine-tags list via the Tags
property but varlink clients needed to parse the raw TAGS= line from
MachineInformationData (which also required implementing tag name
validation if the tags would later be used with SetTags, to avoid
spurious errors).

So, provide the same information that DBus gets (a list of pre-parsed
tags with bad tags gracefully removed) as a new MachineTags field
returned by Describe -- this does mean that the DBus API now exposes the
same data in two ways but making Describe() consistent is more important
and mirrors the OperatingSystem* class of properties.
2026-08-23 14:10:22 +01:00
lucia-huang7 ed22b5a77f discover-image: rename image sidecar files from old paths
image_rename() updated the Image object name and path before
computing the source paths for auxiliary files. As a result, the
auxiliary rename loop looked for files with the new image name,
while existing sidecars such as .roothash, .verity, and
.raw.tpmstate still used the old image name.

Delay updating the Image object until after renaming its settings
and auxiliary files. This lets image_auxiliary_path() resolve
existing sidecars from the old image name while
rename_auxiliary_file() assigns the new name.

Extend the import test raw image rename coverage to check
representative sidecars are renamed together with the image.
2026-08-22 11:31:55 +09:00
tunaichao 641c19e21e core: apply UnsetEnvironment= after command line expansion
UnsetEnvironment= was applied to the environment block before the
command line was expanded. Since the expansion looks the variables up
in that same block, any variable listed in UnsetEnvironment= was
already gone when $VAR in ExecStart= and friends was expanded, and a
whole-word $VAR reference was dropped from the command line.

Let the expansion see the full environment block, and apply the
unsetting only to the environment block passed to the executed
process. This way UnsetEnvironment= can hide variables from the
executed process without breaking command lines that reference them.

Extend the exec-unsetenvironment test accordingly: the whole-word
$VAR6 argument must be expanded into a positional parameter for the
shell, while ${VAR6-X} must evaluate to X in the executed process.

Also document in both the UnsetEnvironment= description and the
"Environment Variables in Spawned Processes" section that the
unsetting happens after command line variable expansion.

Fixes: #43343
2026-08-22 04:27:27 +09:00
Yu Watanabe 80e346af74 test: add test cases for systemd-sysctl --save= and --revert= 2026-08-21 00:48:25 +09:00
Yu Watanabe 1c223728cf sysctl: skip leading whitespaces and ignore arguments start with '#' when --inline 2026-08-21 00:40:53 +09:00
Yu Watanabe 5c76cb0e27 sysctl: --inline requires positional arguments 2026-08-21 00:40:53 +09:00
Chris Coulson 768b6f21ec report: Add a TPM2 signing backend
This adds an initial TPM2 implementation of the io.systemd.Report.Signer
interface, which returns a set of signed TPM attestations that also
includes the supplied report digest.

The returned report consists of multiple components:
- A signed PCR quote generated with TPM2_Quote.
- Signed NvPCR attestations generated with TPM2_NV_Certify.
- A signed audit session attestation generated with
  TPM2_GetSessionAuditDigest.

Each signed report component includes the JSON encoded TPMS_ATTEST
attestation structure and corresponding signature, in both PEM encoded
form and as a JSON encoded TPMT_SIGNATURE structure.

NvPCR report components also include the readable name of the NvPCR, the
NV index public area as the JSON encoded TPMS_NV_PUBLIC structure, and some
additional authenticated data that is digested and supplied as the
qualifying data to the TPM2_NV_Certify command. This authenticated data
includes the NvPCR name and priority.

The report digest that is supplied via varlink is supplied as the
qualifying data to the audit session attestation.

The returned report also includes the event log which is retrieved from
pcrlock's varlink interface, and the public area of the signing key in
both PEM encoded form and as a JSON encoded TPMT_PUBLIC structure.

The audit session attestation is always the last component. The
preceding components are all executed with the audit session, and the
signer requires the audit session to remain exclusive whilst generating
the report. What this does is provide evidence to a verifier that the
overall report is a single, consistent snapshot of the system (ie, no
other TPM commands executed whilst generating the report) because the
audit session attestation contains a field that indicates that the
session was exclusive at the time it was attested.

The set of attested PCRs and NvPCRs are currently hardcoded. It includes
all firmware PCRs with the exception of PCR6, and all other PCRs with
the exception of the IMA one (which isn't useful on its own without the
IMA log). All defined NvPCRs are included.

A verifier can verify the signed attestation components individually by
verifying their signatures against the supplied attestation data, using
the supplied public key.

For the PCR report component, a verifier can replay the measurements in
the log in order to reconstruct the PCR values, and then use this and
the PCR selection from the attestation in order to calculate the PCR
digest, and then check that this matches the one in the attestation.

For the NvPCR report components, a verifier checks that the NV index
name in the attestation matches one that is anchored in PCR9 to be sure
that the attestation is for a valid NvPCR. A verifier can then replay
the measurements in the log to ensure that the resulting NvPCR value
matches the one supplied in the attestation. The authenticated data is a
JSON blob containing the NvPCR name and priority. A verifier can digest
this and ensure it matches the qualifying data in the attestation.

The audit session attestation includes the audit session digest and
whether the audit session was still exclusive when the attestation was
generated. A verifier should confirm exclusivity. The digest includes a
record of all TPM commands executed with the audit session, as each
command results in it being extended with the command parameter hash and
the result parameter hash. A verifier should replay the preceding report
components to compute an expected audit digest and make sure that this
digest matches the one in the attestation in order to be sure that the
overall report represents a single, consistent snapshot. The other
report components provide sufficient information for a verifier to
reconstruct the cpHash and rpHash.

When reconstructing the cpHash for the PCR and NvPCR components, the
signing scheme is the NULL scheme (they use the attestation key's
signing scheme). The required signing key public area is supplied in
the report. The supplied qualifying data is in the extra data field of
the attestation.

The PCR selection is also required to reconstruct the cpHash for the
PCR component. The PCR selection is available in the attestation.

The name of the NV index is also required to reconstruct the cpHash for
the NvPCR components. The name is available in the attestation.

The rpHash for each component can be reconstructed from the supplied
attestation blob and signature.

In the future, we might want to add more report component types. Eg, we
could add report components for ordinary NV indexes. Using the audit
session means that we could also add additional components that the TPM
can't attest directly, such as the values of interesting TPM properties
(as the TPM2_GetCapability calls will appear in the audit session digest).

The attestation signing key is stored as a JSON file in the report
signer's state directory. Different types of keys are supported:
- Ordinary keys that are protected by an existing persistent TPM key
  such as the SRK or EK.
- Persistent TPM keys.
- Primary keys, which are recreated using a template on use.

When an ordinary or primary key is used, the report signer saves the
object context in its runtime directory. This context is used on future
invocations. This has the benefit that where a primary key is used, it
doesn't need to be recreated on each use. When an ordinary key is used,
we don't need to run TPM2_Load, which requires authorization with the
parent key, on each This authorization currently requires a policy
session for low-range EKs.

Regardless of the key type, it must be a restricted signing key. If no
key exists, an ordinary key is generated automatically.

The attestation key can also have an associated credential which is
attached to the signed report. The credential can be issued by a CA or
some other party during onboarding, and is presented to a verifier as
proof that the attestation key is authentic. It is considered an opaque
blob in order to not require it to be a specific format, such as a X.509
certificate. I've called this a "voucher" though because "cred" or
"credential" has other meanings in systemd.

As a follow-up to this, I plan to add a varlink interface for creating
attestation keys that can be used for report signing.
2026-08-20 15:30:20 +02:00
Yu Watanabe e67956f31c Another batch of conversions to COMMAND and additions of --introspect-cli (#43436)
This is another batch of straightforward conversions. I wanted to do
udevadm here too, but it requires some design work.
2026-08-20 01:41:53 +09:00
Zbigniew Jędrzejewski-Szmek 963b2323ef report-sign-tsm: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The abstract is now wrapped automatically.
2026-08-19 08:21:30 +02:00
Zbigniew Jędrzejewski-Szmek 8d8cf2cf1a report-sign-plain: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added.
2026-08-19 08:21:30 +02:00
Zbigniew Jędrzejewski-Szmek 578e5c1b38 report-files: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek 8f42146976 report-cgroup: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The referenced systemd-report-cgroup(8) man
page does not exist, so the reference is dropped.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek 45966bcf8e report-basic: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The abstract gets a trailing period. There is
no man page for this helper, so none is referenced.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek c226b876c0 pull: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. There is no man page for this internal helper,
so none is referenced.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek 9832927a08 import-fs: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. There is no man page for this internal helper,
so none is referenced.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek 3e61b718a5 import: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. There is no man page for this internal helper,
so none is referenced.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek 3a45066bce export: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. There is no man page for this internal helper,
so none is referenced.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek df618014a5 udev/scsi_id: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The abstract is changed to the imperative.
There is no man page for this udev helper, so none is referenced.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek 9cd507ed5b udev/v4l_id: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The abstract is changed to the imperative.
There is no man page for this udev helper, so none is referenced.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek 7038981d86 udev/mtd_probe: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. There is no man page for this udev helper, so
none is referenced.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek 5b745242c5 udev/fido_id: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. There is no man page for this udev helper, so
none is referenced.
2026-08-19 08:21:29 +02:00
Zbigniew Jędrzejewski-Szmek c90fafdd04 udev/dmi_memory_id: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The help output had no abstract, so one is
added. There is no man page for this udev helper, so none is referenced.
2026-08-18 23:04:06 +02:00
Zbigniew Jędrzejewski-Szmek cc139a73b8 udev/cdrom_id: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The help output had no abstract, so one is
added. There is no man page for this udev helper, so none is referenced.
2026-08-18 23:04:06 +02:00
Zbigniew Jędrzejewski-Szmek 43c9d274e9 udev/ata_id: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The help output had no abstract, so one is
added. There is no man page for this udev helper, so none is referenced.
2026-08-18 23:04:06 +02:00
Zbigniew Jędrzejewski-Szmek c62bfac025 udev/iocost: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The tool has no man page of its own, so
iocost.conf(5), which describes it, is referenced. The test now also looks
for commands in /usr/lib/udev, where the udev helpers are installed.
2026-08-18 23:04:06 +02:00
dongshengyuan 844c44a0d4 timedated: roll back state on config write failure
SetTimezone() and SetLocalRTC() updated the Context before writing
/etc/localtime or /etc/adjtime. If the write failed, D-Bus properties
showed the new value and a repeated request with the same value returned
success without retrying the file update.

Keep the write helpers Context-based, but save the old value before
installing the requested state. Restore the old Context value when the
backing file update fails.

Add TEST-45 coverage for failed alternate localtime and adjtime paths.

Follow-up for: f401e48c2d
2026-08-19 02:29:39 +09:00
Zbigniew Jędrzejewski-Szmek f969973b90 Another batch of conversions to COMMAND and additions of --introspect-cli (#43428) 2026-08-18 18:32:55 +02:00
Zbigniew Jędrzejewski-Szmek 92a97a2b9d dissect: describe the mount.ddi helper interface
Add a second COMMAND() for the mount.ddi helper namespace, like for
mount.storage and mount.mstack, so that it is exposed by --introspect-cli
too.

Fixes 1a54ce154c +
66246c98b5.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 38d854b114 vpick: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. An explicit "Lookup Keys" option group is added
so that the section heading stays the same.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek b4199e7376 vmspawn: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 60dee66134 tmpfiles: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. An explicit "Commands" option group is added
so that the section heading stays the same. The synopsis is now the same
as for systemd-sysusers, i.e. the "commands" are the options listed in the
Commands section. --help now goes through the pager, like other commands
with --no-pager.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 6109c2a707 sysusers: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. An explicit "Commands" option group is added
so that the section heading stays the same. The abstract is changed to the
imperative. --help now goes through the pager, like other commands with
--no-pager.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 0cbeceaea2 updatectl: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The odd "Verbs" option group marker is dropped,
so that all options are listed in one section after the verbs, with --help
and --version first. The synopsis now uses the generic "[OPTION…] COMMAND …"
form: a bare VERSION is not accepted as the first argument, and the man
page does not list it either. --help now goes through the pager, like
other commands with --no-pager.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek adc83f020a sysupdate: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The "Options" group marker after --help/--version
is dropped, so that all options are listed in one section after the verbs.
The synopsis now uses the generic "[OPTION…] COMMAND …" form: a bare
VERSION is not accepted as the first argument, and the man page does not
list it either. --help now goes through the pager, like other commands
with --no-pager.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 388eb27018 sysctl: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. An explicit "Commands" option group is added
so that the section heading stays the same. The abstract is changed to the
imperative. --help now goes through the pager, like other commands with
--no-pager.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek ae6f195d63 storagectl: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. --help now goes through the pager, like other
commands with --no-pager. The mount.storage helper interface is described
by a second COMMAND(), so that it is exposed by --introspect-cli too.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 3a2d587313 run: convert to VERB_COMMAND and add --introspect-cli
The custom help() and help_sudo_mode() are replaced by COMMAND()
descriptions for systemd-run and run0, and --introspect-cli is added to
both. run0 --help now goes through the pager, like systemd-run --help.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek be5ae9fb40 repart: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. --help now goes through the pager, like other
commands with --no-pager.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 19a24f926d pcrlock: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. --help now goes through the pager, like other
commands with --no-pager.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek bf08fc692a nspawn: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The generic options at the top now get an
"Options" heading like the other groups.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek a9f42ed015 mstack: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The "Commands" option group is moved before the
other options and an explicit "Options" group is added, so that the sections
are printed in the same order as before. --help now goes through the pager,
like other commands with --no-pager. The mount.mstack helper interface is
described by a second COMMAND(), so that it is exposed by --introspect-cli
too.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 20cc6d3188 measure: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. --help now goes through the pager, like other
commands with --no-pager.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 24e24adfe1 machine-id-setup: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. An explicit "Commands" option group is added
so that the section heading stays the same.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek facaf8ba45 machinectl: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The abstract is now wrapped automatically.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 1c7253ca8f loginctl: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 8aee2501f8 journalctl: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The description refers to the "journalctl"
option namespace; the varlink-mode namespace is not described.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek f17f7cc35e imdsd: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 431e3f7def cryptenroll: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek 6868cee66f bootctl: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The "help" verb was defined as visible but the
old help() only printed the named verb groups, so it was never shown; it is
now hidden explicitly to keep the output unchanged.
2026-08-18 16:54:09 +02:00
Zbigniew Jędrzejewski-Szmek d4fe62b8b3 Another batch of conversions to COMMAND and additions of --introspect-cli (#43418) 2026-08-18 11:38:45 +02:00