RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1733390 - a missing --active-name argument but valid device and valid external header gives user no warning/error
Summary: a missing --active-name argument but valid device and valid external header g...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: cryptsetup
Version: 8.1
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: 8.0
Assignee: Ondrej Kozina
QA Contact: Corey Marthaler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-25 23:07 UTC by Corey Marthaler
Modified: 2021-09-06 15:19 UTC (History)
5 users (show)

Fixed In Version: cryptsetup-2.2.0-1.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-05 22:17:14 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3569 0 None None None 2019-11-05 22:17:26 UTC

Description Corey Marthaler 2019-07-25 23:07:15 UTC
Description of problem:

# Invalid header file (PROPER WARNING)
[root@hayes-02 ~]# cryptsetup reencrypt --decrypt --active-name /dev/cache_sanity/dummy --header /tmp/doesnt_exist
Device /tmp/doesnt_exist doesn't exist or access denied.

# Valid *Non* LUKS device, valid header (PROPER WARNING)
[root@hayes-02 ~]# cryptsetup reencrypt --decrypt --active-name /dev/cache_sanity/dummy --header /tmp/cache_luks_header.1234567890
This operation is not supported for this device type.

# No valid active name (but a valid device in its place) with a valid header (NO PROPER WARNING)
[root@hayes-02 ~]# cryptsetup reencrypt --decrypt --active-name /dev/cache_sanity/fs_snap2 --header /tmp/cache_luks_header.1234567890
[root@hayes-02 ~]# cryptsetup reencrypt --decrypt --active-name /dev/cache_sanity/fs_snap2 --header /tmp/cache_luks_header.1234567890
[root@hayes-02 ~]# echo $?
4

# valid online active name, valid device, valid header
[root@hayes-02 ~]# cryptsetup reencrypt --decrypt --active-name luks_fs_snap1 /dev/cache_sanity/fs_snap1 --header /tmp/cache_luks_header.1234567890
Enter passphrase for /dev/mapper/cache_sanity-fs_snap1:

Version-Release number of selected component (if applicable):
kernel-4.18.0-121.el8    BUILT: Tue Jul 23 09:49:25 CDT 2019
cryptsetup-2.2.0-0.2.el8    BUILT: Mon Jun 17 04:08:11 CDT 2019
cryptsetup-libs-2.2.0-0.2.el8    BUILT: Mon Jun 17 04:08:11 CDT 2019
cryptsetup-reencrypt-2.2.0-0.2.el8    BUILT: Mon Jun 17 04:08:11 CDT 2019
lvm2-2.03.05-2.el8    BUILT: Wed Jul 24 08:05:11 CDT 2019
lvm2-libs-2.03.05-2.el8    BUILT: Wed Jul 24 08:05:11 CDT 2019
lvm2-dbusd-2.03.05-2.el8    BUILT: Wed Jul 24 08:07:38 CDT 2019
lvm2-lockd-2.03.05-2.el8    BUILT: Wed Jul 24 08:05:11 CDT 2019

Comment 1 Ondrej Kozina 2019-07-29 10:44:51 UTC
(In reply to Corey Marthaler from comment #0)
> # No valid active name (but a valid device in its place) with a valid header
> (NO PROPER WARNING)
> [root@hayes-02 ~]# cryptsetup reencrypt --decrypt --active-name
> /dev/cache_sanity/fs_snap2 --header /tmp/cache_luks_header.1234567890
> [root@hayes-02 ~]# cryptsetup reencrypt --decrypt --active-name
> /dev/cache_sanity/fs_snap2 --header /tmp/cache_luks_header.1234567890
> [root@hayes-02 ~]# echo $?
> 4 

What device is /dev/cache_sanity/fs_snap2 exactly? I can't reproduce your failure exactly:

With Beta build:

a) when I pass dm linear mapping of other existing device (not LUKS2) I get:

cryptsetup reencrypt --decrypt --active-name /dev/mapper/some_linear --header /tmp/my_hdr
This operation is not supported for this device type.

