Secure Boot Zertifikat

Antworten
KrawczykHIS
Beiträge: 73
Registriert: 05 Nov 2015, 11:26

Secure Boot Zertifikat

Beitrag von KrawczykHIS »

Moin,

da Rückfragen auf opsiconf zu Secure Boot Zertifikat gab. Unser Assetsmanagment "Loginventory" hat dazu einen coole Zusammenfassung erstellt, die Informationen von Microsoft Blog-Artikel gut zusammenfasst (abseits der Abfragen innerhalb der Anwendung):
https://www.loginventory.de/blog/uefi-s ... efen-2026/

Zu Erkennung des Status gibt es folgende Registry-Keys:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing,UEFICA2023Status
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing,WindowsUEFICA2023Capable
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing,UEFICA2023Error

Hierzu die Beschreibung der Werte:
UEFICA2023Status

Zeigt den Fortschritt des Updates:

NotStarted → Update noch nicht gestartet
InProgress → Update läuft (bleibt oft bis zum Neustart bestehen)
Updated → Update erfolgreich abgeschlossen

WindowsUEFICA2023Capable

Gibt an, ob ein System technisch in der Lage ist, das Update durchzuführen:

0 → Windows UEFI CA 2023 Zertifikat ist nicht in der DB
1 → Windows UEFI CA 2023 Zertifikat ist bereits in der DB
2 → Zertifikat wurde installiert und System ist mit diesem Zertifikat gestartet worden
UEFICA2023Error hatte ich bisher noch keine wirkliche Information erhalten ...


Dann gibts ein sehr hilfreiche Eventlog unter Windows, im Ereignislog unter "System" mit Filter Quelle = "TPM-WMI" werden die konkreten Informationen mitgeteilt, welche Schritte noch notwendig sind.

Im Eventlog wird gerne berichtet, wenn Hersteller Bios-Update notwendig sind, um das Zertififkat vollständig zu aktualisieren können.

Dann beschreibt Microsoft in diesem Blog-Arikel ganz am Ende die erforderlichen Schritte, damit Windows vorbereitet wird, Zertifikat zu aktualisieren:

https://techcommunity.microsoft.com/blo ... ys/4055324

Das sind die Informationen die ich mir zusammengetragen habe.

Viele Grüße
Patrick
KrawczykHIS
Beiträge: 73
Registriert: 05 Nov 2015, 11:26

Re: Secure Boot Zertifikat

Beitrag von KrawczykHIS »

Zusätzlich abseits von Microsoft-Artikel

Lenovo hat auch eine Seite erstellt zu der Informationen: https://support.lenovo.com/de/de/solutions/ht518129

Aber aus eigene Erfahrung kann ich sagen, dass die Tabelle nicht 100 % korrekt ist, Zumindests für die T14 Gen2 (20W0, 20W1) funktioniert mit der Bios-Version noch kein Update. :roll:

Da kann UIB ihren Lenovo Kontakt auch ärgern. :twisted:
feltel
Beiträge: 312
Registriert: 09 Dez 2014, 07:22

Re: Secure Boot Zertifikat

Beitrag von feltel »

Bei uns "steuern" wir die Zertifikatsmigration mit dem ff. Code, den wir in unser Branding-Paket eingebaut haben. Deckt nicht alle Fälle ab, aber grundsätzlich hat die Migration von ca. 500 Maschinen damit geklappt. Manchmal sind die beiden Registrywerte auch zueinander widersprüchlich und/oder nicht vorhanden. In so einem Fall half eigentlich immer die Brutalmethode Inplace-Update laufen lassen.

Code: Alles auswählen

DefStringlist $UEFICA2023StatusList$
DefStringlist $UEFICA2023CapableList$
DefVar $UEFICA2023Status$
DefVar $UEFICA2023Capable$
DefVar $UEFICA2023StatusMsg$

set $UEFICA2023StatusList$ = PowershellCall('(Get-ItemProperty -ErrorAction SilentlyContinue -path "HKLM:\SYSTEM\CurrentControlSet\Control\Secureboot\Servicing" -name UEFICA2023Status).UEFICA2023Status|Out-String')
set $UEFICA2023Status$ = takestring (0, $UEFICA2023StatusList$)

set $UEFICA2023CapableList$ = PowershellCall('(Get-ItemProperty -ErrorAction SilentlyContinue -path "HKLM:\SYSTEM\CurrentControlSet\Control\Secureboot\Servicing" -name WindowsUEFICA2023Capable).WindowsUEFICA2023Capable|Out-String')
set $UEFICA2023Capable$ = takestring (0, $UEFICA2023CapableList$)


