Zu den Hauptinhalten
  • Bestellungen schnell und einfach aufgeben
  • Bestellungen anzeigen und den Versandstatus verfolgen
  • Profitieren Sie von exklusiven Prämien und Rabatten für Mitglieder
  • Erstellen Sie eine Liste Ihrer Produkte, auf die Sie jederzeit zugreifen können.

Data Protection Advisor:手动修复 Apache Log4j 漏洞 Windows PowerShell 脚本(CVE-2021-44228、CVE-2021-45046)

Zusammenfassung: 本文提供有关手动修复在受 Apache Log4j 漏洞(CVE-2021-44228 和 CVE-2021-45046)影响的 Microsoft Windows 节点上运行的 DPA 代理程序的说明。

Dieser Artikel gilt für Dieser Artikel gilt nicht für Dieser Artikel ist nicht an ein bestimmtes Produkt gebunden. In diesem Artikel werden nicht alle Produktversionen aufgeführt.

Weisungen

此修复方法涉及使用利用本机 Windows 脚本编制命令的 Windows PowerShell 脚本。

这些说明可以应用于任何类型的 Windows DPA 安装,包括 DPA 应用程序、DPA 数据存储和独立 DPA 代理程序(单独安装在服务器或另一种类型的应用程序服务器上)。

有关 Apache Log4j 漏洞的详细信息,请参阅以下戴尔安全公告:

关于这些说明,如有疑问或者需要帮助,请联系戴尔技术支持。

手动修复的步骤:

提醒:

  • 这些说明要求 Windows 安装已安装 PowerShell 并且它可用(默认)。
  • 需要 Windows 管理员权限和访问权限。

 

  1. 下载此知识库文章所附的文本文件 log4j_jndiremoval.txt。

提醒:或者,这些说明末尾提供了 log4j_jndiremoval.txt 文件的完整文本,可以复制并粘贴到文本文件中。

  1. 将文本文件复制或移动到受影响的 Windows 节点。
  2. 重命名文本文件并将文件扩展名从 .txt 更改为 .ps1。提醒:在重命名文件之前,您可能需要单击 Windows 资源管理器文件夹选项“查看”,然后选中显示“文件扩展名”的复选框。
  3. 打开 Windows PowerShell 窗口。在菜单中单击“搜索”,然后键入 PowerShell。此时应该会显示“Windows PowerShell”。右键单击 Windows PowerShell 并选择“以管理员身份运行”。

pic_01.JPG

 

  1. 停止 DPA 代理程序服务。通过使用 Windows 服务管理单元或使用 Windows PowerShell 从命令行执行此操作。

在 Windows PowerShell 窗口中,如果是 DPA 应用程序或 DPA 数据存储上的代理程序安装,则运行命令:

dpa agent stop

在 Windows PowerShell 窗口中,如果是独立 DPA 代理程序安装,则运行命令:

\dpa stop

示例:   
C:\Program Files\EMC\DPA\agent\etc\dpa stop

  1. 在 Windows PowerShell 窗口中,将目录更改为脚本文件的目录。

pic_03.JPG

 

  1. 使用“verify”选项在 PowerShell 窗口中运行脚本,这会扫描并验证受影响的文件。命令为:    
.\log4j_jndiremoval.ps1 -verify

pic_04.JPG

  1. 按 Enter 键后,脚本将运行,然后提示输入 DPA 安装的路径。输入 DPA 安装的完整路径。

pic_06.JPG

 

  1. 按 Enter 键后,脚本将运行并标识任何易受攻击的文件。

pic_07.JPG

 

  1. 在 PowerShell 窗口中再次运行脚本并省略“Verify”选项。在此模式下,脚本将扫描并修复任何受影响的文件。命令为:   
.\log4j_jndiremoval.ps1

提醒:必须再次输入 DPA 安装路径。

pic_09.JPG

 

  1. 按 Enter 键后,脚本会扫描并修复找到的任何易受攻击的文件。

pic_10.JPG

 

  1. 至此,修复已完成。
  2. 作为可选步骤,再次运行脚本来重新检查。使用“Verify”选项在 PowerShell 窗口中运行脚本,这会扫描并验证受影响的文件。命令为:
.\log4j_jndiremoval.ps1 -verify

pic_14.JPG

 

  1. 启动 DPA 代理程序服务。可以使用 Windows 服务管理单元或使用 Windows PowerShell 从命令行执行此操作。

在 Windows PowerShell 窗口中,如果是 DPA 应用程序或 DPA 数据存储上的代理程序安装,则运行命令:

dpa agent start

在 Windows PowerShell 窗口中,如果是独立 DPA 代理程序安装,则运行命令:

\dpa start

示例:   
C:\Program Files\EMC\DPA\agent\etc\dpa start

 

附录:
下面是 PowerShell 脚本的完整文本。如果无法访问此知识库文章所附的文件,则可以将此文本原样复制并粘贴到文本文件 (.txt) 中,以便在上述步骤中使用。

