MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / luks_setup

Method luks_setup

dstack-util/src/system_setup.rs:1230–1247  ·  view source on GitHub ↗
(&self, disk_crypt_key: &str, name: &str)

Source from the content-addressed store, hash-verified

1228 }
1229
1230 fn luks_setup(&self, disk_crypt_key: &str, name: &str) -> Result<()> {
1231 let root_hd = &self.args.device;
1232 let sector_offset = PAYLOAD_OFFSET / 512;
1233 cmd! {
1234 info "Formatting encrypted disk";
1235 echo -n $disk_crypt_key |
1236 cryptsetup luksFormat
1237 --type luks2
1238 --offset $sector_offset
1239 --cipher aes-xts-plain64
1240 --pbkdf pbkdf2
1241 -d-
1242 $root_hd
1243 $name;
1244 }
1245 .or(Err(anyhow!("Failed to setup luks volume")))?;
1246 self.open_encrypted_volume(disk_crypt_key, name)
1247 }
1248
1249 fn open_encrypted_volume(&self, disk_crypt_key: &str, name: &str) -> Result<()> {
1250 let root_hd = &self.args.device;

Callers 1

mount_data_diskMethod · 0.80

Calls 1

open_encrypted_volumeMethod · 0.80

Tested by

no test coverage detected