<%- local util = require('luci.util') local fs = require('luci.fs') local sys = require('luci.sys') --If there is a tpm device --local Vendor_IFX="Infineon Technologies" --local tpm_version_info=util.exec("tpm_version 2>/dev/null") local tpm_tpm_version=util.exec("tpm_version | awk -F: '$1 ~ /TPM Version/ {print $2}' | sed 's/^[ \t]*//' ") local tpm_chip_version=util.exec("tpm_version | awk -F: '$1 ~ /Chip Version/ {print $2}' | sed 's/^[ \t]*//' ") local tpm_tpmtools_version=util.exec("tpm_version -v | awk -F: '$1 ~ /tpm_version/ {print $2}' | sed 's/^[ \t]*//' ") --local tpm_vendor_short=util.exec("echo".. tpm_version_info.." | awk -F: '$1 ~ /Vendor ID/ {print $2}' | sed 's/^[ \t]*//' | sed 's/[ \t]*$//'") --local tpm_vendor_full=util.exec("eval "echo \$Vendor_$tpm_vendor_short"") --local tpm_vendor_id=util.execute("$tpm_vendor_short ${tpm_vendor_full:+"($tpm_vendor_full)"}"") local tpm_vendor_id=util.exec("tpm_version | awk -F: '$1 ~ /Vendor ID/ {print $2}' | sed 's/^[ \t]*//' | sed 's/[ \t]*$//'") local tpm_manufacturer_info=util.exec("tpm_version | awk -F: '$1 ~ /Manufacturer Info/ {print $2}' | sed 's/^[ \t]*//' | sed 's/[ \t]*$//' ") if tpm_chip_version == "" then tpm_chip_version=translate("Unknown") end if tpm_tpm_version == "" then tpm_tpm_version=translate("Unknown") end if tpm_tpmtools_version == "" then tpm_tpmtools_version=translate("Unknown") end if tpm_vendor_id == "" then tpm_vendor_id=translate("Unknown") end if tpm_manufacturer_info == "" then tpm_manufacturer_info=translate("Unknown") end local tpm_is_enabled=util.exec("cat /sys/class/misc/tpm0/device/enabled") local tpm_is_active=util.exec("cat /sys/class/misc/tpm0/device/active") local tpm_is_owned=util.exec("cat /sys/class/misc/tpm0/device/owned") local tpm_enabled_status local tpm_active_status local tpm_owned_status if tonumber(tpm_is_enabled) == 1 then tpm_enabled_status=translate("Enabled") else tpm_enabled_status=translate("Disabled") end if tonumber(tpm_is_active) == 1 then tpm_active_status=translate("Active") else tpm_active_status=translate("Deactivate") end if tonumber(tpm_is_owned) == 1 then tpm_owned_status=translate("Owned") else tpm_owned_status=translate("Unowned") end local has_user_password="no" local tpm_persistent_deactivated_status local tpm_volatile_deactivated_status local tpm_owner_clear_disabled local tpm_force_clear_disabled local tpm_public_key=translate("Unknown") if has_user_password == "no" then tpm_persistent_deactivated_status=util.exec("tpm_setactive -sz 2>/dev/null | awk -F: '$1 ~ /Persistent Deactivated/ {print $2}' | sed 's/^[ \t]*//'") tpm_volatile_deactivated_status=util.exec("tpm_setactive -sz 2>/dev/null | awk -F: '$1 ~ /Volatile Deactivated/ {print $2}' | sed 's/^[ \t]*//'") tpm_owner_clear_disabled=util.exec("tpm_setclearable -sz 2>/dev/null | awk -F: '$1 ~ /Owner Clear/ {print $2}' | sed 's/^[ \t]*//'") tpm_force_clear_disabled=util.exec("tpm_setclearable -sz 2>/dev/null | awk -F: '$1 ~ /Force Clear/ {print $2}' | sed 's/^[ \t]*//'") tpm_public_key=util.exec("tpm_getpubek -z 2>&1 | awk '{print $0;}'") end if tpm_persistent_deactivated_status == "" then tpm_persistent_deactivated_status=translate("Unknown") end if tpm_volatile_deactivated_status=="" then tpm_volatile_deactivated_status=translate("Unknown") end if tpm_owner_clear_disabled=="" then tpm_owner_clear_disabled=translate("Unknown") end if tpm_force_clear_disabled=="" then tpm_force_clear_disabled=translate("Unknown") end local tcsd_status local tcsd_action local pid_tcsd=luci.sys.call("/usr/bin/pgrep tcsd > /dev/null 2>&1") if pid_tcsd == 0 then tcsd_status=translate("Running") tcsd_action=translate("Stop Agent") else tcsd_status=translate("Not Running") tcsd_action=translate("Start Agent") end -%> <%+header%>

<%:TCG Core Service Daemon (TCSD)%>
<%:TCSD Status%> <%=tcsd_status%> ?status=<%=tcsd_status%>'">
<%:TPM Information%>
<%:Chip Version%><%=tpm_chip_version%>
<%:TPM Version%><%=tpm_tpm_version%>
<%:Vendor ID%><%=tpm_vendor_id%>
<%:Manufacturer Information%><%=tpm_manufacturer_info%>
<%:TPM Tools Version%><%=tpm_tpmtools_version%>
<%:TPM Status%>
<%:Enabled Status%><%=tpm_enabled_status%>
<%:Active Status%><%=tpm_active_status%>
<%:Owned Status%><%=tpm_owned_status%>
<%:Persistent Deactivated Status%><%=tpm_persistent_deactivated_status%>
<%:Volatile Deactivated Status%><%=tpm_volatile_deactivated_status%>
<%:Owner Clear Disabled%><%=tpm_owner_clear_disabled%>
<%:Force Clear Disabled%><%=tpm_force_clear_disabled%>
<%:TPM Public Key%>