Skip to content

Commit

Permalink
Ignore disk encryption config when no password found
Browse files Browse the repository at this point in the history
  • Loading branch information
svartkanin committed Nov 7, 2024
1 parent 0370e89 commit 7a97b27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions archinstall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,10 @@ def load_config() -> None:
arguments['audio_config'] = models.AudioConfiguration.parse_arg(arguments['audio_config'])

if arguments.get('disk_encryption', None) is not None and disk_config is not None:
password = arguments.get('encryption_password', '')
arguments['disk_encryption'] = disk.DiskEncryption.parse_arg(
arguments['disk_config'],
arguments['disk_encryption'],
password
arguments.get('encryption_password', '')
)


Expand Down
13 changes: 8 additions & 5 deletions archinstall/lib/disk/device_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,32 +1232,35 @@ def validate_enc(cls, disk_config: DiskLayoutConfiguration) -> bool:
def parse_arg(
cls,
disk_config: DiskLayoutConfiguration,
arg: Dict[str, Any],
disk_encryption: Dict[str, Any],
password: str = ''
) -> Optional['DiskEncryption']:
if not cls.validate_enc(disk_config):
return None

if len(password) < 1:
return None

enc_partitions = []
for mod in disk_config.device_modifications:
for part in mod.partitions:
if part.obj_id in arg.get('partitions', []):
if part.obj_id in disk_encryption.get('partitions', []):
enc_partitions.append(part)

volumes = []
if disk_config.lvm_config:
for vol in disk_config.lvm_config.get_all_volumes():
if vol.obj_id in arg.get('lvm_volumes', []):
if vol.obj_id in disk_encryption.get('lvm_volumes', []):
volumes.append(vol)

enc = DiskEncryption(
EncryptionType(arg['encryption_type']),
EncryptionType(disk_encryption['encryption_type']),
password,
enc_partitions,
volumes
)

if hsm := arg.get('hsm_device', None):
if hsm := disk_encryption.get('hsm_device', None):
enc.hsm_device = Fido2Device.parse_arg(hsm)

return enc
Expand Down

0 comments on commit 7a97b27

Please sign in to comment.