]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
11 months agoman: Verify Microsoft keys 29380/head
Jan Janssen [Sat, 30 Sep 2023 07:30:24 +0000 (09:30 +0200)] 
man: Verify Microsoft keys

11 months agoman: Adjust Microsoft UEFI certificate links
Jan Janssen [Sat, 30 Sep 2023 07:19:57 +0000 (09:19 +0200)] 
man: Adjust Microsoft UEFI certificate links

The files were fixed to all be properly der encoded.

11 months agoMerge pull request #29363 from medhefgo/elf2efi
Luca Boccassi [Fri, 29 Sep 2023 22:01:53 +0000 (23:01 +0100)] 
Merge pull request #29363 from medhefgo/elf2efi

elf2efi: Rework to allow using any linker

11 months agoMerge pull request #29344 from poettering/tpm2-setup
Lennart Poettering [Fri, 29 Sep 2023 19:56:28 +0000 (21:56 +0200)] 
Merge pull request #29344 from poettering/tpm2-setup

tpm2-setup: set up TPM2 Storage Root Key (SRK) in a separate service

11 months agosysext: validate against the right API level
Lennart Poettering [Fri, 29 Sep 2023 16:28:42 +0000 (18:28 +0200)] 
sysext: validate against the right API level

Let's ake sure we check confexts against the confext api level, and
sysext against the sysext api level.

Previously the test would simply be skipped for confexts...

11 months agope-binary: actually check if PE binary is UEFI binary when determining if UKI
Lennart Poettering [Fri, 29 Sep 2023 16:55:31 +0000 (18:55 +0200)] 
pe-binary: actually check if PE binary is UEFI binary when determining if UKI

If it's not a UEFI binary, then it's not a UKI.

11 months agoMerge pull request #29374 from mrc0mmand/test-tweaks
Luca Boccassi [Fri, 29 Sep 2023 18:07:59 +0000 (19:07 +0100)] 
Merge pull request #29374 from mrc0mmand/test-tweaks

test: use "test-" prefix for units

11 months agoupdate TODO 29344/head
Lennart Poettering [Wed, 27 Sep 2023 07:33:48 +0000 (09:33 +0200)] 
update TODO

11 months agotpm2-setup: add new early boot tool for initializing the SRK
Lennart Poettering [Tue, 26 Sep 2023 19:25:53 +0000 (21:25 +0200)] 
tpm2-setup: add new early boot tool for initializing the SRK

This adds an explicit service for initializing the TPM2 SRK. This is
implicitly also done by systemd-cryptsetup, hence strictly speaking
redundant, but doing this early has the benefit that we can parallelize
this in a nicer way. This also write a copy of the SRK public key in PEM
format to /run/ + /var/lib/, thus pinning the disk image to the TPM.
Making the SRK public key is also useful for allowing easy offline
encryption for a specific TPM.

Sooner or later we should probably grow what this service does, the
above is just the first step. For example, the service should probably
offer the ability to reset the TPM (clear the owner hierarchy?) on a
factory reset, if such a policy is needed. And we might want to install
some default AK (?).

Fixes: #27986
Also see: #22637

11 months agoMerge pull request #29234 from ddstreet/tpm2_marshal_serialize_handle_index
Lennart Poettering [Fri, 29 Sep 2023 17:15:15 +0000 (19:15 +0200)] 
Merge pull request #29234 from ddstreet/tpm2_marshal_serialize_handle_index

add tpm2 functions for marshalling blobs, serializing handles, and handle/index conversion

11 months agoelf2efi: Add GNU_RELRO support 29363/head
Jan Janssen [Thu, 28 Sep 2023 15:54:35 +0000 (17:54 +0200)] 
elf2efi: Add GNU_RELRO support

11 months agoci: Update compiler build matrix
Jan Janssen [Mon, 25 Sep 2023 15:24:26 +0000 (17:24 +0200)] 
ci: Update compiler build matrix

Given that gold is pretty much unmaintained and does not support
`-static-pie` for bootloader components it should be safe to drop.

Also switch to clang-17 while we're at it.

11 months agoboot: Lift linker requirements
Jan Janssen [Fri, 22 Sep 2023 12:41:47 +0000 (14:41 +0200)] 
boot: Lift linker requirements

The biggest reason for forcing bfd was the use of linker scrips. Since
we don't rely on those anymore we can lift the requirement.

The biggest issue is gold as it does not understand -static-pie. Given
that it's pretty much on life support it's safe to just declare it not
supported anymore.

Don't link addons with libefi as clang/lld is sometimes very eager to
include memset etc., causing needless binary bloat and link errors with
LTO.

Fixes: #29165
11 months agoelf2efi: Add --copy-sections option
Jan Janssen [Fri, 22 Sep 2023 10:15:55 +0000 (12:15 +0200)] 
elf2efi: Add --copy-sections option

