Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encrypted Volumes #100

Merged
merged 8 commits into from
Jun 11, 2020
Merged

Encrypted Volumes #100

merged 8 commits into from
Jun 11, 2020

Conversation

dwlehman
Copy link
Collaborator

@dwlehman dwlehman commented Jun 5, 2020

This adds support for LUKS volumes. The testing is very minimal. I'm curious what it will take to get it to pass CI.

@dwlehman
Copy link
Collaborator Author

dwlehman commented Jun 5, 2020

This is built on top of my swap-minimal branch (from #90). Only the last five commits are specific to this.

@richm
Copy link
Contributor

richm commented Jun 5, 2020

@sergio-correia FYI

@dwlehman
Copy link
Collaborator Author

dwlehman commented Jun 5, 2020

Weird that the luks tests should be what fails since that's what I ran locally on F32 prior to opening/updating this pull request.

@dwlehman
Copy link
Collaborator Author

dwlehman commented Jun 5, 2020

Oh, good grief. It only passes on the OS I developed and initially tested on? It'll have to wait til next week.

@dwlehman dwlehman mentioned this pull request Jun 8, 2020
@dwlehman
Copy link
Collaborator Author

dwlehman commented Jun 8, 2020

What's missing at this point is unknown, aside from better testing:

  1. verify that the LUKS layer exists as appropriate and has the expected name
  2. verify the LUKS parameters insofar as that is possible
  3. /etc/crypttab management, including tests/verification

@dwlehman
Copy link
Collaborator Author

The relevant work starts with 'Add basic support for managing LUKS volumes.'

When I started this the swap work was already done, so I assumed it would be on master by the time any serious review of this work began.

@dwlehman dwlehman changed the title LUKS Volumes Encrypted Volumes Jun 10, 2020
@dwlehman
Copy link
Collaborator Author

I saw a problem with mounts that I attempted to add a test (not fix) for in linux-system-roles#50, could this help? (Sorry, wild guess.)

It is probably not specific to the LUKS functionality. The systemd-managed fstab is really quite fussy in my experience so far. I have to run systemctl daemon-reload frequently during test development.

README.md Show resolved Hide resolved
Copy link
Contributor

@richm richm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Collaborator

@vojtechtrefny vojtechtrefny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

README.md Outdated
This string specifies a non-default cipher to be used by LUKS.

##### `encryption_key_size`
This integer specifies the LUKS key size (in bytes).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key size should be in bits, e.g. 512

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh, good catch -- thanks!

This probably merits an explanation. In blivet, the backing device
will have a format of type 'luks'. This is the encrypted, or
backing, device. The next layer out is a LUKSDevice, which
represents the (decrypted/open) device-mapper device. Because the
LUKS layer is optional and can be effectively toggled, there are
many occasions on which it is convenient to look past the LUKS
layer directly to the backing device. For this purpose, all of
blivet's StorageDevice classes have a 'raw_device' property. For
unexcrypted leaf devices, the raw device is the same as the actual
device. For encrypted leaf devices, the raw device points to the
backing device.

In other words, adding _raw_device establishes a line between the
raw/backing/encrypted device and the decrypted/mapped/open device
which makes test validation quite a bit easier.
Doing so for all formats can trigger deactivation of device stacks
that needlessly complicates things.
Relying on _reformat to create the formatting worked because a
DiskDevice always exists. Now that self._device can be an
optional, non-existent, LUKS layer on top of the disk we have to
make the disk volume class behave more like the other volume
classes -- namely, it has to create its format as part of _create
since we will not always call _reformat (eg: when we've set up,
but not yet created, a new LUKS layer on the disk).
@dwlehman dwlehman merged commit 98fd8bd into linux-system-roles:master Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants