fix
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
JMARyA 2025-01-05 11:39:16 +01:00
parent b7184ba705
commit 601d32bc92
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 19 additions and 19 deletions

View file

@ -4,7 +4,7 @@ use yansi::{Color, Paint};
use crate::{ use crate::{
config::DriveConfig, config::DriveConfig,
linux::{arch_chroot, install_file, run_command}, linux::{arch_chroot, install_file, run_command, systemd_service_enable},
pkg::install_pkgs, pkg::install_pkgs,
}; };
@ -37,25 +37,14 @@ pub fn setup_tpm_unlock(conf: &DriveConfig) {
install_file("/mnt/root/recovery.key", &recovery_key, 0o400); install_file("/mnt/root/recovery.key", &recovery_key, 0o400);
arch_chroot( install_file(
&vec![ "/mnt/etc/systemd/system/tpm-enroll.service",
"systemd-run", &include_str!("../root/tpm-enroll.service")
"--pipe", .replace("<PASSPHRASE>", conf.encryption.as_ref().unwrap())
"--collect", .replace("<ROOT>", &conf.root),
"-p", 0o644,
format!(
"SetCredential=cryptenroll.passphrase:{}",
conf.encryption.as_ref().unwrap()
)
.as_str(),
"systemd-cryptenroll",
"--tpm2-device=auto",
&conf.root,
"--tpm2-pcrs=7",
],
None,
false,
); );
systemd_service_enable("tpm-enroll.service");
} }
// SECURE BOOT // SECURE BOOT

View file

@ -0,0 +1,11 @@
[Unit]
Description=TPM Enrollment Service
[Service]
Type=oneshot
ExecStart=systemd-cryptenroll --tpm2-device=auto <ROOT> --tpm2-pcrs=7 && rm /etc/systemd/system/tpm-enroll.service
SetCredential=cryptenroll.passphrase:<PASSPHRASE>
User=root
[Install]
WantedBy=multi-user.target