b) If I pass activate LUKS2 device, but I use full path instead of dm name (/dev/mapper/my_crypt instead of just "my_crypt"), I get:

cryptsetup reencrypt --decrypt --active-name /dev/mapper/my_crypt --header /tmp/my_hdr
Enter passphrase for /dev/sdc: 
Name "/dev/mapper/my_crypt-hotzone" invalid. It contains "/".
Failed to activate hotzone device /dev/mapper/my_crypt-hotzone.
Failed to initalize reencryption device stack.

This is clearly bug (perhaps yet another one), but I would like to reproduce your scenario as well.

c) If I pass other block device (sdb1 partition), I get:

cryptsetup reencrypt --decrypt --active-name /dev/sdb1 --header /tmp/my_hdr
Device sdb1 not found

Comment 2 Corey Marthaler 2019-07-29 21:29:56 UTC
This may require hitting bug 1733391 first. 

I tried to reproduce this with just valid encrypted origin/snap volumes but wasn't able to (ie i saw valid warnings/errors). I then attempted right after bug 1733391, and saw this issue again. I'll look into this more and try and repo w/o bug 1733391 and see if it's possible, otherwise we can close this a dup of 1733391.

Comment 3 Corey Marthaler 2019-07-29 22:27:19 UTC
I reproduced it w/o bug 1733391. It's just an active open snapshot of luks origin.

[root@hayes-01 ~]# lvcreate -n origin -L 4G test
  Logical volume "origin" created.
[root@hayes-01 ~]# echo foobarglarch | cryptsetup reencrypt --encrypt --init-only --type luks2 /dev/test/origin --header /tmp/cache_luks_header.1234567890
[root@hayes-01 ~]# echo foobarglarch | cryptsetup luksOpen /dev/test/origin luks_corigin --header /tmp/cache_luks_header.1234567890

[root@hayes-01 ~]# lvcreate  -s /dev/test/origin -c 64 -n fs_snap1 -L 4100.00m
  Logical volume "fs_snap1" created.
[root@hayes-01 ~]# cp /tmp/cache_luks_header.1234567890 /tmp/cache_luks_header.for_snapshot

[root@hayes-01 ~]# echo foobarglarch | cryptsetup luksOpen /dev/test/fs_snap1 luks_fs_snap1 --header /tmp/cache_luks_header.for_snapshot

# fails
[root@hayes-01 ~]# cryptsetup reencrypt --decrypt --active-name /dev/test/fs_snap1 --header /tmp/cache_luks_header.for_snapshot
[root@hayes-01 ~]# echo $?
4

# passes
[root@hayes-01 ~]# cryptsetup reencrypt --decrypt --active-name luks_fs_snap1 --header /tmp/cache_luks_header.for_snapshot
Enter passphrase for /dev/mapper/test-fs_snap1:

Comment 4 Ondrej Kozina 2019-07-31 10:24:36 UTC
I can confirm there are two bugs:

The one Corey described in comment #3

- and -

> b) If I pass active LUKS2 device, but I use full path instead of dm name (/dev/mapper/my_crypt instead of just "my_crypt"), I get:
>
> cryptsetup reencrypt --decrypt --active-name /dev/mapper/my_crypt --header /tmp/my_hdr
> Enter passphrase for /dev/sdc: 
> Name "/dev/mapper/my_crypt-hotzone" invalid. It contains "/".
> Failed to activate hotzone device /dev/mapper/my_crypt-hotzone.
> Failed to initalize reencryption device stack.

Comment 5 Ondrej Kozina 2019-08-01 10:20:11 UTC
(In reply to Ondrej Kozina from comment #4)
> I can confirm there are two bugs:
> 
> The one Corey described in comment #3

Fixed upstream in https://gitlab.com/cryptsetup/cryptsetup/commit/7380731bf79494d56de672cb9bec337b39287904

Expected error message is "Device /dev/test/fs_snap1 is not a valid LUKS device."


> 
> - and -
> 
> > b) If I pass active LUKS2 device, but I use full path instead of dm name (/dev/mapper/my_crypt instead of just "my_crypt"), I get:
> >
> > cryptsetup reencrypt --decrypt --active-name /dev/mapper/my_crypt --header /tmp/my_hdr
> > Enter passphrase for /dev/sdc: 
> > Name "/dev/mapper/my_crypt-hotzone" invalid. It contains "/".
> > Failed to activate hotzone device /dev/mapper/my_crypt-hotzone.
> > Failed to initalize reencryption device stack.

