cryptsetup: revert to systemd 248 up/pin/uv FIDO2 settings when we don't have LUKS2 JSON data telling us the precise configuration
Let's improve compatibility with systemd 248 enrollments of FIDO2 keys: if we have no information about the up/uv/pin settings, let's try to determine them automatically, i.e. use up and pin if needed. This only has an effect on LUKS2 volumes where a FIDO2 key was enrolled with systemd 248 and thus the JSON data lacks the up/uv/pin fields. It also matters if the user configured FIDO2 parameters explicitly via crypttab options, so that the JSON data is not used. For newer enrollments we'll stick to the explicit settings, as that's generally much safer and robust.
This commit is contained in:
@@ -117,8 +117,7 @@ int find_fido2_auto_data(
|
||||
size_t cid_size = 0, salt_size = 0;
|
||||
_cleanup_free_ char *rp = NULL;
|
||||
int r, keyslot = -1;
|
||||
/* For backward compatibility, require pin and presence by default */
|
||||
Fido2EnrollFlags required = FIDO2ENROLL_PIN | FIDO2ENROLL_UP;
|
||||
Fido2EnrollFlags required = 0;
|
||||
|
||||
assert(cd);
|
||||
assert(ret_salt);
|
||||
@@ -193,7 +192,8 @@ int find_fido2_auto_data(
|
||||
"FIDO2 token data's 'fido2-clientPin-required' field is not a boolean.");
|
||||
|
||||
SET_FLAG(required, FIDO2ENROLL_PIN, json_variant_boolean(w));
|
||||
}
|
||||
} else
|
||||
required |= FIDO2ENROLL_PIN_IF_NEEDED; /* compat with 248, where the field was unset */
|
||||
|
||||
w = json_variant_by_key(v, "fido2-up-required");
|
||||
if (w) {
|
||||
@@ -204,7 +204,8 @@ int find_fido2_auto_data(
|
||||
"FIDO2 token data's 'fido2-up-required' field is not a boolean.");
|
||||
|
||||
SET_FLAG(required, FIDO2ENROLL_UP, json_variant_boolean(w));
|
||||
}
|
||||
} else
|
||||
required |= FIDO2ENROLL_UP_IF_NEEDED; /* compat with 248 */
|
||||
|
||||
w = json_variant_by_key(v, "fido2-uv-required");
|
||||
if (w) {
|
||||
@@ -215,7 +216,8 @@ int find_fido2_auto_data(
|
||||
"FIDO2 token data's 'fido2-uv-required' field is not a boolean.");
|
||||
|
||||
SET_FLAG(required, FIDO2ENROLL_UV, json_variant_boolean(w));
|
||||
}
|
||||
} else
|
||||
required |= FIDO2ENROLL_UV_OMIT; /* compat with 248 */
|
||||
}
|
||||
|
||||
if (!cid)
|
||||
|
||||
@@ -758,7 +758,11 @@ static int attach_luks_or_plain_or_bitlk_by_fido2(
|
||||
cid = arg_fido2_cid;
|
||||
cid_size = arg_fido2_cid_size;
|
||||
|
||||
required = FIDO2ENROLL_PIN | FIDO2ENROLL_UP; /* For backwards compatibility, PIN+presence is required by default. */
|
||||
/* For now and for compatibility, if the user explicitly configured FIDO2 support and we do
|
||||
* not read FIDO2 metadata off the LUKS2 header, default to the systemd 248 logic, where we
|
||||
* use PIN + UP when needed, and do not configure UV at all. Eventually, we should make this
|
||||
* explicitly configurable. */
|
||||
required = FIDO2ENROLL_PIN_IF_NEEDED | FIDO2ENROLL_UP_IF_NEEDED | FIDO2ENROLL_UV_OMIT;
|
||||
} else {
|
||||
r = find_fido2_auto_data(
|
||||
cd,
|
||||
|
||||
Reference in New Issue
Block a user