Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Verify disk is encrypted before continuing #71

Open
Lvl4Sword opened this issue Apr 12, 2022 · 1 comment
Open

Verify disk is encrypted before continuing #71

Lvl4Sword opened this issue Apr 12, 2022 · 1 comment

Comments

@Lvl4Sword
Copy link
Owner

Lvl4Sword commented Apr 12, 2022

Killer is useless on a system that isn't encrypted. So, this should be checked.

import subprocess

physical_volumes = subprocess.check_output(['pvs', '-o', 'pv_name']).decode().split('\n')[1:-1]
for physical_volume in physical_volumes:
    physical_volume = physical_volume.strip()
    cryptsetup_status = subprocess.check_output(['cryptsetup', 'status', physical_volume]).decode().split('\n')
    _, type = cryptsetup_status[1].split()
    if type == 'LUKS2':
        print(f'{physical_volume} is encrypted with LUKS!')

the above is a great first step. Will need to do verification/checks on external drives that are encrypted, though.
Looks like it works just fine on an external drive connected via USB, as the external doesn't show up.
But am unsure ( and can't test ) on two or more internal drives that are encrypted.

@Lvl4Sword
Copy link
Owner Author

Lvl4Sword commented Apr 18, 2022

The above is great for LUKS, but VeraCrypt needs checked too. maybe VeraCrypt needs checked? I can't imagine the amount of people on Linux that opt to not use LUKS and instead use VeraCrypt is incredibly high.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant