summaryrefslogtreecommitdiffstats
path: root/src/creds (follow)
Commit message (Collapse)AuthorAgeFilesLines
* creds: trivial coding style fixesLennart Poettering2022-05-021-5/+5
| | | | | | As per: https://github.com/systemd/systemd/pull/23170#pullrequestreview-959233817
* creds-tool: properly search for both encrypted + unencrypted credsLennart Poettering2022-04-281-52/+137
| | | | | Also, properly hook up things with the new fixed paths for system credentials.
* tree-wide: Fix typoYu Watanabe2022-04-251-1/+1
|
* Merge pull request #23122 from poettering/creds-has-tpm2Lennart Poettering2022-04-201-7/+44
|\ | | | | tpm2: beef up tpm2 support checks
| * creds-tool: add new "has-tpm2" verbLennart Poettering2022-04-201-7/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes it's useful from shell scripts to check if we have a working TPM2 chip around. For example, when putting together encrypted credentials for the initrd (after all: it might be wise to place the root pw in a credential for the initrd to consume, but do so only if we can lock it to the TPM2, and not otherwise, so that we risk nothing). Hence, let's add a new "systemd-creds has-tpm2" verb: it returns zero if we have a working TPM2 (which means: supported by kernel + firmware + us), or non-zero otherwise. Also show which parts are available. Use-case: in future the 'kernel-install' script should use this when deciding whether to augment kernels with security sensitive credentials.
* | creds-util: permit credentials encrypted/signed by fixed zero length keys as ↵Lennart Poettering2022-04-201-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fallback for systems lacking TPM2 This is supposed to be useful when generating credentials for immutable initrd environments, where it is is relevant to support credentials even on systems lacking a TPM2 chip. With this, if `systemd-creds encrypt --with-key=auto-initrd` is used a credential will be encrypted/signed with the TPM2 if it is available and recognized by the firmware. Otherwise it will be encrypted/signed with the fixed empty key, thus providing no confidentiality or authenticity. The idea is that distributions use this mode to generically create credentials that are as locked down as possible on the specific platform.
* | creds-util: add an explicit 128bit ID for identifying "automatic" key ↵Lennart Poettering2022-04-201-2/+2
|/ | | | | | | | | | | | | | | | | determination Previously, when encrypting creds you could pick which key to use for this via a 128bit ID identifying the key type, and use an all zero ID for rquesting automatic mode. Let's change this to use an explicitly picked 128bit ID for automatic mode, i.e. something other than all zeros. This is in preparation for adding one further automatic mode with slightly different semantics. no change in behaviour. Note that the new 128bit id is never written to disk but only used internally to indicate a specific case.
* systemd-creds: fix name of env varLennart Poettering2022-04-081-1/+1
| | | | | The env var is called $CREDENTIALS_DIRECTORY, not $CREDENTIALS_PATH. Fix message about it accordingly.
* strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-191-1/+0
| | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
* variuos: add missing includesZbigniew Jędrzejewski-Szmek2021-09-221-0/+1
|
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-2/+2
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* Merge pull request #20186 from keszybz/coverity-fixesLuca Boccassi2021-07-091-16/+5
|\ | | | | Coverity fixes
| * creds: fix leak of arg_tpm2_deviceZbigniew Jędrzejewski-Szmek2021-07-091-15/+4
| | | | | | | | | | | | IIUC, "auto" is the same as NULL. There is no need to strdup() anything. Coverity CID#1458113.
| * creds: drop unnecessary initializationZbigniew Jędrzejewski-Szmek2021-07-091-1/+1
| | | | | | | | | | Coverity also thinks a leak happens here, CID #1458112. This seems wrong, but let's add an assert, maybe that'll help.
* | tree-wide: coccinelle fixesFrantisek Sumsal2021-07-091-3/+3
|/ | | | Yet another batch of Coccinelle fixes.
* creds: add a new tool for listing/showing/encrypting/decrypting credentialsLennart Poettering2021-07-081-0/+812