def process_kickstart(self, data): """Process the kickstart data.""" self.set_enabled(data.autopart.autopart) request = PartitioningRequest() if data.autopart.type is not None: request.partitioning_scheme = data.autopart.type if data.autopart.fstype: request.file_system_type = data.autopart.fstype if data.autopart.noboot: request.excluded_mount_points.append("/boot") if data.autopart.nohome: request.excluded_mount_points.append("/home") if data.autopart.noswap: request.excluded_mount_points.append("swap") if data.autopart.encrypted: request.encrypted = True request.passphrase = data.autopart.passphrase request.cipher = data.autopart.cipher request.luks_version = data.autopart.luks_version request.pbkdf = data.autopart.pbkdf request.pbkdf_memory = data.autopart.pbkdf_memory request.pbkdf_time = data.autopart.pbkdf_time request.pbkdf_iterations = data.autopart.pbkdf_iterations request.escrow_certificate = data.autopart.escrowcert request.backup_passphrase_enabled = data.autopart.backuppassphrase self.set_request(request)
def test_luks2_format_args(self): storage = create_storage() request = PartitioningRequest() request.encrypted = True request.passphrase = "default" request.luks_version = "luks2" request.pbkdf = "argon2i" request.pbkdf_memory = 256 request.pbkdf_iterations = 1000 request.pbkdf_time = 100 args = AutomaticPartitioningTask._get_luks_format_args( storage, request) pbkdf_args = args.pop("pbkdf_args") assert args == { "passphrase": "default", "cipher": "", "luks_version": "luks2", "escrow_cert": None, "add_backup_passphrase": False, } assert isinstance(pbkdf_args, LUKS2PBKDFArgs) assert pbkdf_args.type == "argon2i" assert pbkdf_args.max_memory_kb == 256 assert pbkdf_args.iterations == 1000 assert pbkdf_args.time_ms == 100
def luks1_format_args_test(self): storage = create_storage() storage._escrow_certificates["file:///tmp/escrow.crt"] = "CERTIFICATE" request = PartitioningRequest() request.encrypted = True request.passphrase = "passphrase" request.luks_version = "luks1" request.cipher = "aes-xts-plain64" request.escrow_certificate = "file:///tmp/escrow.crt" request.backup_passphrase_enabled = True args = AutomaticPartitioningTask._get_luks_format_args(storage, request) self.assertEqual(args, { "passphrase": "passphrase", "cipher": "aes-xts-plain64", "luks_version": "luks1", "pbkdf_args": None, "escrow_cert": "CERTIFICATE", "add_backup_passphrase": True, })