This makes the special PE sections available again in our output EFI
images.

Since the compiler provides no way to mark a section as not allocated,
we use GNU assembler syntax to emit the sections instead. This ensures
the section data isn't emitted twice as load segments will only contain
allocating input sections.

11 months agoelf2efi: Add next_section_address helper
Jan Janssen [Fri, 22 Sep 2023 10:13:09 +0000 (12:13 +0200)] 
elf2efi: Add next_section_address helper

11 months agoelf2efi: Check ELF image base if possible
Jan Janssen [Thu, 28 Sep 2023 14:22:13 +0000 (16:22 +0200)] 
elf2efi: Check ELF image base if possible

11 months agoelf2efi: Rework ELF section conversion
Jan Janssen [Thu, 28 Sep 2023 14:09:42 +0000 (16:09 +0200)] 
elf2efi: Rework ELF section conversion

The main reason we need to apply a whole lot of logic to the section
conversion logic is because PE sections have to be aligned to the page
size (although, currently not even EDK2 enforces this). The process of
achieving this with a linker script is fraught with errors, they are a
pain to set up correctly and suck in general. They are also not
supported by mold, which requires us to forcibly use bfd, which also
means that linker feature detection is easily at odds as meson has a
differnt idea of what linker is in use.

Instead of forcing a manual ELF segment layout with a linker script we
just let the linker do its thing. We then simply copy/concatenate the
sections while observing proper page boundaries.
Note that we could just copy the ELF load *segments* directly and
achieve the same result. Doing this manually allows us to strip sections
we don't need at runtime like the dynamic linking information (the
elf2efi conversion is effectively the dynamic loader).

Important sections like .sbat that we emit directly from code will
currently *not* be exposed as individual PE sections as they are
contained within the ELF segments. A future commit will fix this.

11 months agotpm2: add tpm2_index_to_handle() and tpm2_index_from_handle() 29234/head
Dan Streetman [Fri, 30 Jun 2023 16:52:10 +0000 (12:52 -0400)] 
tpm2: add tpm2_index_to_handle() and tpm2_index_from_handle()

Adjust the tpm2_esys_handle_from_tpm_handle() function into better-named
tpm2_index_to_handle(), which operates like tpm2_get_srk() but allows using any
handle index. Also add matching tpm2_index_from_handle().

Also change the references to 'location' in tpm2_persist_handle() to more
appropriate 'handle index'.

11 months agotpm2: add tpm2_serialize() and tpm2_deserialize()
Dan Streetman [Fri, 30 Jun 2023 17:42:25 +0000 (13:42 -0400)] 
tpm2: add tpm2_serialize() and tpm2_deserialize()

Add functions to perform serialization and deserialization of ESYS_TR objects.

11 months agotpm2: add tpm2_marshal_blob() and tpm2_unmarshal_blob()
Dan Streetman [Wed, 28 Jun 2023 15:46:31 +0000 (11:46 -0400)] 
tpm2: add tpm2_marshal_blob() and tpm2_unmarshal_blob()

Add functions to marshal and unmarshal our 'blob' object.

11 months agotest: use /run/ for test configuration 29374/head
Frantisek Sumsal [Fri, 29 Sep 2023 14:07:05 +0000 (16:07 +0200)] 
test: use /run/ for test configuration

11 months agotest: use "test-" prefix for units
Frantisek Sumsal [Fri, 29 Sep 2023 13:55:53 +0000 (15:55 +0200)] 
test: use "test-" prefix for units

So the coverage-related drop-in [0] can kick in to avoid errors with
DynamicUser=true. Also, to not make the test confusing with this change,
replace "nft-test" with "test-nft" everywhere.

[0] See test/README.testsuite, section "Code coverage"

11 months agotpm2: move measurement log to /run/log/ (from /var/log/)
Lennart Poettering [Fri, 29 Sep 2023 09:59:40 +0000 (11:59 +0200)] 
tpm2: move measurement log to /run/log/ (from /var/log/)

I have no idea what went on in my mind when I used a path in /var/ for
the tpm2 event log we now keep for userspace measurements. The
measurements are only valid for the current boot, hence should not be
persisted (in particular as they cannot be rotated, hence should not
grow without bounds).

Fix that, simply move from /var/log/ to /run/log/.

11 months agoMerge pull request #29193 from keszybz/path-util-adjustment
Daan De Meyer [Fri, 29 Sep 2023 09:33:12 +0000 (11:33 +0200)] 
Merge pull request #29193 from keszybz/path-util-adjustment

Make unit mangling follow paths

11 months agoMerge pull request #29241 from poettering/pidref-watch
Daan De Meyer [Fri, 29 Sep 2023 09:32:19 +0000 (11:32 +0200)] 
Merge pull request #29241 from poettering/pidref-watch