Fixed upstream in https://gitlab.com/cryptsetup/cryptsetup/commit/97ea39404a8578dd89c7d9134050de6014009045

Reencryption now accepts full device path passed in --active-name parameter. It must be path for LUKS mapped device.

Comment 7 Corey Marthaler 2019-08-19 21:08:56 UTC
Both issues described in this bug have been verified in the latest rpms.

cryptsetup-2.2.0-1.el8    BUILT: Fri Aug 16 01:22:41 CDT 2019
cryptsetup-libs-2.2.0-1.el8    BUILT: Fri Aug 16 01:22:41 CDT 2019
cryptsetup-reencrypt-2.2.0-1.el8    BUILT: Fri Aug 16 01:22:41 CDT 2019


# issue 1:
[root@hayes-01 ~]# lvcreate -n origin -L 4G test
  Logical volume "origin" created.
[root@hayes-01 ~]# echo foobarglarch | cryptsetup reencrypt --encrypt --init-only --type luks2 /dev/test/origin --header /tmp/cache_luks_header.1234567890
[root@hayes-01 ~]# echo foobarglarch | cryptsetup luksOpen /dev/test/origin luks_corigin --header /tmp/cache_luks_header.1234567890
[root@hayes-01 ~]# lvcreate  -s /dev/test/origin -c 64 -n fs_snap1 -L 4100.00m
  Logical volume "fs_snap1" created.
[root@hayes-01 ~]# cp /tmp/cache_luks_header.1234567890 /tmp/cache_luks_header.for_snapshot
[root@hayes-01 ~]# echo foobarglarch | cryptsetup luksOpen /dev/test/fs_snap1 luks_fs_snap1 --header /tmp/cache_luks_header.for_snapshot

# fails (with a legit error message now)
[root@hayes-01 ~]# echo foobarglarch | cryptsetup reencrypt --decrypt --active-name /dev/test/fs_snap1 --header /tmp/cache_luks_header.for_snapshot
Device /dev/test/fs_snap1 is not a valid LUKS device.
[root@hayes-01 ~]# echo $?
1

# continues to pass
[root@hayes-01 ~]#  echo foobarglarch | cryptsetup reencrypt --decrypt --active-name luks_fs_snap1 --header /tmp/cache_luks_header.for_snapshot
Finished, time 01:55.344, 4096 MiB written, speed  35.5 MiB/s   




# issue 2:
# passed in active LUKS2 device with full path instead of dm name
[root@hayes-01 ~]# lvcreate -n origin -L 4G test
  Logical volume "origin" created.
[root@hayes-01 ~]# echo foobarglarch | cryptsetup reencrypt --encrypt --init-only --type luks2 /dev/test/origin --header /tmp/cache_luks_header.0987654321
[root@hayes-01 ~]# echo foobarglarch | cryptsetup luksOpen /dev/test/origin luks_corigin --header /tmp/cache_luks_header.0987654321
[root@hayes-01 ~]# echo foobarglarch | cryptsetup reencrypt --decrypt --active-name /dev/mapper/luks_corigin --header /tmp/cache_luks_header.0987654321
Finished, time 01:22.156, 4096 MiB written, speed  49.9 MiB/s

Comment 8 Ondrej Kozina 2019-09-02 09:34:25 UTC
The bug was introduced and fixed during 8.1 devel phase, no docs text needed.

Comment 10 errata-xmlrpc 2019-11-05 22:17:14 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, 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-2019:3569


Note You need to log in before you can comment on or make changes to this bug.