Switch $UEFICA2023Capable$

	Case "0"
		Comment "UEFICA2023-Migration noch nicht begonnen oder nicht kompatibel"
		Registry_Start_UEFICA2023_Migration /sysnative
		sleepSeconds 1
		PowershellCall('Start-ScheduledTask -TaskName "\Microsoft\Windows\PI\Secure-Boot-Update"')		
		set $UEFICA2023StatusMsg$ = "UEFICA2023-Migration begonnen"
	EndCase
	
	Case "1"
	
		If $UEFICA2023Status$ = "NotStarted"
	    Comment "UEFICA2023-Migration noch nicht begonnen"
		  Registry_Start_UEFICA2023_Migration /sysnative
		  sleepSeconds 1
		  PowershellCall('Start-ScheduledTask -TaskName "\Microsoft\Windows\PI\Secure-Boot-Update"')
		  set $UEFICA2023StatusMsg$ = "UEFICA2023-Migration begonnen"
		EndIf
		
		If $UEFICA2023Status$ = "InProgress"
		  Comment "UEFICA2023-Migration begonnen"
			PowershellCall('Start-ScheduledTask -TaskName "\Microsoft\Windows\PI\Secure-Boot-Update"')
			set $UEFICA2023StatusMsg$ = "UEFICA2023-Migration läuft"
		EndIf
		
		If $UEFICA2023Status$ = ""
	    Comment "UEFICA2023-Migration noch nicht begonnen"
		  Registry_Start_UEFICA2023_Migration /sysnative
		  sleepSeconds 1
		  PowershellCall('Start-ScheduledTask -TaskName "\Microsoft\Windows\PI\Secure-Boot-Update"')
		  set $UEFICA2023StatusMsg$ = "UEFICA2023-Migration begonnen"
		EndIf
		
	EndCase
	
	Case "2"
	
		If $UEFICA2023Status$ = ""
			Comment "UEFICA2023-Migration lt. Capable abgeschlossen, aber Status leer"
			Registry_Start_UEFICA2023_Migration /sysnative
		  sleepSeconds 1
		  PowershellCall('Start-ScheduledTask -TaskName "\Microsoft\Windows\PI\Secure-Boot-Update"')
			set $UEFICA2023StatusMsg$ = "UEFICA2023-Migration neu gestartet"
		EndIf
	
		If $UEFICA2023Status$ = "InProgress"
			Comment "UEFICA2023-Migration lt. Capable abgeschlossen, aber Status InProgress"
			Registry_Start_UEFICA2023_Migration /sysnative
		  sleepSeconds 1
		  PowershellCall('Start-ScheduledTask -TaskName "\Microsoft\Windows\PI\Secure-Boot-Update"')
			set $UEFICA2023StatusMsg$ = "UEFICA2023-Migration neu gestartet"
		EndIf
	
		If $UEFICA2023Status$ = "Updated"
			Comment "UEFICA2023-Migration beendet"
			set $UEFICA2023StatusMsg$ = "UEFICA2023-Migration beendet"
		EndIf
		
	EndCase
	
  DefaultCase

		Comment "Variable leer"
		set $UEFICA2023StatusMsg$ = "UEFICA2023 unbek. Zustand"
		
	EndCase

EndSwitch	


[Registry_Start_UEFICA2023_Migration]
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecureBoot]
set "AvailableUpdates" = REG_DWORD:22852

[OpsiServiceCall_write_HostFirmwareVersion]
"method": "setHostNotes"
"params": [
"%hostId%",
"$SysInfoFirmwareType$-Version: $SysInfoFirmwareVersion$ $SysInfoSecurebootStatus$ $UEFICA2023StatusMsg$"
]
Rzpertt
Beiträge: 149
Registriert: 15 Jan 2021, 10:41

Re: Secure Boot Zertifikat

Beitrag von Rzpertt »

Ich habe ein Microsoft Script so angepasst das ich damit den Status auslesen kann:

Dies ist der Inhalt der ps1 Datei

Code: Alles auswählen

