summaryrefslogtreecommitdiff
path: root/docs/RANDOM_SEEDS.md
Commit message (Collapse)AuthorAgeFilesLines
* docs: fix grammar a bitDmitry V. Levin2023-01-231-5/+5
|
* boot: remove random-seed-modeJason A. Donenfeld2022-11-221-8/+0
| | | | | | | | Now that the random seed is used on virtualized systems, there's no point in having a random-seed-mode toggle switch. Let's just always require it now, with the existing logic already being there to allow not having it if EFI itself has an RNG. In other words, the logic for this can now be automatic.
* bootctl: install system token on virtualized systemsJason A. Donenfeld2022-11-211-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Removing the virtualization check might not be the worst thing in the world, and would potentially get many, many more systems properly seeded rather than not seeded. There are a few reasons to consider this: - In most QEMU setups and most guides on how to setup QEMU, a separate pflash file is used for nvram variables, and this generally isn't copied around. - We're now hashing in a timestamp, which should provide some level of differentiation, given that EFI_TIME has a nanoseconds field. - The kernel itself will additionally hash in: a high resolution time stamp, a cycle counter, RDRAND output, the VMGENID uniquely identifying the virtual machine, any other seeds from the hypervisor (like from FDT or setup_data). - During early boot, the RNG is reseeded quite frequently to account for the importance of early differentiation. So maybe the mitigating factors make the actual feared problem significantly less likely and therefore the pros of having file-based seeding might outweigh the cons of weird misconfigured setups having a hypothetical problem on first boot.
* boot: implement kernel EFI RNG seed protocol with proper hashingJason A. Donenfeld2022-11-141-20/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tree-wide: also settle on "initrd" instead of "initial RAM disk"Lennart Poettering2022-09-231-6/+6
| | | | | With this the concept is now called the same way everywhere except where historical info is relevant or where the other names are API.
* Use https for man7.orgMichael Biebl2022-06-281-4/+4
|
* docs: use relative linksBenjamin Franzke2022-05-181-2/+2
| | | | | | | | | | | | | | | | Allows for links to work both on systemd.io (or forks) and when viewed on https://github.com/systemd/systemd/tree/main/docs Note that the markdown links are converted by jekyll-relative-links[1] to html. This plugin is enabled by default on github pages[2][3]. Due to a bug in jekyll-relative-links – see https://github.com/benbalter/jekyll-relative-links/issues/61 – we need to avoid line-wrapped links when using relative markdown links. [1] https://github.com/benbalter/jekyll-relative-links [2] https://github.blog/2016-12-05-relative-links-for-github-pages/ [3] https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#plugins
* random-util: remove RDRAND usageJason A. Donenfeld2022-03-141-31/+7
| | | | | | | | | | | | | | | | | | | /dev/urandom is seeded with RDRAND. Calling genuine_random_bytes(..., ..., 0) will use /dev/urandom as a last resort. Hence, we gain nothing here by having our own RDRAND wrapper, because /dev/urandom already is based on RDRAND output, even before /dev/urandom has fully initialized. Furthermore, RDRAND is not actually fast! And on each successive generation of new x86 CPUs, from both AMD and Intel, it just gets slower. This commit simplifies things by just using /dev/urandom in cases where we before might use RDRAND, since /dev/urandom will always have RDRAND mixed in as part of it. And above where I say "/dev/urandom", what I actually mean is GRND_INSECURE, which is the same thing but won't generate warnings in dmesg.
* docs: add spdx tags to all .md filesZbigniew Jędrzejewski-Szmek2021-09-271-0/+1
| | | | | | I have no idea if this is going to cause rendering problems, and it is fairly hard to check. So let's just merge this, and if it github markdown processor doesn't like it, revert.
* tree: wide "the the" and other trivial grammar fixesZbigniew Jędrzejewski-Szmek2020-07-021-4/+4
|
* man: document systemd.random-seed=Lennart Poettering2020-06-241-4/+19
|
* man: replace perl bug tracker link that went away with link to paperLennart Poettering2020-06-231-1/+1
| | | | Fixes: #16245
* docs: make it prettyTobias Bernard2019-12-111-0/+1
| | | | | | | Add custom Jekyll theme, logo, webfont and .gitignore FIXME: the markdown files have some H1 headers which need to be replaced with H2
* docs: place all our markdown docs in rough categoriesLennart Poettering2019-12-111-0/+1
|
* docs: fix env var name in random seed markdown documentationLennart Poettering2019-08-111-6/+6
|
* docs: add longer document about systemd and random number seedsLennart Poettering2019-07-251-0/+418