Commit Graph
79591 Commits
Author SHA1 Message Date
Ani Sinha 83bf58f39d uki: introduce support for a .efifw section
UKIs can be used to bundle uefi firmwares that can be measured and
used on a confidential computing environment. There can be more than one
firmware blob bundle, each one for a specific platform. Also firmware images
can themselves be containers like IGVM files that can in turn bundle the
actual firmware blob. This change is specifically for uefi firmwares, not
IGVM container files.

This change adds support to introduce a .efifw section in UKI that can be
used for firmware blobs/images. There can be multiple such sections and each
section can contain a single firmware image.

The matching .hwids entry for a specific platform can be used to select the
most appropriate firmware blob.

ukify tool has been also changed to support addition of a firmware image
in UKI.

Since firmware gets measured automatically, we do not need to measure it
separately as a part of the UKI.
2025-01-31 10:05:00 +01:00
Zbigniew Jędrzejewski-Szmek b66a4c157e firstboot: fix crash when hostname question is skipped 2025-01-30 19:48:43 +01:00
Beniamino Galvani 30675a6ee9 dns-domain: accept encoded domain names without terminating zero label
Commit 1be9b30a3b ("dhcp6: use dns_name_from_wire_format") introduced a
stricter validation of domains received via DHCPv6, by using function
dns_name_from_wire_format() which rejects the domain when it is missing the
terminating zero label. According to RFC 4704 § 4.2, DHCPv6 servers should
always add the zero label:

   To send a fully qualified domain name, the Domain Name field is set
   to the DNS-encoded domain name including the terminating zero-length
   label.  To send a partial name, the Domain Name field is set to the
   DNS-encoded domain name without the terminating zero-length label.

   [...]

   Servers SHOULD send the complete fully qualified domain name in
   Client FQDN options.

In practice, there is at least on common DHCPv6 server implementation (dnsmasq)
that sends the FQDN option without the ending zero-length label; after
upgrading to the new systemd, the client cannot parse the option and therefore
the machine doesn't get the hostname provided by dnsmasq.

This commit restores the old behavior that considers a domain valid even when
it's missing the terminating zero label.

Here's a quick reproducer:

--8<--

ip link add veth0 type veth peer name veth1
ip netns add ns1
ip link set veth1 netns ns1
ip link set veth0 address 00:11:22:33:44:55
ip link set veth0 up
ip -n ns1 link set veth1 up
ip -n ns1 address add dev veth1 fd01::1/64

ip netns exec ns1 dnsmasq \
   --pid-file=/tmp/dnsmasq.pid --no-hosts \
   --bind-interfaces --interface veth1 --except-interface lo \
   --dhcp-range=fd01::100,fd01::200 --enable-ra \
   --dhcp-host 00:11:22:33:44:55,foobar &

cat <<EOF > /etc/systemd/network/veth0.network
[Match]
Name=veth0

[Network]
DHCP=ipv6
EOF

networkctl reload
networkctl up veth0
sleep 5
hostname

--8<--

Without this change, systemd-networkd prints the following message and doesn't
set the hostname from DHCP:

  veth0: DHCPv6 client: Failed to parse FQDN option, ignoring: Bad message