pid1: move unit_watch_pid()/unit_unwatch_pid() logic over to PidRef

11 months agoukify: explicitly import attribute
Valentin Lefebvre [Wed, 27 Sep 2023 14:41:58 +0000 (16:41 +0200)] 
ukify: explicitly import attribute

* Explicitly import attributes rsa and serialization from cryptography.hazmat

Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
11 months agoMerge pull request #29183 from ddstreet/tpm2_openssl_functions
Daan De Meyer [Fri, 29 Sep 2023 08:25:39 +0000 (10:25 +0200)] 
Merge pull request #29183 from ddstreet/tpm2_openssl_functions

Add openssl functions for use by TPM2 sealing calculations

11 months agoautomount: fix unused value coverity warnings
Luca Boccassi [Fri, 29 Sep 2023 01:00:34 +0000 (02:00 +0100)] 
automount: fix unused value coverity warnings

'r' is no longer used, so no point in setting it before returning

CID#1522310
CID#1522312

Follow-up for bfeb10911e58bf8890eb7687cf12eddb09ab0c5d

11 months agofix: do not check/verify slice units if recursive errors are to be ignored
Maanya Goenka [Wed, 27 Sep 2023 15:44:04 +0000 (15:44 +0000)] 
fix: do not check/verify slice units if recursive errors are to be ignored

Before this fix, when recursive-errors was set to 'no' during a systemd-analyze
verification, the parent slice was checked regardless. The 'no' setting means that,
only the specified unit should be looked at and verified and errors in the slices should be
ignored. This commit fixes that issue.

Example:

Say we have a sample.service file:

[Unit]
Description=Sample Service

[Service]
ExecStart=/bin/echo "a"
Slice=support.slice

Before Change:

systemd-analyze verify --recursive-errors=no maanya/sample.service
Assertion 'u' failed at src/core/unit.c:153, function unit_has_name(). Aborting.
Aborted (core dumped)

After Change:
systemd-analyze verify --recursive-errors=no maanya/sample.service
{No errors}

11 months agoupdate TODO 29241/head
Lennart Poettering [Tue, 19 Sep 2023 14:22:05 +0000 (16:22 +0200)] 
update TODO

11 months agocore: move pid watch/unwatch logic of the service manager to pidfd
Lennart Poettering [Tue, 19 Sep 2023 19:58:55 +0000 (21:58 +0200)] 
core: move pid watch/unwatch logic of the service manager to pidfd

This makes sure unit_watch_pid() and unit_unwatch_pid() will track
processes by pidfd if supported. Also ports over some related code.
Should not really change behaviour.

Note that this does *not* add support waiting for POLLIN on the pidfds
as additional exit notification. This is left for a later commit (this
commit is already large enough), in particular as that would add new
logic and not just convert existing logic.

11 months agotest-watch-pid: use a real PID, not a made up one
Lennart Poettering [Wed, 20 Sep 2023 09:34:57 +0000 (11:34 +0200)] 
test-watch-pid: use a real PID, not a made up one

This matters once we track processes with pidfds rather than just pid_t,
because made up PIDs likely won't exist.

The essence of the test remains unmodified, we just use a real, existing
PID instead of 4711.

11 months agopidref: add pidref_verify() helper
Lennart Poettering [Tue, 19 Sep 2023 14:22:29 +0000 (16:22 +0200)] 
pidref: add pidref_verify() helper

This new helper can be used after reading process info from procfs, to
verify that the data that was just read actually matches the pidfd, and
does not belong to some new process that just reused the numeric PID of
the process we originally pinned.

11 months agopidref: add pidref_hash_ops
Lennart Poettering [Tue, 19 Sep 2023 14:11:34 +0000 (16:11 +0200)] 
pidref: add pidref_hash_ops

This adds a "hash_ops" structure, which allows using PidRef structures
as keys in Hashmap and Set objects.

11 months agopidref: add helpers for managing PidRef on the heap
Lennart Poettering [Tue, 19 Sep 2023 14:15:00 +0000 (16:15 +0200)] 
pidref: add helpers for managing PidRef on the heap

Usually we want to embed PidRef in other structures, but sometimes it
makes sense to allocate it on the heap in case it should be used
standalone. Add helpers for that.

Primary usecase: use as key in Hashmap objects, that for example map
process to unit objects in PID 1.

This adds pidref_free()/pidref_freep() for freeing such an allocated
struct, as well as pidref_dup() (for duplicating an existing PidRef
on the heap 1:1), and pidref_new_pid() (for allocating a new PidRef from a
PID).

11 months agopidref: add PIDREF_MAKE_FROM_PID()
Lennart Poettering [Tue, 19 Sep 2023 14:05:42 +0000 (16:05 +0200)] 
pidref: add PIDREF_MAKE_FROM_PID()

