mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
creds: add explicit control on whether to allow null key decryption
The ability to encrypt/authenticate encryption with a null key was originally just a fallback concept for cases where during early boot we have no host key, but the local system has no TPM2. Nowadays it is used for other stuff as well, such as pcrlock data propagation (i.e. data that needs no protection itself and required to properly to TPM key derivation). Let's give better, explicit control over null key usage, i.e. let's make it a tristate both on the systemd-creds command line and in the Varlink IPC to control three cases: - the default that we allow it only if SecureBoot is off - explicitly allowed - explicitly refused (this is new) Ideally systemd-creds --allow-null switch would take a boolean argument to control this as a tristate. Alas, that would be a compat break, hence I added --refuse-null instead (which also maps to the low-level flag for this). This also normalizes that the null key is always called "null key" in messages, and not sometimes "empty key" or "fallback key".
This commit is contained in:
@@ -499,11 +499,17 @@ cmp /tmp/vlcredsdata /tmp/vlcredsdata2
|
||||
rm /tmp/vlcredsdata2
|
||||
|
||||
varlinkctl call /run/systemd/io.systemd.Credentials io.systemd.Credentials.Encrypt "{\"data\":\"$DATA\",\"withKey\":\"null\"}" | \
|
||||
jq '.["allowNull"] = true' |
|
||||
varlinkctl call --json=short /run/systemd/io.systemd.Credentials io.systemd.Credentials.Decrypt > /tmp/vlcredsdata2
|
||||
|
||||
cmp /tmp/vlcredsdata /tmp/vlcredsdata2
|
||||
rm /tmp/vlcredsdata /tmp/vlcredsdata2
|
||||
|
||||
# Ensure allowNull works
|
||||
(! varlinkctl call /run/systemd/io.systemd.Credentials io.systemd.Credentials.Encrypt "{\"data\":\"$DATA\",\"withKey\":\"null\"}" | \
|
||||
jq '.["allowNull"] = false' |
|
||||
varlinkctl call --json=short /run/systemd/io.systemd.Credentials io.systemd.Credentials.Decrypt )
|
||||
|
||||
clean_usertest() {
|
||||
rm -f /tmp/usertest.data /tmp/usertest.data /tmp/brummbaer.data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user