1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00
systemd-stable/docs
Jason A. Donenfeld 0be72218f1 boot: implement kernel EFI RNG seed protocol with proper hashing
Rather than passing seeds up to userspace via EFI variables, pass seeds
directly to the kernel's EFI stub loader, via LINUX_EFI_RANDOM_SEED_TABLE_GUID.
EFI variables can potentially leak and suffer from forward secrecy
issues, and processing these with userspace means that they are
initialized much too late in boot to be useful. In contrast,
LINUX_EFI_RANDOM_SEED_TABLE_GUID uses EFI configuration tables, and so
is hidden from userspace entirely, and is parsed extremely early on by
the kernel, so that every single call to get_random_bytes() by the
kernel is seeded.

In order to do this properly, we use a bit more robust hashing scheme,
and make sure that each input is properly memzeroed out after use. The
scheme is:

    key = HASH(LABEL || sizeof(input1) || input1 || ... || sizeof(inputN) || inputN)
    new_disk_seed = HASH(key || 0)
    seed_for_linux = HASH(key || 1)

The various inputs are:
- LINUX_EFI_RANDOM_SEED_TABLE_GUID from prior bootloaders
- 256 bits of seed from EFI's RNG
- The (immutable) system token, from its EFI variable
- The prior on-disk seed
- The UEFI monotonic counter
- A timestamp

This also adjusts the secure boot semantics, so that the operation is
only aborted if it's not possible to get random bytes from EFI's RNG or
a prior boot stage. With the proper hashing scheme, this should make
boot seeds safe even on secure boot.

There is currently a bug in Linux's EFI stub in which if the EFI stub
manages to generate random bytes on its own using EFI's RNG, it will
ignore what the bootloader passes. That's annoying, but it means that
either way, via systemd-boot or via EFI stub's mechanism, the RNG *does*
get initialized in a good safe way. And this bug is now fixed in the
efi.git tree, and will hopefully be backported to older kernels.