This helper truns a pid_t into a PidRef. It's different from
pidref_set_pid() in being "passive", i.e. it does not attempt to acquire
a pidfd for the pid.

This is useful when using the PidRef as a lookup key that shall also
work after a process is already dead, and hence no conversion to a pidfd
is possible anymore.

11 months agocgroup-util: add cg_read_pidref() helper
Lennart Poettering [Tue, 19 Sep 2023 14:05:01 +0000 (16:05 +0200)] 
cgroup-util: add cg_read_pidref() helper

Just like cg_read_pid() but returns a PidRef

11 months agoMerge pull request #29249 from poettering/pid1-error-message
Luca Boccassi [Thu, 28 Sep 2023 21:18:15 +0000 (22:18 +0100)] 
Merge pull request #29249 from poettering/pid1-error-message

pid1: refactoring of unit state machine logging and unit timer refactoring

11 months agoresolved: register ipv4only.arpa are private domain
Bertrand Jacquin [Wed, 27 Sep 2023 18:39:52 +0000 (19:39 +0100)] 
resolved: register ipv4only.arpa are private domain

From RFC 8880:

Because the 'ipv4only.arpa' zone has to be an insecure delegation,
DNSSEC cannot be used to protect these answers from tampering by
malicious devices on the path.

Consequently, the 'ipv4only.arpa' zone MUST be an insecure delegation to
give DNS64/NAT64 gateways the freedom to synthesize answers to those
queries at will, without the answers being rejected by DNSSEC-capable
resolvers. DNSSEC-capable resolvers that follow this specification MUST
NOT attempt to validate answers received in response to queries for the
IPv6 AAAA address records for 'ipv4only.arpa'. Note that the name
'ipv4only.arpa' has no use outside of being used for this special DNS
pseudo-query used to learn the DNS64/NAT64 address synthesis prefix, so
the lack of DNSSEC security for that name is not a problem.

See: https://datatracker.ietf.org/doc/html/rfc8880#name-security-considerations

11 months agoopenssl: add kdf_ss_derive() 29183/head
Dan Streetman [Fri, 7 Jul 2023 14:13:27 +0000 (10:13 -0400)] 
openssl: add kdf_ss_derive()

Add function to perform KDF-SS ("concat" KDF).

While Openssl allows a digest, HMAC, or KMAC for the auxiliary function H, this
currently only allows using a digest for H.

11 months agoopenssl: add ecc_edch()
Dan Streetman [Fri, 7 Jul 2023 14:11:07 +0000 (10:11 -0400)] 
openssl: add ecc_edch()

Add function to perform ECC EDCH.

11 months agoopenssl: add openssl_cipher_many()
Dan Streetman [Tue, 27 Jun 2023 19:04:59 +0000 (15:04 -0400)] 
openssl: add openssl_cipher_many()

Add function to perform openssl cipher operations.

11 months agoopenssl: add kdf_kb_hmac_derive()
Dan Streetman [Tue, 27 Jun 2023 19:04:59 +0000 (15:04 -0400)] 
openssl: add kdf_kb_hmac_derive()

Add function to perform key-based (KB) key derivation function (KDF) using
hash-based message authentication code (HMAC).

Also alphabetize openssl-util.c header list, and include string-util.h.

11 months agoopenssl: add rsa_oaep_encrypt_bytes()
Dan Streetman [Thu, 15 Jun 2023 12:19:51 +0000 (08:19 -0400)] 
openssl: add rsa_oaep_encrypt_bytes()

Add function to encrypt bytes, similar to rsa_encrypt_bytes() but using OAEP
(Optimal Asymmetric Encryption Padding).

11 months agoopenssl: add openssl_hmac_many()
Dan Streetman [Mon, 26 Jun 2023 21:40:18 +0000 (17:40 -0400)] 
openssl: add openssl_hmac_many()

Add function to perform HMAC on multiple buffers.

Also update test-openssl with associated testing, and replace some memcmp()
with memcmp_nn().

11 months agoopenssl: replace openssl_hash() with openssl_digest()
Dan Streetman [Wed, 5 Jul 2023 20:53:01 +0000 (16:53 -0400)] 
openssl: replace openssl_hash() with openssl_digest()

The openssl_hash() function was used only by string_hashnum(); change it to use
openssl_digest() instead.

11 months agoopenssl: add openssl_digest_many()
Dan Streetman [Wed, 5 Jul 2023 16:28:39 +0000 (12:28 -0400)] 
openssl: add openssl_digest_many()

Add function to perform openssl digest calculation on multiple buffers.

11 months agoopenssl: add openssl_digest_size()
Dan Streetman [Wed, 5 Jul 2023 16:59:47 +0000 (12:59 -0400)] 
openssl: add openssl_digest_size()

Add function to get digest hash size for provided digest name.

