File tree Expand file tree Collapse file tree 12 files changed +54
-9
lines changed Expand file tree Collapse file tree 12 files changed +54
-9
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ open Datamodel_roles
10
10
to leave a gap for potential hotfixes needing to increment the schema version.*)
11
11
let schema_major_vsn = 5
12
12
13
- let schema_minor_vsn = 790
13
+ let schema_minor_vsn = 791
14
14
15
15
(* Historical schema versions just in case this is useful later *)
16
16
let rio_schema_major_vsn = 5
Original file line number Diff line number Diff line change @@ -1367,6 +1367,13 @@ let create_params =
1367
1367
; param_release= numbered_release " 25.27.0"
1368
1368
; param_default= Some (VBool Constants. default_ssh_auto_mode)
1369
1369
}
1370
+ ; {
1371
+ param_type= Bool
1372
+ ; param_name= " secure_boot"
1373
+ ; param_doc= " True if the host is in secure boot mode"
1374
+ ; param_release= numbered_release " 25.32.0"
1375
+ ; param_default= Some (VBool false )
1376
+ }
1370
1377
]
1371
1378
1372
1379
let create =
@@ -3108,6 +3115,9 @@ let t =
3108
3115
~default_value: (Some (VBool Constants. default_ssh_auto_mode))
3109
3116
" ssh_auto_mode"
3110
3117
" Reflects whether SSH auto mode is enabled for the host"
3118
+ ; field ~qualifier: DynamicRO ~lifecycle: [] ~ty: Bool
3119
+ ~default_value: (Some (VBool false )) " secure_boot"
3120
+ " Whether the host has booted in secure boot mode"
3111
3121
]
3112
3122
)
3113
3123
()
Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ let prototyped_of_field = function
97
97
Some " 22.26.0"
98
98
| "SM" , "host_pending_features" ->
99
99
Some " 24.37.0"
100
+ | "host" , "secure_boot" ->
101
+ Some " 25.31.0"
100
102
| "host" , "ssh_auto_mode" ->
101
103
Some " 25.27.0"
102
104
| "host" , "console_idle_timeout" ->
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
3
3
(* BEWARE: if this changes, check that schema has been bumped accordingly in
4
4
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)
5
5
6
- let last_known_schema_hash = " 7586cb039918e573594fc358e90b0f04 "
6
+ let last_known_schema_hash = " 3b20f4304cfaaa7b6213af91ae632e64 "
7
7
8
8
let current_schema_hash : string =
9
9
let open Datamodel_types in
Original file line number Diff line number Diff line change @@ -172,14 +172,15 @@ let make_host ~__context ?(uuid = make_uuid ()) ?(name_label = "host")
172
172
?(local_cache_sr = Ref. null) ?(chipset_info = [] ) ?(ssl_legacy = false )
173
173
?(last_software_update = Date. epoch) ?(last_update_hash = " " )
174
174
?(ssh_enabled = true ) ?(ssh_enabled_timeout = 0L ) ?(ssh_expiry = Date. epoch)
175
- ?(console_idle_timeout = 0L ) ?(ssh_auto_mode = false ) () =
175
+ ?(console_idle_timeout = 0L ) ?(ssh_auto_mode = false ) ?(secure_boot = false )
176
+ () =
176
177
let host =
177
178
Xapi_host. create ~__context ~uuid ~name_label ~name_description ~hostname
178
179
~address ~external_auth_type ~external_auth_service_name
179
180
~external_auth_configuration ~license_params ~edition ~license_server
180
181
~local_cache_sr ~chipset_info ~ssl_legacy ~last_software_update
181
182
~last_update_hash ~ssh_enabled ~ssh_enabled_timeout ~ssh_expiry
182
- ~console_idle_timeout ~ssh_auto_mode
183
+ ~console_idle_timeout ~ssh_auto_mode ~secure_boot
183
184
in
184
185
Db.Host. set_cpu_info ~__context ~self: host ~value: default_cpu_info ;
185
186
host
@@ -219,7 +220,8 @@ let make_host2 ~__context ?(ref = Ref.make ()) ?(uuid = make_uuid ())
219
220
~recommended_guidances: [] ~latest_synced_updates_applied: `unknown
220
221
~pending_guidances_recommended: [] ~pending_guidances_full: []
221
222
~last_update_hash: " " ~ssh_enabled: true ~ssh_enabled_timeout: 0L
222
- ~ssh_expiry: Date. epoch ~console_idle_timeout: 0L ~ssh_auto_mode: false ;
223
+ ~ssh_expiry: Date. epoch ~console_idle_timeout: 0L ~ssh_auto_mode: false
224
+ ~secure_boot: false ;
223
225
ref
224
226
225
227
let make_pif ~__context ~network ~host ?(device = " eth0" )
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ let add_host __context name =
25
25
~local_cache_sr: Ref. null ~chipset_info: [] ~ssl_legacy: false
26
26
~last_software_update: Clock.Date. epoch ~last_update_hash: " "
27
27
~ssh_enabled: true ~ssh_enabled_timeout: 0L ~ssh_expiry: Clock.Date. epoch
28
- ~console_idle_timeout: 0L ~ssh_auto_mode: false
28
+ ~console_idle_timeout: 0L ~ssh_auto_mode: false ~secure_boot: false
29
29
)
30
30
31
31
(* Creates an unlicensed pool with the maximum number of hosts *)
Original file line number Diff line number Diff line change @@ -3393,6 +3393,9 @@ let host_record rpc session_id host =
3393
3393
~value: (safe_bool_of_string " ssh-auto-mode" value)
3394
3394
)
3395
3395
()
3396
+ ; make_field ~name: " secure-boot"
3397
+ ~get: (fun () -> string_of_bool (x () ).API. host_secure_boot)
3398
+ ()
3396
3399
]
3397
3400
}
3398
3401
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ let create_localhost ~__context info =
65
65
~ssh_expiry: Date. epoch
66
66
~console_idle_timeout: Constants. default_console_idle_timeout
67
67
~ssh_auto_mode: ! Xapi_globs. ssh_auto_mode_default
68
+ ~secure_boot: false
68
69
in
69
70
()
70
71
@@ -408,5 +409,17 @@ let update_env __context sync_keys =
408
409
Xapi_host. set_console_idle_timeout ~__context ~self: localhost
409
410
~value: console_timeout
410
411
) ;
411
-
412
+ switched_sync Xapi_globs. sync_secure_boot (fun () ->
413
+ let result =
414
+ try
415
+ let contents = Unixext. string_of_file ! Xapi_globs. secure_boot_path in
416
+ contents.[4 ] <> '\x00'
417
+ with e ->
418
+ warn " %s error while reading %S: %s" __FUNCTION__
419
+ ! Xapi_globs. secure_boot_path
420
+ (Printexc. to_string e) ;
421
+ false
422
+ in
423
+ Db.Host. set_secure_boot ~__context ~self: localhost ~value: result
424
+ ) ;
412
425
remove_pending_guidances ~__context
Original file line number Diff line number Diff line change @@ -374,6 +374,8 @@ let sync_chipset_info = "sync_chipset_info"
374
374
375
375
let sync_ssh_status = " sync_ssh_status"
376
376
377
+ let sync_secure_boot = " sync_secure_boot"
378
+
377
379
let sync_pci_devices = " sync_pci_devices"
378
380
379
381
let sync_gpus = " sync_gpus"
@@ -1330,6 +1332,10 @@ let ssh_monitor_service = ref "xapi-ssh-monitor"
1330
1332
1331
1333
let ssh_auto_mode_default = ref true
1332
1334
1335
+ let secure_boot_path =
1336
+ ref
1337
+ " /sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c"
1338
+
1333
1339
(* Fingerprint of default patch key *)
1334
1340
let citrix_patch_key =
1335
1341
" NERDNTUzMDMwRUMwNDFFNDI4N0M4OEVCRUFEMzlGOTJEOEE5REUyNg=="
@@ -1786,6 +1792,11 @@ let other_options =
1786
1792
, " Defaults to true; overridden to false via \
1787
1793
/etc/xapi.conf.d/ssh-auto-mode.conf(e.g., in XenServer 8)"
1788
1794
)
1795
+ ; ( " secure-boot-efi-path"
1796
+ , Arg. Set_string secure_boot_path
1797
+ , (fun () -> ! secure_boot_path)
1798
+ , " Path to secure boot status file"
1799
+ )
1789
1800
; ( " vm-sysprep-enabled"
1790
1801
, Arg. Set vm_sysprep_enabled
1791
1802
, (fun () -> string_of_bool ! vm_sysprep_enabled)
Original file line number Diff line number Diff line change @@ -1027,7 +1027,8 @@ let create ~__context ~uuid ~name_label ~name_description:_ ~hostname ~address
1027
1027
~external_auth_type ~external_auth_service_name ~external_auth_configuration
1028
1028
~license_params ~edition ~license_server ~local_cache_sr ~chipset_info
1029
1029
~ssl_legacy :_ ~last_software_update ~last_update_hash ~ssh_enabled
1030
- ~ssh_enabled_timeout ~ssh_expiry ~console_idle_timeout ~ssh_auto_mode =
1030
+ ~ssh_enabled_timeout ~ssh_expiry ~console_idle_timeout ~ssh_auto_mode
1031
+ ~secure_boot =
1031
1032
(* fail-safe. We already test this on the joining host, but it's racy, so multiple concurrent
1032
1033
pool-join might succeed. Note: we do it in this order to avoid a problem checking restrictions during
1033
1034
the initial setup of the database *)
@@ -1092,7 +1093,8 @@ let create ~__context ~uuid ~name_label ~name_description:_ ~hostname ~address
1092
1093
~tls_verification_enabled ~last_software_update ~last_update_hash
1093
1094
~recommended_guidances: [] ~latest_synced_updates_applied: `unknown
1094
1095
~pending_guidances_recommended: [] ~pending_guidances_full: [] ~ssh_enabled
1095
- ~ssh_enabled_timeout ~ssh_expiry ~console_idle_timeout ~ssh_auto_mode ;
1096
+ ~ssh_enabled_timeout ~ssh_expiry ~console_idle_timeout ~ssh_auto_mode
1097
+ ~secure_boot ;
1096
1098
(* If the host we're creating is us, make sure its set to live *)
1097
1099
Db.Host_metrics. set_last_updated ~__context ~self: metrics ~value: (Date. now () ) ;
1098
1100
Db.Host_metrics. set_live ~__context ~self: metrics ~value: host_is_us ;
You can’t perform that action at this time.
0 commit comments