This commit is contained in:
parent
b7184ba705
commit
601d32bc92
2 changed files with 19 additions and 19 deletions
|
@ -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
|
||||||
|
|
11
src/root/tpm-enroll.service
Normal file
11
src/root/tpm-enroll.service
Normal 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
|
Loading…
Add table
Reference in a new issue