Skip to content

Commit

Permalink
Update 260_crypt_layout.sh
Browse files Browse the repository at this point in the history
If more than one keyslot is used in LUKS header the 'grep' command
looking for 'Cipher key' would return more than one line.
But we need just one value. Use 'key_size' from the first found key.
  • Loading branch information
vcrhonek committed Oct 26, 2020
1 parent 4c69a08 commit 6c72d28
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ while read target_name junk ; do
hash=$( grep "Hash spec" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+)$/\1/' )
elif test $luks_type = "luks2" ; then
cipher=$( grep "cipher:" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+)$/\1/' )
key_size=$( grep "Cipher key" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+) bits$/\1/' )
# More than one keyslot may be defined - use key_size from the first slot
key_size=$( grep -m 1 "Cipher key" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+) bits$/\1/' )
hash=$( grep "Hash" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+)$/\1/' )
fi

Expand Down

0 comments on commit 6c72d28

Please sign in to comment.