11 months agoMerge pull request #29361 from keszybz/kernel-install-work
Luca Boccassi [Thu, 28 Sep 2023 16:16:15 +0000 (17:16 +0100)] 
Merge pull request #29361 from keszybz/kernel-install-work

Advertise installkernel ↔ kernel-install duality

11 months agoRemove json_variant_merge_pair() in favor of json_variant_set_field_non_null()
Daan De Meyer [Thu, 28 Sep 2023 09:51:25 +0000 (11:51 +0200)] 
Remove json_variant_merge_pair() in favor of json_variant_set_field_non_null()

11 months agoMerge pull request #28545 from bluca/softreboot_survive
Luca Boccassi [Thu, 28 Sep 2023 16:12:03 +0000 (17:12 +0100)] 
Merge pull request #28545 from bluca/softreboot_survive

pid1: add SurviveFinalKillSignal= to skip units on final sigterm/sigkill spree

11 months agokmod-setup: Load virtiofs and virtio_pci early
Daan De Meyer [Thu, 28 Sep 2023 07:50:36 +0000 (09:50 +0200)] 
kmod-setup: Load virtiofs and virtio_pci early

There's no way for us to wait for specific virtiofs tags to appear,
so we have to try and make sure that the tags are all available by
the time we try to mount any virtiofs tag. Let's try to do that by
loading the necessary modules as early as we can.

11 months agoshow-logs: add assert and fix local variable type
наб [Thu, 28 Sep 2023 14:21:15 +0000 (16:21 +0200)] 
show-logs: add assert and fix local variable type

Follows-up for: 0693e6b246053d31c0eb405c6abe9db8a4d00aaf

#29355

11 months agocore: mark units as need daemon-reload if unit file operations are
Mike Yuan [Wed, 27 Sep 2023 10:38:10 +0000 (18:38 +0800)] 
core: mark units as need daemon-reload if unit file operations are
performed

systemctl would issue daemon-reload after unit file operations
(enable/disable/preset/...) succeed. However, such operations
are not atomic, meaning that the unit file state could still change
even if the operation generally fails, and the unit_file_state
cached by manager becomes outdated.

Fixes #29341

11 months agocore: improve error message when setting up service mounts
Luca Boccassi [Wed, 27 Sep 2023 17:35:26 +0000 (18:35 +0100)] 
core: improve error message when setting up service mounts

Right now we include the private working directory when we say some files
where not found, which is confusing. Strip it from the error string.

For example, with a BindPaths=/var/bar that does not exist on the host:

Before:

  foo.service: Failed to set up mount namespacing: /run/systemd/unit-root/var/bar: No such file or directory

After:

  foo.service: Failed to set up mount namespacing: /var/bar: No such file or directory

11 months agoMerge pull request #29295 from valentindavid/valentindavid/sysupdate-patterns-in...
Luca Boccassi [Thu, 28 Sep 2023 14:18:45 +0000 (15:18 +0100)] 
Merge pull request #29295 from valentindavid/valentindavid/sysupdate-patterns-in-directory

sysupdate: Allow patterns to match path with directories

11 months agoMerge pull request #29359 from poettering/bootctl-uki-measured
Luca Boccassi [Thu, 28 Sep 2023 14:18:12 +0000 (15:18 +0100)] 
Merge pull request #29359 from poettering/bootctl-uki-measured

bootctl: show whether we booted in a measured UKI in status output (plus some minor other stuff)

11 months agodocs: note root storage daemons can now also use SurviveFinalKillSignal=yes 28545/head
Luca Boccassi [Mon, 25 Sep 2023 23:18:00 +0000 (00:18 +0100)] 
docs: note root storage daemons can now also use SurviveFinalKillSignal=yes

11 months agotest: check soft-reboot behavior wrt argv[0][0] == '@'
Frantisek Sumsal [Sat, 23 Sep 2023 16:52:03 +0000 (18:52 +0200)] 
test: check soft-reboot behavior wrt argv[0][0] == '@'

11 months agopid1: add SurviveFinalKillSignal= to skip units on final sigterm/sigkill spree
Luca Boccassi [Thu, 27 Jul 2023 22:14:31 +0000 (23:14 +0100)] 
pid1: add SurviveFinalKillSignal= to skip units on final sigterm/sigkill spree

Add a new boolean for units, SurviveFinalKillSignal=yes/no. Units that
set it will not have their process receive the final sigterm/sigkill in
the shutdown phase.

This is implemented by checking if a process is part of a cgroup marked
with a user.survive_final_kill_signal xattr (or a trusted xattr if we
can't set a user one, which were added only in kernel v5.7 and are not
supported in CentOS 8).

11 months agoupdate TODO
Lennart Poettering [Thu, 28 Sep 2023 11:22:39 +0000 (13:22 +0200)] 
update TODO

