Commit Graph
72853 Commits
Author SHA1 Message Date
Yu Watanabe ff5b9aeeda Merge pull request #32340 from YHNdnzj/wait-for-unit-cleanup
bus-wait-for-units: some cleanup
2024-04-19 12:36:48 +09:00
Yu Watanabe 8276dd9ef2 Merge pull request #32290 from yuwata/network-conf-parser-cleanups
network,nspawn: several cleanups for conf-parsers
2024-04-19 11:53:22 +09:00
Mike Yuan 61cd6c4db7 bus-wait-for-units: simplify property_map_job_id 2024-04-19 10:08:37 +08:00
Mike Yuan ac21fafbea bus-wait-for-units: drop 'current' field
This is not used anywhere.
2024-04-19 10:08:37 +08:00
Mike Yuan cc6978d6ae bus-wait-for-units: check for existing unit first, use hashmap_ensure_put 2024-04-19 10:08:36 +08:00
Mike Yuan df0183d8f1 bus-wait-for-units: make callback type end with "_t" 2024-04-19 10:08:36 +08:00
Mike Yuan 4b8fdb4681 bus-wait-for-units: drop ready_callback
This is never used, and given that bus_wait_for_units_run
returns BusWaitForUnits.state it's not really useful.
2024-04-19 10:08:36 +08:00
Mike Yuan ad6b84d960 systemctl-start-unit: Subscribe() is unnecessary if we RefUnit explicitly
Subscribe() enables full signal delivery on API bus. But aside from
that, if a unit/job is explicitly Ref()'d, manager also emits the
signal. See bus_foreach_bus() for details.

bus-wait-for-units refs every unit to wait for, so there's no need
to Subscribe() on top of that. In verb_clean_or_freeze() Subscribe()
is not called either.
2024-04-19 10:08:36 +08:00
Mike Yuan 848cdaa6dd systemctl: use FOREACH_ARRAY and FOREACH_ELEMENT more 2024-04-19 10:08:35 +08:00
Mike Yuan 8c8687852a core/dbus: modernize bus_foreach_bus 2024-04-19 10:08:35 +08:00
Mike Yuan fcd7aef724 core/unit: use UNIT_IS_INACTIVE_OR_FAILED at one more place 2024-04-19 10:08:35 +08:00
Luca Boccassi 2ca6bd9b77 test: initialize _cleanup_ variables
Missed one in a previous PR.

