cryptsetup: make key discovery more robust
authorKamil Szczęk <kamil@szczek.dev>
Wed, 5 Jun 2024 18:50:21 +0000 (20:50 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 27 Jun 2024 10:58:45 +0000 (12:58 +0200)
commit53b6c99018f918a5d2c9000ac5fe3a2440115ea7
tree25b472e79f3972f57a8c8c7a7245f599103407d9
parentdb2b897a8607edf4fcd2e5472a1f630be549ef5d
cryptsetup: make key discovery more robust

Currently, if user doesn't specify a key file, /etc/cryptsetup-keys.d/
and /run/cryptsetup-keys.d/ will be searched for a key file with name
matching the volume name. But current implementation has an important
flaw. When the auto-discovered key is a socket file - it will read the
key only once, while the socket might provide different keys for
different types of tokens. The issue is fixed by trying to discover the
key on each unlock attempt, this way we can populate the socket bind
name with something the key provider might use to differentiate between
different keys it has to provide.
man/crypttab.xml
src/cryptsetup/cryptsetup-keyfile.c
src/cryptsetup/cryptsetup-keyfile.h
src/cryptsetup/cryptsetup.c