11 months agoRework unit_name_mangle_with_suffix() to (very slightly) simplify the path 29193/head
Zbigniew Jędrzejewski-Szmek [Sat, 16 Sep 2023 18:22:29 +0000 (20:22 +0200)] 
Rework unit_name_mangle_with_suffix() to (very slightly) simplify the path

'systemctl status /../dev' now looks for 'dev.mount', not '-..-dev.service',
and 'systemctl status /../foo' looks for 'foo.mount', not '-..-foo.service'. I
think this much more useful. I think the escaping is not very useful, so I plan
to submit a later series which changes that behaviour. But I think this first
step here is already useful on its own.

Note that the patch is smaller than it seems: before, is_device_path() would
return true only for absolute paths, so moving of is_device_path() under the
path_is_absolute() conditional doesn't influence the logic.

11 months agoexec-util: print executed commands in do_execute() 29361/head
Zbigniew Jędrzejewski-Szmek [Wed, 27 Sep 2023 07:55:57 +0000 (09:55 +0200)] 
exec-util: print executed commands in do_execute()

kernel-install uses do_execute(). We would log whenever a spawned child
finished, but we would not log anything when the child is launched. When the
children log output without a prefix (as the kernel-install plugins do), it
is hard to see where that output is coming from.

11 months agokernel-install: describe usage as installkernel
Zbigniew Jędrzejewski-Szmek [Tue, 26 Sep 2023 19:54:18 +0000 (21:54 +0200)] 
kernel-install: describe usage as installkernel

For us, this is a compatibility mode, but most likely it is there to stay: the
kernel Makefile's install target expects to be able to call /bin/installkernel.
We want people who build their own kernels to use this, so that they use
kernel-install and get support for all the functionality provided by it,
including building of UKIs and other new features. So let's actually advertise
that this exists and works.

11 months agoresolved: never respond to .alt pseudo-TLD.
Bertrand Jacquin [Wed, 27 Sep 2023 18:39:52 +0000 (19:39 +0100)] 
resolved: never respond to .alt pseudo-TLD.

From RFC 9476:

Because names beneath .alt are in an alternative namespace, they have no
significance in the regular DNS context. DNS stub and recursive
resolvers do not need to look them up in the DNS context.

See: https://datatracker.ietf.org/doc/html/rfc9476#name-the-alt-namespace

11 months agobootctl: highlight SecureBoot enabled state in green 29359/head
Lennart Poettering [Thu, 28 Sep 2023 08:45:49 +0000 (10:45 +0200)] 
bootctl: highlight SecureBoot enabled state in green

11 months agobootctl: if we can't access the ESP, show this in regular status output
Lennart Poettering [Thu, 28 Sep 2023 08:45:39 +0000 (10:45 +0200)] 
bootctl: if we can't access the ESP, show this in regular status output

11 months agoMerge pull request #29333 from YHNdnzj/systemctl-warn-half-masked
Mike Yuan [Thu, 28 Sep 2023 09:58:21 +0000 (17:58 +0800)] 
Merge pull request #29333 from YHNdnzj/systemctl-warn-half-masked

systemctl-enable: warn if disabled/masked unit has active triggering units

11 months agosysupdate: Add documentation for new MatchPattern behavior 29295/head
Valentin David [Sun, 24 Sep 2023 15:30:41 +0000 (17:30 +0200)] 
sysupdate: Add documentation for new MatchPattern behavior

11 months agosysupdate: Allow patterns to match path with directories
Valentin David [Sun, 24 Sep 2023 12:35:59 +0000 (14:35 +0200)] 
sysupdate: Allow patterns to match path with directories

`MatchPattern` for regular-file and directory as target can now match
subdirectories This is useful to install files for examples in `.extra.d`
directories:

```
[Target]
Type=regular-file
Path=/EFI/Linux
PathRelativeTo=boot
MatchPattern=gnomeos_@v.efi.extra.d/apparmor.addon.efi
```

The if the directories in the path do not exist, they will be created.  Whereas
the part in `Path` is not created.

11 months agobootctl: report if have been booted with a measured UKI
Lennart Poettering [Thu, 28 Sep 2023 08:33:00 +0000 (10:33 +0200)] 
bootctl: report if have been booted with a measured UKI

Just expose the result of efi_measured_uki() to the user.

11 months agosystemctl-enable: warn if disabled/masked units has active triggering units 29333/head
Mike Yuan [Tue, 26 Sep 2023 15:21:23 +0000 (23:21 +0800)] 
systemctl-enable: warn if disabled/masked units has active triggering units

Closes #311

11 months agosystemctl-start: suppress the triggering unit warning when --no-warn
Mike Yuan [Tue, 26 Sep 2023 15:01:52 +0000 (23:01 +0800)] 
systemctl-start: suppress the triggering unit warning when --no-warn

