Skip to content

Commit

Permalink
Merge pull request #432 from yast/modern_fde
Browse files Browse the repository at this point in the history
Support modern `fde-tools`
  • Loading branch information
ancorgs authored Feb 17, 2023
2 parents ee5ed27 + 47470dc commit a457bfc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
4 changes: 2 additions & 2 deletions service/etc/d-installer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ Tumbleweed:
ALP:
software:
installation_repositories:
- url: https://download.opensuse.org/repositories/SUSE:/ALP:/ToTest/images/repo/ALP-0.1-x86_64-Media1/
- url: https://download.opensuse.org/repositories/SUSE:/ALP/standard/
archs: x86_64
- url: https://download.opensuse.org/repositories/SUSE:/ALP:/ToTest/images/repo/ALP-0.1-aarch64-Media1/
- url: https://download.opensuse.org/repositories/SUSE:/ALP/standard/
archs: aarch64
mandatory_patterns:
- alp_base
Expand Down
21 changes: 5 additions & 16 deletions service/lib/dinstaller/storage/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ def tpm_key?
end

def tpm_proposal?
settings = proposal.calculated_settings
settings.encrypt? && !settings.lvm
proposal.calculated_settings.encrypt?
end

def tpm_system?
Expand All @@ -201,7 +200,7 @@ def tpm_present?

@tpm_present =
begin
execute_fdectl("tpm-present")
Yast::Execute.on_target!("fdectl", "tpm-present")
logger.info "FDE: TPMv2 detected"
true
rescue Cheetah::ExecutionFailed
Expand All @@ -215,9 +214,9 @@ def tpm_product?
end

def prepare_tpm_key
keyfile_path = File.join(Yast::Installation.destdir, "root", ".root.keyfile")
execute_fdectl(
"add-secondary-key", "--keyfile", keyfile_path,
keyfile_path = File.join("root", ".root.keyfile")
Yast::Execute.on_target!(
"fdectl", "add-secondary-key", "--keyfile", keyfile_path,
stdin: "#{proposal.calculated_settings.encryption_password}\n",
recorder: Yast::ReducedRecorder.new(skip: :stdin)
)
Expand All @@ -228,16 +227,6 @@ def prepare_tpm_key
rescue Cheetah::ExecutionFailed
false
end

def execute_fdectl(*args)
# Some subcommands like "tpm-present" should not require a --device argument, but they
# currently do. Let's always us until the problem at fdectl is fully fixed.
Yast::Execute.locally!("fdectl", "--device", fdectl_device, *args)
end

def fdectl_device
Yast::Installation.destdir
end
end
end
end

0 comments on commit a457bfc

Please sign in to comment.