As the kernel recommends, the resultant seeds are 256 bits and are
allocated using pool memory of type EfiACPIReclaimMemory, so that it
gets freed at the right moment in boot.
2022-11-14 15:21:58 +01:00
..
_data docs: beef up entrypoint documentation page 2019-12-11 10:53:14 +01:00
_includes docs: add dark mode 2022-05-17 23:00:18 +02:00
_layouts docs: adapt forward layout to systemd.io design 2022-05-21 18:09:50 +02:00
assets docs: add dark mode 2022-05-17 23:00:18 +02:00
fonts docs: make it pretty 2019-12-11 17:04:20 +01:00
sysvinit meson: also allow setting GIT_VERSION via templates 2022-04-05 22:18:31 +02:00
var-log docs: move /var/log/README to a tmpfiles.d symlink 2021-07-21 17:29:06 +02:00
_config.yml docs: use https:// for fd.o links 2022-01-12 16:05:59 +01:00
.gitattributes docs: mark spdx headers with the default license to website files 2021-10-18 09:43:18 +02:00
.gitignore gitignore: add jekyll cache directory 2021-06-24 10:20:29 +02:00
ARCHITECTURE.md doc: drop remaining references to LGTM.com 2022-09-23 18:29:22 +09:00
AUTOMATIC_BOOT_ASSESSMENT.md docs: add a note about selectively overriding default dependencies 2022-09-20 13:57:26 +02:00
BLOCK_DEVICE_LOCKING.md Use https for man7.org 2022-06-28 16:05:31 +02:00
BOOT_LOADER_INTERFACE.md boot: implement kernel EFI RNG seed protocol with proper hashing 2022-11-14 15:21:58 +01:00
BOOT_LOADER_SPECIFICATION.md docs: DPS and BLS have moved to uapi-group.org 2022-11-02 07:31:18 +09:00
BUILDING_IMAGES.md docs: use relative links 2022-05-18 20:34:10 +02:00
CGROUP_DELEGATION.md tree-wide: link to docs.kernel.org for kernel documentation 2022-07-04 19:56:53 +02:00
CODE_OF_CONDUCT.md docs: add spdx tags to all .md files 2021-09-27 09:19:02 +02:00
CODE_QUALITY.md doc: drop remaining references to LGTM.com 2022-09-23 18:29:22 +09:00
CODING_STYLE.md CODING_STYLE: fix header level 2022-09-08 16:13:07 +02:00
CONTAINER_INTERFACE.md Use consistent formatting for PID 1 across docs/ 2022-05-11 15:31:07 +02:00
CONTRIBUTING.md docs/CONTRIBUTING: strenghten language about ABI stability, fix links, other tweaks 2022-10-01 11:29:24 +02:00
CONVERTING_TO_HOMED.md Use https for man7.org 2022-06-28 16:05:31 +02:00
COREDUMP_PACKAGE_METADATA.md docs: rename COREDUMP_PACKAGE_METADATA → ELF_PACKAGE_METADATA 2022-05-21 18:08:19 +02:00
CREDENTIALS.md tree-wide: also settle on "initrd" instead of "initial RAM disk" 2022-09-23 15:12:18 +02:00
DESKTOP_ENVIRONMENTS.md docs: fix typo in key name and adjust grammar a bit 2022-01-10 13:22:48 +01:00
DISCOVERABLE_PARTITIONS.md docs: DPS and BLS have moved to uapi-group.org 2022-11-02 07:31:18 +09:00
DISTRO_PORTING.md docs: add spdx tags to all .md files 2021-09-27 09:19:02 +02:00
ELF_PACKAGE_METADATA.md docs: rename COREDUMP_PACKAGE_METADATA → ELF_PACKAGE_METADATA 2022-05-21 18:08:19 +02:00
ENVIRONMENT.md locale: honour new env var $SYSTEMD_UTF8= 2022-11-10 17:20:36 +01:00
favicon.png docs: make it pretty 2019-12-11 17:04:20 +01:00
favicon.svg docs: mark spdx headers with the default license to website files 2021-10-18 09:43:18 +02:00
GROUP_RECORD.md docs: use relative links 2022-05-18 20:34:10 +02:00
HACKING.md docs/HACKING.md: clarify some portions 2022-10-31 20:56:37 +01:00
HOME_DIRECTORY.md docs: use relative links 2022-05-18 20:34:10 +02:00
index.md docs: overhaul styling for example log messages on startpage 2022-05-17 23:00:18 +02:00
INITRD_INTERFACE.md tree-wide: also settle on "initrd" instead of "initial RAM disk" 2022-09-23 15:12:18 +02:00
JOURNAL_EXPORT_FORMATS.md docs: streamline headline structure in JOURNAL_EXPORT_FORMATS.md 2022-05-18 20:34:10 +02:00
JOURNAL_FILE_FORMAT.md journal: Store offsets to tail entry array objects in chain 2022-10-07 12:28:09 +02:00
JOURNAL_NATIVE_PROTOCOL.md docs: s/straight-forward/straightforward/ 2022-03-15 22:46:09 +00:00
NETWORK_ONLINE.md docs/NETWORK_ONLINE: systemd.network hyperlink fix 2022-09-28 15:48:39 +09:00
PASSWORD_AGENTS.md Use https for man7.org 2022-06-28 16:05:31 +02:00
PORTABILITY_AND_STABILITY.md tree-wide: replace obsolete wiki links with systemd.io/manpages 2022-05-21 14:29:14 +02:00
PORTABLE_SERVICES.md tree-wide: replace "plural(s)" by "plurals" 2022-10-17 15:10:53 +02:00
PORTING_TO_NEW_ARCHITECTURES.md random-util: remove RDRAND usage 2022-03-14 19:47:13 +00:00
PREDICTABLE_INTERFACE_NAMES.md docs: move some stuff into "Networking" section 2022-07-05 11:22:06 +01:00
RANDOM_SEEDS.md boot: implement kernel EFI RNG seed protocol with proper hashing 2022-11-14 15:21:58 +01:00
RELEASE.md docs: update translation strings before new release 2022-10-20 10:39:03 +02:00
RESOLVED-VPNS.md docs: avoid multiple first-level headlines 2022-05-17 23:00:18 +02:00
ROOT_STORAGE_DAEMONS.md tree-wide: also settle on "initrd" instead of "initial RAM disk" 2022-09-23 15:12:18 +02:00
SECURITY.md docs: add spdx tags to all .md files 2021-09-27 09:19:02 +02:00
style.css docs: desaturate dark-mode background color 2022-06-10 13:52:31 +02:00
TEMPORARY_DIRECTORIES.md Use https for man7.org 2022-06-28 16:05:31 +02:00
TESTING_WITH_SANITIZERS.md mkosi: Changes to allow booting with sanitizers in mkosi 2022-07-18 16:54:56 +02:00
TRANSIENT-SETTINGS.md core: add missing dependency DBus properties 2022-01-16 14:05:33 +00:00
TRANSLATORS.md docs: replace <pre>, <code> and <tt> tags by backticks 2022-05-17 22:35:54 +02:00
UIDS-GIDS.md tree-wide: also settle on "initrd" instead of "initial RAM disk" 2022-09-23 15:12:18 +02:00
USER_GROUP_API.md Use https for man7.org 2022-06-28 16:05:31 +02:00
USER_NAMES.md docs: s/straight-forward/straightforward/ 2022-03-15 22:46:09 +00:00
USER_RECORD.md Implement --luks-sector-size for homed 2022-10-07 16:36:04 +02:00
USERDB_AND_DESKTOPS.md docs: use relative links 2022-05-18 20:34:10 +02:00