Skip to content

Commit 883a378

Browse files
authored
Merge pull request #156 from nickanderson/hsi-lists/master
Replaced per-check HSI inventory attributes with pass/fail lists
2 parents 1d55ad3 + 94fe8fd commit 883a378

7 files changed

Lines changed: 218 additions & 198 deletions

File tree

inventory/inventory-fwupd/README.org

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,31 @@ For every device fwupd reports (keyed by DeviceId):
4646
| Attribute | Format |
4747
|---------------------------------+------------------------------------------------------------|
4848
| *Firmware HSI level* | =HSI:0= through =HSI:4= |
49-
| *Firmware HSI L<n>: <Name>* | =PASS= or =FAIL= (one per security check) |
50-
| *Firmware HSI attributes* | =Name (HSI L<level>): <result> [PASS|FAIL]= (slist) |
49+
| *Firmware HSI failing* | =L<n>: <Name>= (slist) |
50+
| *Firmware HSI passing* | =L<n>: <Name>= (slist) |
5151

5252
*Firmware HSI level* is the rolled-up Host Security Identifier level.
5353
fwupd walks levels 1--4 sequentially; the result is the highest level
5454
where all attributes pass, stopping at the first level with any failure.
5555

56-
*Firmware HSI L<n>: <Name>* variables (e.g. =Firmware HSI L1: TPM v2.0=)
57-
are individual string attributes with value =PASS= or =FAIL=. These are
58-
consumed by *compliance-report-fwupd* for per-check compliance conditions.
59-
Two normalizations are applied to keep inventory attribute names stable
60-
and aligned with the HSI specification:
56+
*Firmware HSI failing* and *Firmware HSI passing* are slists of the
57+
security checks fwupd reported, split by outcome (e.g. =L1: TPM v2.0=).
58+
The check set is hardware dependent, so a check in neither list is not
59+
applicable to this host. *compliance-report-fwupd* matches an exact item
60+
against *Firmware HSI failing* for its per-check conditions.
61+
62+
Items keep the =L<n>:= prefix because the name alone is not unique:
63+
fwupd reports two distinct checks named =Platform debugging=, at L1
64+
(Intel DCI) and L2 (debug locked). Two normalizations keep items stable:
6165

6266
- *Name normalization:* The CSME version attribute is emitted as
63-
=Firmware HSI L1: CSME version= regardless of the firmware version
64-
string fwupd reports (which varies per host).
67+
=L1: CSME version= regardless of the firmware version string fwupd
68+
reports (which varies per host).
6569
- *Level normalization:* fwupd marks some runtime checks at HsiLevel 0
6670
even though they contribute to scored HSI levels. The module maps
6771
these to their specification levels: =UEFI secure boot= is emitted
6872
at L1 (not L0) and =CET OS Support= at L3 (not L0).
6973

70-
*Firmware HSI attributes* is an slist with one detailed entry per
71-
security check, useful for drill-down in Mission Portal inventory views.
72-
7374
* Measurements
7475

7576
The following values are emitted as =cf-monitord= measurements for
29 KB
Loading

inventory/inventory-fwupd/policy.cf

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,8 @@ bundle agent inventory_fwupd_hsi(security_src)
383383
# compute the rolled-up HSI level.
384384
#
385385
# Emits:
386-
# - Per-attribute PASS/FAIL strings named "Firmware HSI L<n>: <Name>"
387-
# for use in compliance report conditions.
388-
# - An slist of detailed results formatted "Name (HSI L<level>):
389-
# <result> [PASS|FAIL]" for inventory drill-down.
386+
# - "Firmware HSI failing" and "Firmware HSI passing", slists of
387+
# "L<level>: <name>" check names split by outcome.
390388
# - A count of failing attributes.
391389
# - The rolled-up HSI level (e.g. "HSI:3").
392390
#
@@ -419,6 +417,13 @@ bundle agent inventory_fwupd_hsi(security_src)
419417
"_level[$(_idxes)]"
420418
string => "$(_sec[SecurityAttributes][$(_idxes)][HsiLevel])";
421419