Follow-up for e5689f04dd
2024-04-19 10:26:43 +09:00
Yu Watanabe f72e851fd3 conf-parser: move config_parse_timezone() to conf-parser.[ch]
Even though it is currently only used by networkd, the parser itself
is quite generic. Let's move it to the shared library.
2024-04-19 10:23:01 +09:00
Yu Watanabe 6d06b76710 nspawn: rename config_parse_timezone() -> config_parse_timezone_mode()
The parser does not parse timezone, but timezone mode. Let's rename the
parser to more specific name.
2024-04-19 10:23:01 +09:00
Yu Watanabe 760c2724a3 nspawn: align tables 2024-04-19 10:23:00 +09:00
Yu Watanabe d12fb2bc7b network: introduce link_get_use_ntp()
No functional change, just refactoring.
2024-04-19 10:23:00 +09:00
Yu Watanabe 8763e48342 network: move NTP related conf parsers to networkd-ntp.[ch]
No functional change, just refactoring.
2024-04-19 10:23:00 +09:00
Yu Watanabe 9646ffe2ca network: introduce link_get_use_dns()
No functional change, just refactoring.
2024-04-19 10:23:00 +09:00
Yu Watanabe 7a169cb40f network: introduce link_get_use_domains()
No functional change, just refactoring.
2024-04-19 10:23:00 +09:00
Yu Watanabe 54bb2c0e61 network: move DNS related conf parsers to networkd-dns.[ch]
No functional change, just refactoring.
2024-04-19 10:23:00 +09:00
Yu Watanabe 78f5c649e2 network: rename DHCPUseDomains -> UseDomains
As it is also used for NDisc.
2024-04-19 10:23:00 +09:00
Nick Rosbrook c0bc1e8971 copy: ignore -EOPNOTSUPP from copy_file_range()
According to copy_file_range (2), errno will be set to EOPNOTSUPP when
the file system does not support copy_file_range(). Since there is
already fallback logic in place here for other kinds of errors, add
-EOPNOTSUPP to the list of ignored errors.
2024-04-19 09:57:25 +09:00
Luca Boccassi e54bf3fe0b Merge pull request #32299 from yuwata/network-radv-ignore-rs-from-the-same-interface
network/radv: ignore RS message from the same interface
2024-04-18 23:45:06 +02:00
Luca Boccassi 7f4f75593d Merge pull request #32292 from yuwata/sd-radv-send-on-stop
sd-radv: set only basic information in RA message on stop
2024-04-18 23:24:42 +02:00
Lennart Poettering dd37963aff Merge pull request #31790 from poettering/pcrlock-policy-fix
Replace PolicyAuthValue by PolicySigned as access policy for pcrlock policy nvindex
2024-04-18 21:11:27 +02:00
Luca Boccassi 0c8bda7dc3 Merge pull request #32121 from CodethinkLabs/basic-mkosi-integration-tests
Basic mkosi integration tests
2024-04-18 21:02:41 +02:00
Mike Yuan 1ac8747da9 Merge pull request #32336 from teknoraver/foreach_element
Foreach element
2024-04-19 01:40:33 +08:00
Luca Boccassi b84a0bf3ab Merge pull request #32144 from bluca/portable_clean
portablectl: add --clean parameter for detaching
2024-04-18 18:15:20 +02:00
Lennart Poettering 36769db1b0 ci: update tests to showcase new option a bit 2024-04-18 18:12:24 +02:00
Lennart Poettering bb4525c8d8 update NEWS 2024-04-18 18:12:24 +02:00
Lennart Poettering 43a59b8b86 pcrlock: rework --recovery-pin= to take three different arguments
This reworkds --recovery-pin= from a parameter that takes a boolean to
an enum supporting one of "hide", "show", "query".

If "hide" (default behaviour) we'll generate a recovery pin
automatically, but never show it, and thus just seal it and good.

If "show" we'll generate a recovery pin automatically, but display it in
the output, so the user can write it down.

If "query" we'll ask the user for a recovery pin, and not automatically
generate any.

For compatibility the old boolean behaviour is kept.

With this you can now do "systemd-pcrlock make-policy
--recovery-pin=show" to set up the first policy, write down the recovery
PIN. Later, if the PCR prediction didn't work out one day you can then
do "systemd-pcrlock make-policy --recovery-pin=query" and enter the
recovery key and write a new policy.
2024-04-18 18:12:24 +02:00
Lennart Poettering 0ec4c098dd pcrlock: generate recovery PINs via make_recovery_key()
We already have infrastructure for generating nice recovery keys, for
the usual cryptenroll recovery keys. Let's reuse them here, as they are
nicer to read and type than the base64 encoded randomness we so far
used.

Previously valid recovery keys remain valid, in their original format.
For future enrollments we'll however have nicer, easier recovery keys to
deal with.
2024-04-18 18:12:23 +02:00
Lennart Poettering d10d4a3701 tpm2-util: now that we don't use PolicyAuthValue anymore, let's not set an authValue anymore for the policy nvindex
We have now switched from PolicyAuthValue to PolicySigned to control
access to the policy nvindex to. This means there's no point in setting
an authValue on the nvindex anymore, hence drop this.
2024-04-18 18:12:23 +02:00
Lennart Poettering cb835a2ed1 pcrlock: switch access policy for nvindex to store policy in from PolicyAuthValue to PolicySigned (with an HMAC-SHA256 key)
So far the nvindex to store the pcrlock policy in was protected via a
PolicyAuthValue policy (i.e. with a simple PIN set on the nvindex).
That's a bad idea however, as it means an attacker can simply remove and
re-create the nvindex and the "name" of the nvindex does not change,
thus defeating the logic. (This is because the authValue is *not* part
of the "name" of an nvindex!).

Fix this by switching from PolicyAuthValue to PolicySigned with an
HMAC-SHA256 key. Behaviour is very similar: however, the PIN is now part
of of the access policy hash, which *is* part of the "name" of an
nvindex. Thus, if an attacker removes and recreates the nvindex it has
to provide the same PIN again or the "name" of the nvindex will change.
Mission accomplished.

