Skip to content

Commit 4b83ef6

Browse files
committed
Add secureboot-enforce setting in xapi.conf
This setting will be used by varstored to know wheter to allow the start of a VM that has no certificates when secureboot is enabled by writing in the xenstore in `/local/domain/<domid>/platform/secureboot-enforce`. Default: false to keep the previous behavior. See: xapi-project/varstored#19 Signed-off-by: BenjiReis <[email protected]>
1 parent 6b4ca5a commit 4b83ef6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ocaml/xapi/xapi_globs.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,8 @@ let prefer_nbd_attach = ref false
998998
(** 1 MiB *)
999999
let max_observer_file_size = ref (1 lsl 20)
10001000

1001+
let secureboot_enforce = ref false
1002+
10011003
let xapi_globs_spec =
10021004
[
10031005
( "master_connection_reset_timeout"
@@ -1470,6 +1472,11 @@ let other_options =
14701472
, (fun () -> string_of_int !max_observer_file_size)
14711473
, "The maximum size of log files for saving spans"
14721474
)
1475+
; ( "secureboot-enforce"
1476+
, Arg.Set secureboot_enforce
1477+
, (fun () -> string_of_bool !secureboot_enforce)
1478+
, "Do not start a VM with no SB certificates if secureboot is set to on"
1479+
)
14731480
]
14741481

14751482
(* The options can be set with the variable xapiflags in /etc/sysconfig/xapi.

ocaml/xapi/xapi_vm.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,10 @@ let create ~__context ~name_label ~name_description ~power_state ~user_version
605605
else
606606
other_config
607607
in
608+
let _platform = if !Xapi_globs.secureboot_enforce
609+
then ("secureboot-enforce", "true") :: platform
610+
else platform
611+
in
608612
(* NB apart from the above, parameter validation is delayed until VM.start *)
609613
let uuid = Uuidx.make () in
610614
let vm_ref = Ref.make () in
@@ -664,7 +668,7 @@ let create ~__context ~name_label ~name_description ~power_state ~user_version
664668
~memory_static_min ~vCPUs_params ~vCPUs_at_startup ~vCPUs_max
665669
~actions_after_softreboot ~actions_after_shutdown ~actions_after_reboot
666670
~actions_after_crash ~hVM_boot_policy ~hVM_boot_params
667-
~hVM_shadow_multiplier ~suspend_VDI:_suspend_VDI ~platform ~nVRAM ~pV_kernel
671+
~hVM_shadow_multiplier ~suspend_VDI:_suspend_VDI ~platform:_platform ~nVRAM ~pV_kernel
668672
~pV_ramdisk ~pV_args ~pV_bootloader ~pV_bootloader_args ~pV_legacy_args
669673
~pCI_bus ~other_config ~domid:(-1L) ~domarch:""
670674
~last_boot_CPU_flags:_last_boot_CPU_flags ~is_control_domain:false ~metrics

0 commit comments

Comments
 (0)