Bug 1740210

Summary: Anaconda kickstart LUKS no option to set key size / incorrect documentation
Product: Red Hat Enterprise Linux 8 Reporter: Jan Stodola <jstodola>
Component: python-blivetAssignee: Vojtech Trefny <vtrefny>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: pzatko, rhandlin, vtrefny
Target Milestone: rc   
Target Release: 8.2   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-blivet-3.2.2-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1716674 Environment:
Last Closed: 2020-11-04 03:22:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Stodola 2019-08-12 13:28:29 UTC
+++ This bug was initially created as a clone of Bug #1716674 +++

Description of problem:
There is no option with kickstart to set the key size for a LUKS volume. Only when no "--cipher" option is set the key size defaults to 512 bits, otherwise the default LUKS option is used. Making it impossible to use 512 bits with any cipher other than aes-xts-plain64.

Furthermore the documentation about this is incomplete/incorrect.
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-encryption#sec-Using_LUKS_Disk_Encryption
Says: "The default key size for LUKS is 256 bits. The default key size for LUKS with Anaconda (XTS mode) is 512 bits."
However, when the "--cipher" option is set the key size fals back to the LUKS default. So for example when using serpent (XTS mode) the key size is 256 bits.

How reproducible:
Use a kickstart file to install RHEL and check the partition afterwards with cryptsetup luksDump

Steps to Reproduce:
part ... --encrypted --passphrase=temppass
part ... --encrypted --passphrase=temppass --cipher=aes-xts-plain64
part ... --encrypted --passphrase=temppass --cipher=serpent-xts-plain64
part ... --encrypted --passphrase=temppass --key-size=512
part ... --encrypted --passphrase=temppass --key-size=512 --cipher=serpent-xts-plain64

Expected results:
master key size: 512
master key size: 512
master key size: 512
master key size: 512
master key size: 512

Actual results:
master key size: 512
master key size: 256
master key size: 256
master key size: N/A
master key size: N/A

Additional info:
To make the documentation sound:
https://github.com/storaged-project/blivet/blob/rhel7-branch/blivet/formats/luks.py
This:
        if not self.exists and not self.cipher:
            self.cipher = "aes-xts-plain64"
            if not self.key_size:
                # default to the max (512 bits) for aes-xts
                self.key_size = 512
Should be changed to something like this:
        if not self.exists
            if not self.cipher:
                self.cipher = "aes-xts-plain64"
            if not self.key_size and "xts" in self.cipher:
                # default to the max (512 bits) fot xts
                self.key_size = 512

Comment 1 Vojtech Trefny 2019-09-05 07:15:13 UTC
Upstream PR: https://github.com/storaged-project/blivet/pull/800

Comment 10 errata-xmlrpc 2020-11-04 03:22:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (python-blivet bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4728