I'd like to thank Chris Coulson for finding this issue (and helping me
address it). Thank you!
2024-04-18 18:12:23 +02:00
Lennart Poettering 19d82e1bee tpm2-util: add comment explaining what tpm2_define_policy_nv_index() actually does 2024-04-18 18:12:23 +02:00
Lennart Poettering 371b594414 tpm2-util: load external key into NULL hierarchy if private key is provided
If we load an external key into the TPM we must do so in the NULL
hierarchy. An external key after all is one that is not wrapped by any
hierarchy's seed.

See TPM2 spec, Part 3, Section 12.3.1
2024-04-18 18:12:23 +02:00
Lennart Poettering d0f8da9815 tpm2-util: rename tpm2_get_pin_auth() → tpm2_auth_value_from_pin()
Just some renaming. I found the old name a bit confusing since it sounds
as if this would get the pin from somewhere, but it really doesn't. It
just converts a PIN into an auth_value, and I think saying so explicitly
makes things easier to grok.
2024-04-18 18:12:23 +02:00
Lennart Poettering 98ef5f8419 tpm2: export tpm2_get_name()
We later want to use this from pcrlock.c, hence export it.
2024-04-18 18:12:23 +02:00
Lennart Poettering 9892b7238b tpm2-util: import two more symbols from tpm2-tss libraries
We want to make use of TPM_PolicySigned soon, hence import the necessary
symbols from tpm2-tss.
2024-04-18 18:12:23 +02:00
Antonio Alvarez Feijoo d72835f819 man/systemd-stub: fix typo 2024-04-18 18:10:50 +02:00
Matteo Croce 854711645b use FOREACH_ELEMENT
Use FOREACH_ELEMENT where possible. Generated with this command,
and checked manually:

    git grep -l 'FOREACH_ARRAY.*ELEMENTSOF' | \
    xargs sed -ri 's/FOREACH_ARRAY\((.*), (.*), (ELEMENTSOF.*)\)/FOREACH_ELEMENT(\1, \2)/'
2024-04-18 17:39:34 +02:00
Matteo Croce 64f7b2961a introduce FOREACH_ELEMENT
Add a FOREACH_ELEMENT() macro which just passes ELEMENTSOF(v)
as third argument to FOREACH_ARRAY().
2024-04-18 17:39:34 +02:00
Richard Maw 945b722f13 test: Add mkosi-based integration test runner
The first two tests are included to ensure parallel test execution is
demonstrable.
2024-04-18 16:26:38 +01:00
Richard Maw 20c7c570b9 mkosi: Extend default device timeout to 20 seconds
A moderately heavily loaded system booting an image without a rootfs
may timeout before the root device appears.
20 seconds is enough for a VM with 2 CPUs and 2GB RAM.
2024-04-18 16:26:38 +01:00
Luca Boccassi 61584182f5 Merge pull request #32328 from YHNdnzj/deserialize-objective
core: follow-ups for objective serialization
2024-04-18 17:07:32 +02:00
Lennart Poettering 51286123da Merge pull request #32330 from poettering/status-invocation
systemctl: show invocation ID in unit status output
2024-04-18 15:47:20 +02:00
Daan De Meyer 7deaddd8a0 Merge pull request #32335 from DaanDeMeyer/fix
mkosi: undefine FORTIFY_SOURCE instead of setting it zero
2024-04-18 15:02:51 +02:00
Daan De Meyer 6c07705213 mkosi: undefine FORTIFY_SOURCE instead of setting it zero
Newer gcc complains if FORTIFY_SOURCE=0 is set so just undefine it
instead.
2024-04-18 14:35:07 +02:00
Mike Yuan d336b8ee9c core/manager: log about previous objective
Addresses https://github.com/systemd/systemd/pull/32320#discussion_r1569192295
2024-04-18 20:32:52 +08:00
Mike Yuan 0292afabee core/manager-serialize: serialize objective string
Follow-up for 8c15bf36e1

I just realized that we should not serialize the number
of internal enum, as that's subject to changes and such
changes would be hard to notice. Let's serialize strings
properly instead.
2024-04-18 20:32:20 +08:00