11 months agosystemctl: clean up check_triggering_units
Mike Yuan [Tue, 26 Sep 2023 14:26:07 +0000 (22:26 +0800)] 
systemctl: clean up check_triggering_units

Preparation for #311

11 months agosystemctl: make unit_is_masked always query manager
Mike Yuan [Wed, 27 Sep 2023 15:43:47 +0000 (23:43 +0800)] 
systemctl: make unit_is_masked always query manager

11 months agosystemctl: don't duplicate string needlessly
Mike Yuan [Tue, 26 Sep 2023 13:46:15 +0000 (21:46 +0800)] 
systemctl: don't duplicate string needlessly

11 months agosystemctl: reflect that statically enabled units can be in .upholds/
Mike Yuan [Tue, 26 Sep 2023 13:41:29 +0000 (21:41 +0800)] 
systemctl: reflect that statically enabled units can be in .upholds/

Follow-up for 38f901791f3c4b1cbd04b71323bbef2fdab65f83

11 months agoMerge pull request #29353 from YHNdnzj/nft-followup
Luca Boccassi [Wed, 27 Sep 2023 20:02:43 +0000 (21:02 +0100)] 
Merge pull request #29353 from YHNdnzj/nft-followup

man/org.freedesktop.systemd1: add version info for NFTSet

11 months agoMerge pull request #29265 from YHNdnzj/sleep-util-refactor
Mike Yuan [Wed, 27 Sep 2023 19:06:48 +0000 (03:06 +0800)] 
Merge pull request #29265 from YHNdnzj/sleep-util-refactor

sleep-util: split into three and first round of cleanups

11 months agoman/org.freedesktop.systemd1: add version info for NFTSet 29353/head
Mike Yuan [Wed, 27 Sep 2023 19:04:28 +0000 (03:04 +0800)] 
man/org.freedesktop.systemd1: add version info for NFTSet

Follow-up for dc7d69b3c1eb4aa78a5ba2791c6e146a365c4092

11 months agocore/unit: use RET_GATHER in one more function
Mike Yuan [Wed, 27 Sep 2023 19:00:13 +0000 (03:00 +0800)] 
core/unit: use RET_GATHER in one more function

11 months agotest: testing for core NFTSet= feature
Topi Miettinen [Wed, 6 Sep 2023 18:48:02 +0000 (21:48 +0300)] 
test: testing for core NFTSet= feature

11 months agocore: add user and group to NFTSet=
Topi Miettinen [Sun, 22 May 2022 12:17:24 +0000 (15:17 +0300)] 
core: add user and group to NFTSet=

The benefit of using this setting is that user and group IDs, especially dynamic and random
IDs used by DynamicUser=, can be used in firewall configuration easily.

Example:

```
[Service]
NFTSet=user:inet:filter:serviceuser
```

Corresponding NFT rules:

```
table inet filter {
        set serviceuser {
                typeof meta skuid
        }
        chain service_output {
                meta skuid @serviceuser accept
                drop
        }
}
```

```
$ cat /etc/systemd/system/dunft.service
[Service]
DynamicUser=yes
NFTSet=user:inet:filter:serviceuser
ExecStart=/bin/sleep 1000

[Install]
WantedBy=multi-user.target
$ sudo nft list set inet filter serviceuser
table inet filter {
        set serviceuser {
                typeof meta skuid
                elements = { 64864 }
        }
}
$ ps -n --format user,group,pid,command -p `systemctl show dunft.service -P MainPID`
    USER    GROUP     PID COMMAND
   64864    64864   55158 /bin/sleep 1000
```

11 months agocore: firewall integration of cgroups with NFTSet=
Topi Miettinen [Sat, 2 Sep 2023 18:55:36 +0000 (21:55 +0300)] 
core: firewall integration of cgroups with NFTSet=

New directive `NFTSet=` provides a method for integrating dynamic cgroup IDs
into firewall rules with NFT sets. The benefit of using this setting is to be
able to use control group as a selector in firewall rules easily and this in
turn allows more fine grained filtering. Also, NFT rules for cgroup matching
use numeric cgroup IDs, which change every time a service is restarted, making
them hard to use in systemd environment.

This option expects a whitespace separated list of NFT set definitions. Each
definition consists of a colon-separated tuple of source type (only "cgroup"),
NFT address family (one of "arp", "bridge", "inet", "ip", "ip6", or "netdev"),
table name and set name. The names of tables and sets must conform to lexical
restrictions of NFT table names. The type of the element used in the NFT filter
must be "cgroupsv2". When a control group for a unit is realized, the cgroup ID
will be appended to the NFT sets and it will be be removed when the control
group is removed.  systemd only inserts elements to (or removes from) the sets,
so the related NFT rules, tables and sets must be prepared elsewhere in
advance.  Failures to manage the sets will be ignored.