2025-01-30 16:18:49 +00:00
Luca Boccassi 515ab90e4d cryptenroll/repart/creds: no longer default to binding against literal PCR 7 (#36200)
PCR 7 covers the SecureBoot policy, in particular "dbx", i.e. the
denylist of bad actors. That list is pretty much as frequently updated
as firmware these days (as fwupd took over automatic updating). This
means literal PCR 7 policies are problematic: they likely break soon,
and are as brittle as any other literal PCR policies.

hence, pick safer defaults, i.e. exclude PCR 7 from the default mask.
This means the mask is now empty.

Generally, people should really switch to signed PCR policies covering
PCR 11, in combination with systemd-pcrlock for the other PCRs.
2025-01-30 14:57:15 +00:00
Andrew Sayers 6c45c5a57c Fix tense in SD_MESSAGE_SHUTDOWN_STR
This is printed by bus_manager_log_shutdown() in logind-dbus.c,
near the start of the shutdown process.

Clarify that events *will* happen, long after this message is sent.
2025-01-30 10:36:38 +01:00
Andrew Sayers 9f575145ea Reduce priority of "cleared HibernateLocation" message
This message appears when a computer hibernates, then awakens, then reboots,
and everything goes OK.  It's a normal progress message the user doesn't need
to know about, but it distracts them from important startup messages and could
even train them to ignore the warning when the procedure fails.

Reduce the level to LOG_INFO.
2025-01-30 10:36:13 +01:00
Lennart Poettering c205840fe0 cryptenroll,repart: print a log message if no access restrictions are applied to TPM-based encryption 2025-01-30 10:32:26 +01:00
Lennart Poettering 4b840414be cryptenroll/repart/creds: no longer default to binding against literal PCR 7
PCR 7 covers the SecureBoot policy, in particular "dbx", i.e. the
denylist of bad actors. That list is pretty much as frequently updated
as firmware these days (as fwupd took over automatic updating). This
means literal PCR 7 policies are problematic: they likely break soon,
and are as brittle as any other literal PCR policies.

hence, pick safer defaults, i.e. exclude PCR 7 from the default mask.
This means the mask is now empty.

Generally, people should really switch to signed PCR policies covering
PCR 11, in combination with systemd-pcrlock for the other PCRs.
2025-01-30 10:32:26 +01:00
Luca Boccassi f6928e6b5d pe: do not warn about .initrd addons
We now support them, so stop warning about them.
2025-01-30 09:27:42 +01:00
Devilish Spirits 164295eb6d Fix inversion of timesyncd_usec/epoch_usec variables in clock-warp.c
In clock_apply_epoch() function, the /usr/lib/clock-epoch timestamp was set to timesyncd_usec instead of epoch_usec and vice-versa which produced a misleading log message about the clock source systemd used for early clock sanitization. This trivial commit fix the mistake.
2025-01-30 09:27:03 +01:00
Nick Rosbrook 5dc89b327f tree-wide: remove some spurious newlines
Specifically, remove double newlines, and newlines before '}'.
2025-01-29 16:17:46 +00:00
Alex Xu (Hello71) bc996fd1ba meson: generate keyboard-keys-list from local input.h
otherwise it will use the system input.h which will fail to build if
newer than the bundled version

Fixes: 0a73c8e7b8 ("linux: import input.h and friends")
2025-01-30 00:39:52 +09:00
Daan De Meyer 33b25fa11c ukify: Calculate section size more correctly
We should only use Misc_VirtualSize if it's smaller than SizeOfRawData,
since in that case it'll be the non-aligned section size. Otherwise we
have to use SizeOfRawData to get the size on disk.
2025-01-29 14:44:27 +01:00
Daan De Meyer 2d6ae4319c ukify: Fix two typing issues 2025-01-29 14:43:06 +01:00
Lennart Poettering 0f477f1d0b docs: fix plural form
Addresses: https://github.com/systemd/systemd/pull/36133#discussion_r1932816287
2025-01-29 13:13:59 +01:00
Lennart Poettering 37cc66324c userdb: move filter of user/group records to the varlink server side (#36133)
In v257 userdbctl gained support for filtering user records with fuzzy
matching and some other parameters. It was done on the client side only.
This PR adds server-side matching, by exendting the generic userdb
varlink api.

The api is generic any may have many other implementors, hence care is
taken to fallback to exclusively client side filtering in case the
service does not support the new parameters.

In fact I even opted to not actually implement server-side filtering in
any services but systemd-userdbd.service, because it's probably not too
much an optimization in relevant services (we might want to revisit this
later). By implementing it in userdbd the primary entrypoint for userdb
is however covered: the multiplexer interface which provides a single
interface for the multitude of backends. Or in other words: the
multiplexer itself supports server-side filtering even if its own
backends don't, and will hide this neatly away.

One nice side effect from not implementing server side filtering for all
our backends is that the fallback codepaths are comprehensively tested.

Note that this adds some unit tests but not new integration test for all
this, as the filtering tests for userdbctl already existed before, we
just move their implementation from the client to the server side.
2025-01-29 13:11:38 +01:00
Lennart Poettering 814e9eab1e update TODO 2025-01-28 23:56:34 +01:00
Yu Watanabe 448e99251a TEST-07-PID1: add reprudcer for issue #35190 2025-01-29 04:58:24 +09:00
Yu Watanabe fce94c5c56 core/unit: remove path to transient unit file from unit name maps on stop
Fixes #35190.
2025-01-29 04:58:24 +09:00
Yu Watanabe d8b34aaef2 unit-file: introduce unit_file_remove_from_name_map() 2025-01-29 04:58:20 +09:00
Yu Watanabe c540875cd3 strv: introduce string_strv_hashmap_remove() 2025-01-29 04:36:24 +09:00
AndreFerreiraMsc 3e1d7b6aae man: Update nss-myhostname.xml to reflect files 2025-01-29 04:28:10 +09:00
Yu Watanabe d90c01d02c network: bridge: add support for configuring locked ports (#36150)
"Recently" (as of 5.18) the Linux kernel gained the ability of locking
bridge ports to restrict network access to authenticated hosts only.

This is implemented by disabling automated learning and dropping
incoming traffic from unknown hosts. User space is then expected to add
fdb entries for authenticated hosts. Once a fdb entry exist, traffic for
that host will be forwarded as expected.

This was later extended with "Mac Authentication Bypass", where the
locking was extended to fdb entries. In this mode the kernel adds fdb
entries again automatically, but they are locked by default.

To properly configure this, add two network options and one netdev
option:

* `LinkLocalLearning=` to prevent the kernel from creating unlocked
entries based on link-local traffic, which would bypass any
authentication. Needed when enabling learning on a locked port.
* `Locked=` to allow setting a bridge port to locked.
* `MACAuthenticationBypass=` to allow enabling Mac Authentication
 Bypass on a port. Requires learning to be enabled on the port as well
 (and consequently `LinkLocalLearning` disabled on the bridge).

An authenticator (e.g. hostapd) is still needed to do the actual
authentication, the kernel only provides the access control.
2025-01-29 04:16:20 +09:00
Luca Boccassi c4c3eb03fd Minor fixes for ukify tests (#36197) 2025-01-28 18:49:42 +00:00
Luca Boccassi 103bf54e2c wait-online: add initial support for waiting for DNS (#34640)
Add a new flag, `--dns`, to systemd-networkd-wait-online to allow
waiting for DNS to be configured. The `--dns` flag respects the `--ipv4`
and `--ipv6` flags, as well as `--interface=` and `--any`.
2025-01-28 17:33:39 +00:00
Luca Boccassi 25a253084a test: support slow test-ukify on Debian/Ubuntu
Kernels are installed in /boot/ so find them there too
2025-01-28 17:28:55 +00:00
Luca Boccassi bcca98c632 test: use local stub if available in test-ukify
It might not be available on a CI system in the system
path, so use the local one if it was built
2025-01-28 17:28:55 +00:00
Daan De Meyer b61efe6591 ukify: Add --sign-profile
Let's allow configuring which UKI profiles we generate signed PCR
measurements for since there are various types of profiles for
which we do not want to generate signed PCR measurements so that they
can not unlock the encrypted rootfs.

Fixes #36173.
2025-01-28 17:20:46 +00:00
Lennart Poettering 7249651bff bootctl: move print block device path calls to command section of its own 2025-01-28 16:25:15 +00:00
Luca Boccassi 78ce88e265 test: install stub package for test-ukify unit test 2025-01-28 15:04:28 +00:00
Nick Rosbrook d6608da1e6 networkd-test: add basic tests for systemd-networkd-wait-online --dns 2025-01-28 08:49:49 -05:00
Nick Rosbrook 5ee20919a2 test: add test for resolved SubscribeDNSConfiguration API 2025-01-28 08:49:49 -05:00
Nick Rosbrook 266cfdfc77 test: cleanup after testcase_12_resolvectl2 2025-01-28 08:49:49 -05:00
Nick Rosbrook 359db7e9b9 wait-online: add support for waiting for DNS configuration
Add a new flag to systemd-networkd-wait-online, --dns, to allow waiting
for DNS to be configured.

DNS is considered configured when at least one DNS server is accessible.
If a link has the property DefaultRoute=yes (either by explicit
configuration, or because there are no routing-only domains), or if the
search domain '.' is configured, wait for link-specific DNS to be
configured. Otherwise, global DNS servers may be considered.
2025-01-28 08:49:49 -05:00
Jonas Gorski 08a26ecc47 network: bridge: add support for IFLA_BRPORT_MAB
Since linux commit a35ec8e38cdd1766f29924ca391a01de20163931 ("bridge:
Add MAC Authentication Bypass (MAB) support"), included since v6.2, it
is possible to enable MAC Authentication Bypass for bridge ports. In
this mode the locked port learns again, but the learned fdb entries are
locked, allowing user space to unlock hosts based seen MAC addresses.

This requires learning to be enabled on the port, and link-local
learning disabled for the bridge.

Add support to systemd-network for setting the new attribute for bridge
ports.
2025-01-28 12:22:26 +01:00
Jonas Gorski a434de6056 network: bridge: add support for IFLA_BRPORT_LOCKED
Since linux commit a21d9a670d81103db7f788de1a4a4a6e4b891a0b ("net:
bridge: Add support for bridge port in locked mode"), included since
v5.18,  it is possible to set bridge ports to locked.

Locked ports do not learn automatically, and discard any traffic from
unknown source MACs. To allow traffic, the userspace authenticator is
expected to create fdb entries for authenticated hosts.

Add support to systemd-network for setting the new attribute for bridge
ports.
2025-01-28 10:38:01 +01:00
Jonas Gorski d7de242ce7 network: bridge: add support for NO_LL_LEARN
When using locked ports on a bridge link-local learning needs to be
disabled to prevent the kernel from learning and automatically unlocking
hosts based on link-local traffic.

So add support for enabling NO_LL_LEARN for bridges.
2025-01-28 10:38:01 +01:00
Luca Boccassi 6566b4306a core: add trigger to path unit debug log
Useful for debugging, given it's already logging and the trigger
is known, add it
2025-01-28 07:23:50 +01:00
Adam Williamson f89d4c5f10 kbd-model-map: add a georgian mapping
https://github.com/legionus/kbd/pull/127 adds a Georgian mapping
to kbd. console-setup already has one. Let's support it here, so
it's used for Georgian installs on distros that use this table.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2025-01-28 07:23:16 +01:00
Lennart Poettering 31ce98f5f5 tty-ask-password-agent: use free_and_strdup_warn() for arg_device (#36198) 2025-01-28 07:22:17 +01:00
Mike Yuan ce8199a164 tty-ask-password-agent: use free_and_strdup_warn() for arg_device
Follow-up for 68cf1fc34d

Fixes CID#1590840
2025-01-28 02:23:57 +01:00
Mike Yuan 59bd932af2 tty-ask-password-agent: assert that ask_on_consoles() is called without arg_device 2025-01-28 02:10:29 +01:00
Nick Rosbrook 54401c6fdf resolved: add SubscribeDNSConfiguration to varlink API
Add a new method to io.systemd.Resolve.Monitor that allows subscribing
to changes in the systemd-resolved DNS configuration. The new method
emits the full DNS configuration (one entry for global configuration,
and one entry for each interface), any time the configuration is
updated.
2025-01-27 19:26:31 -05:00
Lennart Poettering 3512118499 update TODO 2025-01-27 23:51:57 +01:00
Lennart Poettering dea3dd6649 homectl: port has_regular_user() + acquire_group_list() to use server-side filtering 2025-01-27 23:51:57 +01:00
Lennart Poettering 5ec4933dd5 userdbd: implement server side filtering in the Multiplexer API
This impelements server side filtering in userdbd's multiplexer logic.
Note thta this means that even if some backend doesn't support it
natively the multiplexer will deal with it and apply the filtering as
necessary.
2025-01-27 23:51:57 +01:00
Lennart Poettering 7419291670 userdb: move UserDBMatch handling from userdbctl into generic userdb code to allow it to be done server side
This moves around the UserDBMatch handling, moves it out of userdbctl
and into generic userdb code, so that it can be passed to the server
side, to allow server side filtering.

This is preparation for one day allowing complex software to do such
filtering server side, and thus reducing the necessary traffic.

Right now no server side actually knows this, hence care is taken to
downgrade to the userdb varlink API as it was in v257 in case the new
options are not understood. This retains compatibility with any
implementation hence.
2025-01-27 23:51:57 +01:00
Lennart Poettering 1ff1e0e01b varlink: add new calls for server-side user record filtering to varlink IDL + to spec
This is preparation for adding server side filtering to the userdb
logic: it adds some fields for this to the userdb varlink API. This only
adds the IDL for it, no client will use it for now, no server implement
it. That's added in later commits.
2025-01-27 23:51:57 +01:00
Lennart Poettering d6db229ffc user-record: add some helpers for working with UserDBMatch 2025-01-27 23:42:06 +01:00
Lennart Poettering 27cce1f1ef user-record: rename USER_DISPOSITION_MASK_MAX → USER_DISPOSITION_MASK_ALL
On request by yuwata.
2025-01-27 23:42:06 +01:00