Commit Graph

51577 Commits

Author SHA1 Message Date
Lennart Poettering
f7e31e9dfd Merge pull request #19756 from poettering/fido2-enroll-tweaks
further tweaks to fido2 code
2021-05-28 18:20:15 +02:00
Lennart Poettering
72c1542267 man: document that FIDO2 uv/up/clientPin feature support is now handled gracefully 2021-05-28 16:45:12 +02:00
Lennart Poettering
3cc00ba605 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.
2021-05-28 16:36:52 +02:00
Lennart Poettering
1ce8f69dbd fido2: properly handle case when no PINs are specified during auth
Also, drop redundant check for has_client_pin, which can never happen,
since we already filtered this case a bit further up.
2021-05-28 16:36:52 +02:00
Lennart Poettering
ec543d18d4 fido2: make misadvertised clientPin feature fatal
We need really need to trust the feature set, since we are about to set
it in stone storing the result in JSON, hence react a bit more allergic
about token that misadvertise the feature.

Note that I added this to be defensive, I am not aware any token that
actually misadvertises this. hence it should be safe to make this fatal,
and should this not work we can always revisit things.
2021-05-28 16:36:51 +02:00
Lennart Poettering
0735ed950a cryptenroll: handle FIDO2 tokens gracefully that lack requested features
Let's try to handle keys gracefully that do not implement all features
we ask for: simply turn the feature off, and continue.

This is in particular relevant since we enroll with PIN and UP by
default, and on devices that don't support that we should just work.

Replaces: #18509
2021-05-28 16:36:25 +02:00
Yu Watanabe
304e637c88 Merge pull request #19754 from yuwata/fix-coverity-issues-and-typo
Fix coverity issues and typo
2021-05-28 23:03:01 +09:00
Yu Watanabe
48008c1cbf tree-wide: fix typo 2021-05-28 19:52:12 +09:00
Yu Watanabe
7f1238bd04 basic/unit-file: fix use-after-free
This fixes a bug introduced by e8630e6952.

Fixes CID#1453292.
2021-05-28 19:48:38 +09:00
Yu Watanabe
a04842dfb2 network,sd-hwdb: voidify fchmod()
Fixes CID#1453294.
2021-05-28 19:41:07 +09:00
Yu Watanabe
50fd596efc path-util: add missing varargs cleanup
Fixes CID#1453293.
2021-05-28 19:38:37 +09:00
Lennart Poettering
18503cac41 Merge pull request #19485 from yuwata/path-util
path-util: introduce several path utilities and handle "." more gracefully
2021-05-28 09:31:06 +02:00
Yu Watanabe
cb71ed91f7 path-util: make path_simplify() use path_find_first_component() 2021-05-28 13:44:38 +09:00
Yu Watanabe
4ff361cc86 tree-wide: always drop unnecessary dot in path 2021-05-28 13:44:38 +09:00
Yu Watanabe
0195046449 path-util: make path_extract_filename/directory() handle "." gracefully
This makes the functions handle "xx/" and "xx/." as equivalent.
Moreover, now path_extract_directory() returns normalized path, that is
no redundant "/" or "/./" are contained.
2021-05-28 13:44:38 +09:00
Yu Watanabe
484cd43cae path-util: introduce path_find_last_component() 2021-05-28 13:44:38 +09:00
Yu Watanabe
15bac3e8fd path-util: use path_equal() in empty_or_root() 2021-05-28 13:44:38 +09:00
Yu Watanabe
39d7af99c2 fs-util: make chase_symlinks() use path_find_first_component()
The previous commit about path_compare() breaks chase_symlinks().
This commit fixes it.
2021-05-28 13:44:19 +09:00
Yu Watanabe
353df4438e path-util: make path_compare() and path_hash_func() ignore "."
This also makes path_compare() may return arbitrary integer as it now
simply pass the result of strcmp() or memcmp().

This changes the behavior of path_extract_filename/directory() when
e.g. "/." or "/./" are input. But the change should be desired.
2021-05-28 13:41:23 +09:00
Yu Watanabe
fe69c41ee8 path-util: use path_find_first_component() in path_make_relative()
This also makes the function checks the result is a valid path or not.
2021-05-28 13:41:23 +09:00
Yu Watanabe
63f11e354a path-util: use path_find_first_component() in path_startswith()
This makes path_startswith() stricter. If one of the path component in
arguments is longer than NAME_MAX, it returns NULL.
2021-05-28 13:41:23 +09:00
Yu Watanabe
0b8696256b path-util: use path_is_safe() in path_is_normalized() 2021-05-28 13:41:23 +09:00
Yu Watanabe
32df2e1447 path-util: introduce path_is_safe()
The function is similar to path_is_valid(), but it refuses paths which
contain ".." component.
2021-05-28 13:41:23 +09:00
Yu Watanabe
6636883564 path-util: use path_find_first_component() in path_is_valid() 2021-05-28 13:41:23 +09:00
Yu Watanabe
0ee54dd4e2 path-util: introduce path_find_first_component()
The function may be useful to iterate on each path component.
2021-05-28 13:41:23 +09:00