420+
# fwupd omits HsiLevel on runtime-issue checks (Linux kernel, UEFI db,
421+
# ...). Default those to L0, otherwise the unresolved level skips
422+
# every promise that builds on it and the check vanishes entirely.
423+
"_level[$(_idxes)]"
424+
string => "0",
425+
unless => isvariable("_level[$(_idxes)]");
426+
422427
"_result[$(_idxes)]"
423428
string => "$(_sec[SecurityAttributes][$(_idxes)][HsiResult])";
424429

@@ -444,10 +449,9 @@ bundle agent inventory_fwupd_hsi(security_src)
444449
"$(_name[$(_idxes)])"
445450
);
446451

447-
# Normalized level for per-attribute inventory: fwupd marks some
448-
# attributes as HsiLevel 0 with a "runtime-issue" flag even though
449-
# they contribute to scored HSI levels. Map them to their HSI spec
450-
# level so inventory attribute names match compliance conditions.
452+
# Normalized level: fwupd marks some attributes as HsiLevel 0 with a
453+
# "runtime-issue" flag even though they contribute to scored HSI
454+
# levels. Map them to their HSI spec level so list items are stable.
451455
# UEFI secure boot (org.fwupd.hsi.Uefi.SecureBoot) → HSI:1
452456
# CET OS Support (org.fwupd.hsi.IntelCet.Active) → HSI:3
453457
"_inv_level[$(_idxes)]"
@@ -459,19 +463,35 @@ bundle agent inventory_fwupd_hsi(security_src)
459463
"$(_level[$(_idxes)])"
460464
);
461465

462-
# Per-attribute inventory: one string variable per HSI check,
463-
# named "Firmware HSI L<level>: <name>" with value PASS or FAIL.
464-
# This enables per-check compliance report conditions.
465-
"fwupd_hsi_check[$(_idxes)]"
466-
string => "$(_status[$(_idxes)])",
467-
meta => {
468-
"inventory",
469-
"attribute_name=Firmware HSI L$(_inv_level[$(_idxes)]): $(_inv_name[$(_idxes)])",
470-
};
471-
472-
"fwupd_hsi_attr[$(_idxes)]"
473-
string => "$(_name[$(_idxes)]) (HSI L$(_level[$(_idxes)])): $(_result[$(_idxes)]) [$(_status[$(_idxes)])]",
474-
meta => { "inventory", "attribute_name=Firmware HSI attributes" };
466+
# Check names split by outcome into two lists, rather than one
467+
# inventory attribute per check.
468+
#
469+
# Inventory attribute names are fleet wide: an attribute any host
470+
# defines is offered as a column for every host. fwupd's check set
471+
# is hardware dependent, so one attribute per check grew that list
472+
# with every distinct chipset in the fleet while each host filled in
473+
# only its own subset. Two lists keep this module at two stable
474+
# attribute names regardless of the hardware, and carry the same
475+
# information: a check in neither list is not applicable to this
476+
# host.
477+
#
478+
# The level prefix disambiguates fwupd's two distinct checks both
479+
# named "Platform debugging" (L1 Intel DCI, L2 debug locked).
480+
"_failing_name[$(_idxes)]"
481+
string => "L$(_inv_level[$(_idxes)]): $(_inv_name[$(_idxes)])",
482+
if => strcmp("$(_status[$(_idxes)])", "FAIL");
483+
484+
"_passing_name[$(_idxes)]"
485+
string => "L$(_inv_level[$(_idxes)]): $(_inv_name[$(_idxes)])",
486+
if => strcmp("$(_status[$(_idxes)])", "PASS");
487+
488+
"fwupd_hsi_failing"
489+
slist => getvalues("_failing_name"),
490+
meta => { "inventory", "attribute_name=Firmware HSI failing" };
491+
492+
"fwupd_hsi_passing"
493+
slist => getvalues("_passing_name"),
494+
meta => { "inventory", "attribute_name=Firmware HSI passing" };
475495

476496
"fwupd_hsi_failing_count"
477497
int => countclassesmatching("inventory_fwupd_hsi_failing_[0-9]+");

management/manage-fwupd/README.org

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ first.
9393
* Mission Portal
9494

9595
The module reports =fwupd management status= as an inventory attribute
96-
visible in Mission Portal's inventory reports:
97-
98-
[[https://raw.githubusercontent.com/cfengine/modules/master/management/manage-fwupd/mp-inventory-fwupd-status.png]]
96+
visible in Mission Portal's inventory reports.
9997

10098
* Behavior
10199

-51.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)