Skip to content

Commit

Permalink
getting luks2 encryption settings from product features
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Feb 15, 2024
1 parent 50263a9 commit ac11095
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/lib/y2storage/proposal_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
require "y2storage/encryption_method"
require "y2storage/equal_by_instance_variables"
require "y2storage/proposal_space_settings"
require "y2storage/pbkd_function"

module Y2Storage
# Class to manage settings used by the proposal (typically read from control.xml)
Expand Down Expand Up @@ -433,18 +434,32 @@ def load_features

# Loads the default encryption settings
#
# The encryption settings are not part of control.xml, but can be injected by a previous step of
# the installation, eg. the dialog of the Common Criteria system role
# The encryption settings are not part of the offical control.xml, but can be injected by a previous step of
# the installation, eg. the dialog of the Common Criteria system role or expert dialog
def load_encryption
enc = feature(:proposal, :encryption)

return unless enc
return unless enc.respond_to?(:password)

passwd = enc.password.to_s
return if passwd.nil? || passwd.empty?
if enc.is_a?(Hash)
# Data comes from expert dialog
passwd = enc["password"]
self.encryption_password = passwd if !passwd.nil? && !passwd.empty?

type = enc["type"]
# default is luks1
self.encryption_method = EncryptionMethod::LUKS2 if !type.nil? && type == "luks2"

pbkdf = enc["pbkdf"]
self.encryption_pbkdf = Y2Storage::PbkdFunction.find(pbkdf) if !pbkdf.nil? && !pbkdf.empty?
else
# Data comes event. from Common Criteria system role ?
return unless enc.respond_to?(:password)

passwd = enc.password.to_s
return if passwd.nil? || passwd.empty?

self.encryption_password = passwd
self.encryption_password = passwd
end
end

def validated_delete_mode(mode)
Expand Down

0 comments on commit ac11095

Please sign in to comment.