mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-09 09:29:04 +00:00

The HSI specification is currently incomplete and in active development. Sample output for my Lenovo P50 Laptop: Host Security ID: HSI:2+UA! HSI-1 ✔ UEFI dbx: OK ✔ TPM: v2.0 ✔ SPI: Write disabled ✔ SPI: Lock enabled ✔ SPI: SMM required ✔ UEFI Secure Boot: Enabled HSI-2 ✔ TPM Reconstruction: Matched PCR0 reading HSI-3 ✘ Linux Kernel S3 Sleep: Deep sleep available HSI-4 ✘ Intel CET: Unavailable Runtime Suffix -U ✔ Firmware Updates: Newest release is 8 months old Runtime Suffix -A ✔ Firmware Attestation: OK Runtime Suffix -! ✔ fwupd plugins: OK ✔ Linux Kernel: OK ✔ Linux Kernel: Locked down ✘ Linux Swap: Not encrypted
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
/*
|
|
* Copyright (C) 2020 Richard Hughes <richard@hughsie.com>
|
|
*
|
|
* SPDX-License-Identifier: LGPL-2.1+
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include "fu-plugin-vfuncs.h"
|
|
#include "fu-hash.h"
|
|
|
|
void
|
|
fu_plugin_init (FuPlugin *plugin)
|
|
{
|
|
fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
|
|
}
|
|
|
|
void
|
|
fu_plugin_add_security_attrs (FuPlugin *plugin, FuSecurityAttrs *attrs)
|
|
{
|
|
gsize bufsz = 0;
|
|
g_autofree gchar *buf = NULL;
|
|
g_autoptr(FwupdSecurityAttr) attr = NULL;
|
|
g_autoptr(GError) error_local = NULL;
|
|
g_autoptr(GFile) file = g_file_new_for_path ("/sys/power/mem_sleep");
|
|
|
|
/* create attr */
|
|
attr = fwupd_security_attr_new ("org.kernel.CheckS3Sleep");
|
|
fwupd_security_attr_set_level (attr, FWUPD_SECURITY_ATTR_LEVEL_THEORETICAL);
|
|
fwupd_security_attr_set_name (attr, "Linux Kernel S3 Sleep");
|
|
fu_security_attrs_append (attrs, attr);
|
|
|
|
/* load file */
|
|
if (!g_file_load_contents (file, NULL, &buf, &bufsz, NULL, &error_local)) {
|
|
g_autofree gchar *fn = g_file_get_path (file);
|
|
g_warning ("could not open %s: %s", fn, error_local->message);
|
|
fwupd_security_attr_set_result (attr, "Deep sleep status unavailable");
|
|
return;
|
|
}
|
|
if (g_strstr_len (buf, bufsz, "[deep]") != NULL) {
|
|
fwupd_security_attr_set_result (attr, "System configured to suspend-to-ram (S3)");
|
|
return;
|
|
}
|
|
|
|
/* success */
|
|
fwupd_security_attr_add_flag (attr, FWUPD_SECURITY_ATTR_FLAG_SUCCESS);
|
|
}
|