#hostname
try {
    $hostname = $env:COMPUTERNAME
    if ([string]::IsNullOrEmpty($hostname)) {
        Write-Warning "Hostname could not be determined"
        $hostname = "Unknown"
    }
    Write-Host "Hostname: $hostname"
} catch {
    Write-Warning "Error retrieving hostname: $_"
    $hostname = "Error"
    Write-Host "Hostname: $hostname"
}
Write-Host "`r"
#modell
try {
    $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing\DeviceAttributes" -Name OEMModelNumber -ErrorAction Stop
    $oemModelNumber = $regValue.OEMModelNumber
    if ([string]::IsNullOrEmpty($oemModelNumber)) {
        Write-Warning "OEMModelNumber is empty"
        $oemModelNumber = "Unknown"
    }
    Write-Host "OEM Model Number: $oemModelNumber"
} catch {
    Write-Warning "OEMModelNumber registry key not found or inaccessible"
    $oemModelNumber = $null
    Write-Host "OEM Model Number: Not Available"
}
Write-Host "`r"
#bios
try {
    $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing\DeviceAttributes" -Name FirmwareVersion -ErrorAction Stop
    $firmwareVersion = $regValue.FirmwareVersion
    if ([string]::IsNullOrEmpty($firmwareVersion)) {
        Write-Warning "FirmwareVersion is empty"
        $firmwareVersion = "Unknown"
    }
    Write-Host "Firmware Version: $firmwareVersion"
} catch {
    Write-Warning "FirmwareVersion registry key not found or inaccessible"
    $firmwareVersion = $null
    Write-Host "Firmware Version: Not Available"
}
Write-Host "`r"
#secure boot
try {
    $secureBootEnabled = Confirm-SecureBootUEFI -ErrorAction Stop
    Write-Host "Secure Boot Enabled: $secureBootEnabled"
} catch {
    Write-Warning "Unable to determine Secure Boot status via cmdlet: $_"
    # Try registry fallback
    try {
        $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\State" -Name UEFISecureBootEnabled -ErrorAction Stop
        $secureBootEnabled = [bool]$regValue.UEFISecureBootEnabled
        Write-Host "Secure Boot Enabled: $secureBootEnabled"
    } catch {
        Write-Warning "Unable to determine Secure Boot status via registry. System may not support UEFI/Secure Boot."
        $secureBootEnabled = $null
        Write-Host "Secure Boot Enabled: Not Available"
    }
}
Write-Host "`r"
# 5. AvailableUpdates
# PS Version: All | Admin: May be required | System Requirements: None
try {
    $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot" -Name AvailableUpdates -ErrorAction Stop
    $availableUpdates = $regValue.AvailableUpdates
    if ($null -ne $availableUpdates) {
        # Convert to hexadecimal format
        $availableUpdatesHex = "0x{0:X}" -f $availableUpdates
        Write-Host "Available Updates: $availableUpdatesHex"
    } else {
        Write-Host "Available Updates: Not Available"
    }
} catch {
    Write-Warning "AvailableUpdates registry key not found or inaccessible"
    $availableUpdates = $null
    Write-Host "Available Updates: Not Available"
}
Write-Host "`r"
# 5b. AvailableUpdatesPolicy (GPO-controlled persistent value)
# PS Version: All | Admin: May be required | System Requirements: None
try {
    $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot" -Name AvailableUpdatesPolicy -ErrorAction Stop
    $availableUpdatesPolicy = $regValue.AvailableUpdatesPolicy
    if ($null -ne $availableUpdatesPolicy) {
        # Convert to hexadecimal format
        $availableUpdatesPolicyHex = "0x{0:X}" -f $availableUpdatesPolicy
        Write-Host "Available Updates Policy: $availableUpdatesPolicyHex"
    } else {
        Write-Host "Available Updates Policy: Not Set"
    }
} catch {
    # AvailableUpdatesPolicy is optional - only set when GPO is applied
    $availableUpdatesPolicy = $null
    Write-Host "Available Updates Policy: Not Set"
}
Write-Host "`r"
# Registry: Servicing Key (3 values)

# 6. UEFICA2023Status
# PS Version: All | Admin: May be required | System Requirements: None
try {
    $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing" -Name UEFICA2023Status -ErrorAction Stop
    $uefica2023Status = $regValue.UEFICA2023Status
    Write-Host "Windows UEFI CA 2023 Status: $uefica2023Status"
} catch {
    Write-Warning "Windows UEFI CA 2023 Status registry key not found or inaccessible"
    $uefica2023Status = $null
    Write-Host "Windows UEFI CA 2023 Status: Not Available"
}
Write-Host "`r"
# 7. UEFICA2023Error
# PS Version: All | Admin: May be required | System Requirements: None
try {
    $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing" -Name UEFICA2023Error -ErrorAction Stop
    $uefica2023Error = $regValue.UEFICA2023Error
    Write-Host "UEFI CA 2023 Error: $uefica2023Error"
} catch {
    # UEFICA2023Error only exists if there was an error - absence is good
    $uefica2023Error = $null
    Write-Host "UEFI CA 2023 Error: None"
}
Write-Host "`r"
#confidence
try {
    $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing" -Name ConfidenceLevel -ErrorAction Stop
    $ConfidenceLevel = $regValue.ConfidenceLevel
    Write-Host "ConfidenceLevel: $ConfidenceLevel"
} catch {
    # UEFICA2023Error only exists if there was an error - absence is good
    $ConfidenceLevel = $null
    Write-Host "ConfidenceLevel: None"
}
Write-Host "`r"
#capable
try {
    $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing" -Name WindowsUEFICA2023Capable -ErrorAction Stop
    $WindowsUEFICA2023Capable = $regValue.WindowsUEFICA2023Capable
    Write-Host "WindowsUEFICA2023Capable: $WindowsUEFICA2023Capable"
} catch {
    # UEFICA2023Error only exists if there was an error - absence is good
    $WindowsUEFICA2023Capable = $null
    Write-Host "WindowsUEFICA2023Capable: None"
}
Um das in das Notizenfeld zu schreiben habe ich das hier gebaut:

Code: Alles auswählen


DefStringList $s2023Update$
DefVar $2023Update$

Set $s2023Update$ = powershellCall ('p:\zertcheck\updates.ps1')
Set $2023Update$ = composeString ($s2023Update$, " \n ")

comment "%HostID%"
comment "Inhalt der Liste:" + $2023Update$

opsiServiceCall_set_client_notes

[opsiServiceCall_set_client_notes]
"method": "host_updateObject"
"params":[ 
	{"id": "%HostID%", "notes": "$2023Update$"} 
	]
[/code]
Antworten