If the firewall rules are reinstalled so that the contents of NFT sets are
destroyed, command systemctl daemon-reload can be used to refill the sets.

Example:

```
table inet filter {
...
        set timesyncd {
                type cgroupsv2
        }

        chain ntp_output {
                socket cgroupv2 != @timesyncd counter drop
                accept
        }
...
}
```

/etc/systemd/system/systemd-timesyncd.service.d/override.conf
```
[Service]
NFTSet=cgroup:inet:filter:timesyncd
```

```
$ sudo nft list set inet filter timesyncd
table inet filter {
        set timesyncd {
                type cgroupsv2
                elements = { "system.slice/systemd-timesyncd.service" }
        }
}
```

11 months agoupdate TODO
Lennart Poettering [Wed, 27 Sep 2023 17:08:56 +0000 (19:08 +0200)] 
update TODO

11 months agocore: generalize service_arm_timer() for all unit types 29249/head
Lennart Poettering [Wed, 20 Sep 2023 15:38:23 +0000 (17:38 +0200)] 
core: generalize service_arm_timer() for all unit types

11 months agoscope: also modernize state machine logging
Lennart Poettering [Wed, 20 Sep 2023 15:38:46 +0000 (17:38 +0200)] 
scope: also modernize state machine logging

11 months agopath: also modernize path state machine logging
Lennart Poettering [Wed, 20 Sep 2023 15:07:32 +0000 (17:07 +0200)] 
path: also modernize path state machine logging

11 months agotimer: also modernize timer state machine error logging
Lennart Poettering [Wed, 20 Sep 2023 15:04:41 +0000 (17:04 +0200)] 
timer: also modernize timer state machine error logging

11 months agoautomount: also modernize log logic
Lennart Poettering [Wed, 20 Sep 2023 15:00:52 +0000 (17:00 +0200)] 
automount: also modernize log logic

11 months agoswap: also modernize state engine log message generation
Lennart Poettering [Wed, 20 Sep 2023 14:46:28 +0000 (16:46 +0200)] 
swap: also modernize state engine log message generation

11 months agomount: also rework log message generation
Lennart Poettering [Wed, 20 Sep 2023 13:59:24 +0000 (15:59 +0200)] 
mount: also rework log message generation

11 months agosocket: clean up error message generation/fail paths also for the socket state engine
Lennart Poettering [Wed, 20 Sep 2023 13:09:00 +0000 (15:09 +0200)] 
socket: clean up error message generation/fail paths also for the socket state engine

11 months agosocket: modernize socket_acquire_peer() a bit
Lennart Poettering [Wed, 20 Sep 2023 13:07:26 +0000 (15:07 +0200)] 
socket: modernize socket_acquire_peer() a bit

11 months agosocket: drop redundant TAKE_FD(cfd) line
Lennart Poettering [Wed, 27 Sep 2023 15:21:51 +0000 (17:21 +0200)] 
socket: drop redundant TAKE_FD(cfd) line

In the only two codepaths we reach this place we know that cfd is
already invalidated. In the Accept=yes case there's already a
TAKE_FD() a few lines further up, and in the Accept=no case there is no
connection fd anyway.

11 months agoservice: add error handling for all service_arm_timer() invocations
Lennart Poettering [Wed, 20 Sep 2023 11:11:39 +0000 (13:11 +0200)] 
service: add error handling for all service_arm_timer() invocations

Let's clean this up a bit, and catch all errors and do something
reasonable in case this happens.

11 months agoservice: clean up logging a bit
Lennart Poettering [Wed, 20 Sep 2023 11:09:42 +0000 (13:09 +0200)] 
service: clean up logging a bit

This rearranges various cases of "goto fail" in service.c: sometimes the
whole "goto fail" logic was redundant, since only jumped to form a
single place. Sometimes the log message was generated in the fail
section, instead of the place jumped to from, which resulted in
duplicate or misleading error messages.

No real codeflow changes, just refactoring primarily around log
messages.

11 months agoMerge pull request #29345 from poettering/measured-uki-condition
Lennart Poettering [Wed, 27 Sep 2023 14:39:46 +0000 (16:39 +0200)] 
Merge pull request #29345 from poettering/measured-uki-condition

pid1: introduce ConditionSecurity=measured-uki

11 months agosleep-config: add explanatory comment on "modes" 29265/head
Mike Yuan [Sun, 24 Sep 2023 10:28:54 +0000 (18:28 +0800)] 
sleep-config: add explanatory comment on "modes"

11 months agosleep-config: several cleanups
Mike Yuan [Thu, 21 Sep 2023 06:59:26 +0000 (14:59 +0800)] 
sleep-config: several cleanups

* Rename free_sleep_config to sleep_config_free
* Rearrange functions
* Make SleepConfig.modes and .states only contain
  operations that needs configuration
* Add missing assert