param ( [switch]$verify ) '--------------------------------------------------------------------------' '--------------------------------------------------------------------------' ' Data Protection Advisor CVE-2021-44228, CVE-2021-45046 Patcher 1.1 ' ' Developer : Pankaj Pande(p.pande@dell.com) ' ' Release : 29 Dec 2021 ' '--------------------------------------------------------------------------' 'Welcome to CVE-2021-44228, CVE-2021-45046 Patching Tool.' 'This utility will assist you in patching Data Protection Advisor for CVE-2021-44228 and CVE-2021-45046 on a Windows system.' "Special Note : The tool automates remediation steps for all internal components. Following remediation, validation checks are also run. While this tool remediates these vulnerabilities, all available information from Apache on log4j continues to be monitored. If new CVEs are discovered, Dell Technologies' Engineering teams will clarify impact and new remediation steps where necessary. If needed this tool will be updated to include the new remediation steps." '---------------------------------------------------------------------------' function List-JndiLookup { Param ( [string[]]$JarFiles, [string] $FilenameToRemove ) #initiate the .net namespace add-type -AssemblyName 'System.IO.Compression.filesystem' "The number of files to be processed is : $($JarFiles.Count)" #list the files we are processing # them later foreach ($JarFile in $JarFiles) { "$JarFile" } $processedFiles = 0; $skippedFiles = 0; foreach ($JarFile in $JarFiles) { # Open the jar for updating (.jar files are just .zip files) try { $ProcessJarFile = [io.compression.zipfile]::Open($JarFile,'Update') } catch { # Error Handling } "Checking $JarFile for $FilenameToRemove" $totalFilesInJar = ($ProcessJarFile.Entries | Where FullName -Match $FilenameToRemove).Count if($totalFilesInJar -gt 0){ $processedFiles++ } #close Zip try { $ProcessJarFile.Dispose() } catch { # Error Handling } } if ( $processedFiles -gt 0) { Write-Host "$processedFiles file(s) found vulnerable" -fore red Write-Host "Finished...Please make sure to run the patching on this sytem" -fore red } else { Write-Host "$processedFiles file(s) found vulnerable" -fore green Write-Host "Finished...No Action needed" -fore green } } function Remove-JndiLookup { Param ( [string[]]$JarFiles, [string] $FilenameToRemove ) #initiate the .net namespace add-type -AssemblyName 'System.IO.Compression.filesystem' "The number of files to be processed is : $($JarFiles.Count)" #list the files we are processing # them later foreach ($JarFile in $JarFiles) { "$JarFile" } "Starting patching/Removel Process" $processedFiles = 0; $skippedFiles = 0; foreach ($JarFile in $JarFiles) { # Open the jar for updating (.jar files are just .zip files) try { $ProcessJarFile = [io.compression.zipfile]::Open($JarFile,'Update') } catch { # Error Handling } "Checking $JarFile for $FilenameToRemove" $totalFilesInJar = ($ProcessJarFile.Entries | Where FullName -Match $FilenameToRemove).Count if($totalFilesInJar -gt 0){ "Deleting unwanted file $FilenameToRemove from $JarFile" ($ProcessJarFile.Entries | Where FullName -Match $FilenameToRemove).Delete() $processedFiles++ } else { "File $FilenameToRemove not found inside $JarFile, this may have already been deleted." $skippedFiles++ } # Clean up / close the zip try { $ProcessJarFile.Dispose() } catch { # Error Handling } } "$processedFiles file(s) processed`n$skippedFiles file(s) skipped" Write-Host "Finished..." -fore green } if ( $verify ) { Write-Host "Running in dry-run mode. Will not process any files" -fore green } else { Write-Host "Running in fix mode. Will patch files that are found affected" -fore red } $dpa_path = Read-Host "Enter the DPA location " Write-Host "Running in : '$dpa_path' " -fore green if ($verify) { List-JndiLookup -JarFiles (Get-ChildItem -Exclude 'tmp' -Recurse -Path "$dpa_path" -Filter 'dpa*.jar' | ? { $_.FullName -inotmatch 'tmp' }).FullName -FilenameToRemove 'JndiLookup.class' } else { Remove-JndiLookup -JarFiles (Get-ChildItem -Exclude 'tmp' -Recurse -Path "$dpa_path" -Filter 'dpa*.jar' | ? { $_.FullName -inotmatch 'tmp' }).FullName -FilenameToRemove 'JndiLookup.class' }

 



关于这些说明,如有疑问或者需要帮助,请联系戴尔技术支持。

Artikeleigenschaften
Artikelnummer: 000194869
Artikeltyp: How To
Zuletzt geändert: 18 Aug. 2022
Version:  4
Antworten auf Ihre Fragen erhalten Sie von anderen Dell NutzerInnen
Support Services
Prüfen Sie, ob Ihr Gerät durch Support Services abgedeckt ist.