使用 Amazon Inspector 掃描WindowsEC2實 - Amazon Inspector

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用 Amazon Inspector 掃描WindowsEC2實

Amazon Inspector 會自動探索所有受支援的Windows執行個體,並將它們包含在連續掃描中,無需執行任何 如需支援哪些執行個體的詳細資訊,請參閱 Amazon Inspector 支援的作業系統和程式設計語言。Amazon Inspector 會定期執行Windows掃描。 Windows在探索時掃描執行個體,然後每 6 小時掃描一次。但是,您可以在第一次掃描後調整預設掃描間隔

啟動亞馬遜EC2掃描後,Amazon Inspector SSM 會為您的Windows資源建立下列關聯:InspectorDistributor-do-not-deleteInspectorInventoryCollection-do-not-delete、和InvokeInspectorSsmPlugin-do-not-delete。若要在Windows執行個體上安裝 Amazon Inspector SSM 外掛程式,該InspectorDistributor-do-not-deleteSSM協會使用AWS-ConfigureAWSPackageSSM文件AmazonInspector2-InspectorSsmPluginSSM代理商套件。如需詳細資訊,請參閱關於 Amazon Inspector SSM 插件 Windows。為了收集執行個體資料並產生 Amazon Inspector 發現項目,該InvokeInspectorSsmPlugin-do-not-deleteSSM關聯會每隔 6 小時執行一次 Amazon Inspector SSM 外掛程式。但是,您可以使用 cron 或速率運算式自訂此設定

注意

Amazon Inspector 將更新的開放漏洞和評估語言 (OVAL) 定義檔案暫存至 S3 儲存貯體inspector2-oval-prod-your-AWS-Region。Amazon S3 儲存貯體包含掃描中使用的OVAL定義。這些OVAL定義不應該被修改。否則,Amazon Inspector 在發布CVEs時不會掃描新的。

Windows執行個體的 Amazon Inspector 掃描

若要掃描Windows執行個體,Amazon Inspector 要求執行個體必須符合下列條件:

  • 執行個體是SSM代管執行個體。如需設定執行個體進行掃描的指示,請參閱設定SSM代理程式

  • 執行個體作業系統是支援的Windows作業系統之一。如需支援作業系統的完整清單,請參閱支援 Amazon EC2 掃描的作業系統

  • 執行個體已安裝 Amazon Inspector SSM 外掛程式。Amazon Inspector 會在探索時自動為受管執行個體安裝 Amazon Inspector SSM 外掛程式。有關插件的詳細信息,請參見下一個主題。

注意

如果您的主機在VPC沒有外送網際網路存取權的 Amazon 中執行,則Windows掃描需要您的主機才能存取區域性 Amazon S3 端點。若要了解如何設定 Amazon S3 Amazon VPC 端點,請參閱 Amazon 虛擬私有雲端使用者指南中的建立閘道端點。如果您的 Amazon VPC 端點政策限制了對外部 S3 儲存貯體的存取,您必須特別允許存取 Amazon Inspector 所維護的儲存貯體, AWS 區域 該儲存貯體存放用於評估執行個體的OVAL定義。此值區的格式如下:inspector2-oval-prod-REGION

關於 Amazon Inspector SSM 插件 Windows

Amazon Inspector SSM 插件需要 Amazon Inspector 掃描您的Windows實例。Amazon Inspector SSM 外掛程式會自動安裝在您的執行Windows個體上C:\Program Files\Amazon\Inspector,而可執行的二進位檔案會命名為InspectorSsmPlugin.exe

系統會建立下列檔案位置來儲存 Amazon Inspector SSM 外掛程式收集的資料:

  • C:\ProgramData\Amazon\Inspector\Input

  • C:\ProgramData\Amazon\Inspector\Output

  • C:\ProgramData\Amazon\Inspector\Logs

默認情況下,Amazon Inspector SSM 插件以低於正常優先級運行。

注意

您可以使用「預設主機管理組態」設定來掃描Windows執行個體。不過,您必須建立執行個體設定檔並附加ssm:PutInventory權限。

卸載 Amazon Inspector SSM 插件

如果無意中刪除InspectorSsmPlugin.exe檔案,InspectorDistributor-do-not-deleteSSM關聯會會在下次Windows掃描間隔時重新安裝外掛程式。如果您想要解除安裝 Amazon Inspector SSM 外掛程式,可以在AmazonInspector2-ConfigureInspectorSsmPlugin文件上使用「解除安裝」動作。

此外,如果您停用 Amazon EC2 掃描,Amazon Inspector 外SSM掛程式將自動從所有Windows主機解除安裝。

注意

如果您在停用 Amazon Inspector 之前解除安裝SSM代理程式,Amazon Inspector SSM 外掛程式將保留在Windows主機上,但不會再將資料傳送到 Amazon Inspector SSM 外掛程式。如需詳細資訊,請參閱停用 Amazon Inspector

設定Windows執行個體掃描的自訂排程

您可以使SSM用設定InvokeInspectorSsmPlugin-do-not-delete關聯的 cron 運算式或費率運算式,自訂 Windows Amazon EC2 執行個體掃描之間的時間。如需詳細資訊,請參閱使用指南中的參考:Systems Manager 的 Cron 和速率運算式,或使用下列示。AWS Systems Manager

從下列程式碼範例中選取,以使用速率運算式或 cron 運算式,將Windows執行個體的掃描頻率從預設 6 小時變更為 12 小時。

下列範例會要求您使用名AssociationId為的關聯InvokeInspectorSsmPlugin-do-not-delete。您可以AssociationId通過運行以下 AWS CLI 命令來檢索您的:

$ aws ssm list-associations --association-filter-list "key=AssociationName,value=InvokeInspectorSsmPlugin-do-not-delete" --region us-east-1
注意

AssociationId是地區,因此您必須先擷取每個 ID 的唯一 ID AWS 區域。然後,您可以執行指令來變更要為執行個Windows體設定自訂掃描排程的每個區域中的掃描頻率。

Example rate expression
$ aws ssm update-association \ --association-id "YourAssociationId" \ --association-name "InvokeInspectorSsmPlugin-do-not-delete" \ --schedule-expression "rate(12 hours)"
Example cron expression
$ aws ssm update-association \ --association-id "YourAssociationId" \ --association-name "InvokeInspectorSsmPlugin-do-not-delete" \ --schedule-expression "cron(0 0/12 * * ? *)"