APIを使用して、 Workload Security が保護しているコンピュータのセキュリティステータスに関する情報を収集します。たとえば、セキュリティステータスの月次レポートを作成するには、セキュリティモジュールの実行ステータスの有効/無効
(最新ルールの割り当て有無など) に関する情報を収集します。
また、特定の脅威から保護されているかどうかを確認することもできます。たとえば、 a zeri-dayの脆弱性に対するCVEがリリースされた場合、そのCVEの侵入防御ルールを見つけてコンピュータに適用できます。
保護されていないコンピュータを検出する
エージェントまたはアプライアンスのリアルタイムステータスまたは保護モジュールのステータスに基づいて保護されていないコンピュータを検出します。
- コンピュータにエージェントまたはApplianceがインストールされていないか、エージェントまたはApplianceがアクティブではありません。
- 保護モジュールがオンになっていないか、オンになっていてアクティブではありません。
仮想マシンの場合は、コンピュータの状態やその他の情報も取得できます。この情報はトラブルシューティングに役立ちます。
コンピュータのステータスに関する背景情報については、コンピュータとエージェントのステータスを参照してください
エージェントのステータスに基づいてコンピュータを検索する
エージェントがインストールされていないコンピュータは、 Workload Securityによって保護されません。問題は、彼らのエージェントまたはアプライアンスに存在する場合にコンピュータはまた、保護されていない可能性があります。
エージェントまたはアプライアンスがインストールされているかどうかを判断するには、エージェントおよびアプライアンスのフィンガープリントを確認します。フィンガープリントがない場合、エージェントまたはアプライアンスがインストールされておらず、したがってコンピュータが保護されていないことを示します。エージェントまたはアプライアンスがインストールされている場合は、そのステータスも確認してください。たとえば、
activeのステータスは、エージェントまたはアプライアンスが正常に動作していることを示します。errorやinactiveなどの他のステータスは、調査が必要な問題を示します。次の例のJSONはコンピュータオブジェクトのデータ構造を表しています (一部の項目は例を簡潔にするために省略されています)。
agentFingerPrintはエージェントがインストールされていることを示し、computerStatusはそれがアクティブであることを示しています。{
"hostName": "laptop_adaggs",
...
"policyID": 34,
"agentFingerPrint": "71:3E:81:64:65:EB:34:78:FC:72:C2:CB:37:6B:1D:F0:8C:D1:9B:1E",
"agentVersion": "11.3.2.883",
"computerStatus": {
"agentStatus": "active",
"agentStatusMessages": [
"Managed (Online)"
]
},
"computerSettings": {...},
"ID": 48,
"antiMalware": {...},
...
}
オフラインステータスは、Workload Securityがコンピュータと通信できないことを示している可能性があります。このステータスでは、エージェントまたはアプライアンスは正常に動作し、保護を提供している可能性があります。ただし、Workload
Securityはエージェントまたはアプライアンスにセキュリティアップデートを送信できません。保護されていないコンピュータを検出するには、次の一般的な手順を実行します。
ComputersApiを使用してコンピュータオブジェクトを取得します。- コンピュータの
AgentFingerPrintプロパティとApplianceFingerPrintプロパティを確認してください。 ComputerオブジェクトからComputerStatusオブジェクトを取得し、AgentStatusプロパティを確認します。ACTIVE以外の値は問題を示している可能性があります。- オプションとして、有用な情報を得るために
ComputerStatusオブジェクトのAgentStatusMessagesとComputerオブジェクトのAgentTasksプロパティを取得します。
コンピュータの
computerStatusフィールドの値はオブジェクト (ComputerStatus) であるため、このフィールドを検索することはできません。すべてのコンピュータのステータスを確認するには、まず
ComputersApiクラスを使用してすべてのコンピュータをリストします。computers_api = api.ComputersApi(api.ApiClient(configuration)) computers = computers_api.list_computers(api_version, expand=expand.list(), overrides=False)
コンピュータごとに、エージェントおよびアプライアンスのフィンガープリントを確認します。指紋がない場合は、エージェントまたはアプライアンスがインストールされておらず、コンピュータが保護されていないことを示します。コンピュータには、エージェントとアプライアンスの両方をインストールできます。両方の指紋の値を確認する必要があります。
if computer.agent_finger_print == None and computer.appliance_finger_print == None:
指紋が見つかった場合は、エージェントまたはアプライアンスのステータスを取得して、アクティブであるかどうかを判断します。アクティブ以外のステータスの場合、エージェントまたはアプライアンスに問題がある可能性があります。
agent_status = computer.computer_status.agent_status
if computer.agent_finger_print != None and agent_status != "active":
...
appliance_status = computer.computer_status.appliance_status
if computer.appliance_finger_print != None and appliance_status != "active":
...
ステータスがアクティブでない場合は、エージェントまたはApplianceのステータスメッセージとタスクを取得します。次の例は、エージェントの情報を取得する方法を示しています。
if computer.computer_status.agent_status_messages != None:
computer_info.append(str(computer.computer_status.agent_status_messages))
else:
computer_info.append("")
if computer.tasks != None:
computer_info.append(str(computer.tasks.agent_tasks))
else:
computer_info.append("")
次の例では、エージェントまたはアプライアンスがインストールされていないコンピュータ、またはエージェントおよび/またはアプライアンスのステータスがアクティブでないコンピュータを見つけます。完全なソースコードサンプルでは、結果がCSVファイルとして保存され、スプレッドシートとして開くことができる形式でコンパイルされます。
# Include computer status information in the returned Computer objects
expand = api.Expand(api.Expand.computer_status)
# Get all computers
computers_api = api.ComputersApi(api.ApiClient(configuration))
computers = computers_api.list_computers(api_version, expand=expand.list(), overrides=False)
for computer in computers.computers:
computer_info = []
# Report on computers with no agent or appliance
if computer.agent_finger_print is None and computer.appliance_finger_print is None:
# Hostname and protection type
computer_info.append(computer.host_name)
computer_info.append("None")
# Agent/appliance status and status messages
computer_info.append("No agent/appliance")
status_messages = ""
if computer.computer_status is not None and computer.computer_status.agent_status is not None:
status_messages = str(computer.computer_status.agent_status_messages)
computer_info.append(status_messages)
else:
# Report on problem agents and appliances
agent_status = computer.computer_status.agent_status
appliance_status = computer.computer_status.appliance_status
# Agent is installed but is not active
if computer.agent_finger_print is not None and agent_status != "active":
# Hostname and protection type
computer_info.append(computer.host_name)
computer_info.append("Agent")
# Agent status, status messages, and tasks
if computer.computer_status.agent_status is not None:
computer_info.append(computer.computer_status.agent_status)
else:
computer_info.append("")
if computer.computer_status.agent_status_messages is not None:
computer_info.append(str(computer.computer_status.agent_status_messages))
else:
computer_info.append("")
if computer.tasks is not None:
computer_info.append(str(computer.tasks.agent_tasks))
else:
computer_info.append("")
# Appliance is installed but is not active
if computer.appliance_finger_print is not None and appliance_status != "active":
# Hostname and protection type
computer_info.append(computer.host_name)
computer_info.append("Appliance")
# Appliance status, status messages, and tasks
if computer.computer_status.appliance_status is not None:
computer_info.append(computer.computer_status.appliance_status)
else:
computer_info.append("")
if computer.computer_status.appliance_status_messages is not None:
computer_info.append(str(computer.computer_status.appliance_status_messages))
else:
computer_info.append("")
if computer.tasks is not None:
computer_info.append(str(computer.tasks.appliance_tasks))
else:
computer_info.append("")
モジュールのステータスに基づいてコンピュータを検索する
保護モジュールがオフになっているか、問題が発生してエージェントまたはアプライアンスがモジュールを正しく実行できない場合、コンピュータは脆弱になります。コンピュータが保護モジュールによって保護されているかどうかを確認するには、モジュールの状態
(オンまたはオフ) を確認します。状態がオンの場合、エージェントおよび/またはアプライアンスがモジュールを実行できるかどうかを示すモジュールのステータスも確認します。
active以外のステータスは、注意が必要な問題を示している可能性があります。また、ステータスに関する洞察を提供するステータスメッセージを取得することもできます。次の例のJSONは、コンピュータオブジェクトのデータ構造を表しています (例を簡潔にするためにいくつかの項目は省略されています)。不正プログラム対策モジュールは
オンですが、モジュールのエージェントステータスは警告を示しています。{
"hostName": "192.168.60.128",
...
"policyID": 9,
"agentFingerPrint": "76:C8:CE:B3:70:61:A3:BE:84:A2:2A:5D:1F:3A:29:8A:DC:7A:70:6C",
"agentVersion": "11.2.0.147",
"computerStatus": {...},
"computerSettings": {...},
...
"ID": 2,
"antiMalware": {
"state": "on",
"moduleStatus": {
"agentStatus": "warning",
"agentStatusMessage": "Software Update: Anti-Malware Module Installation Failed"
},
"realTimeScanConfigurationID": 1,
"realTimeScanScheduleID": 4,
"manualScanConfigurationID": 2,
"scheduledScanConfigurationID": 3
},
"webReputation": {...},
"firewall": {...},
"intrusionPrevention": {...},
"integrityMonitoring": {...},
"logInspection": {...},
"applicationControl": {...}
}
次の一般的な手順を使用して、モジュールのステータスを使用して保護されていないコンピュータを検出します。
ComputersApiを使用してComputerオブジェクトを取得します。- 興味のある保護モジュールのコンピュータ拡張オブジェクトを取得します。例えば、
AntiMalwareComputerExtensionやIntrusonPreventionComputerExtensionなどです。 - コンピュータの拡張子オブジェクトから、モジュールの状態の値を取得して、モジュールがオンかオフかを確認します。
- また、コンピュータ拡張オブジェクトから
ModuleStatusオブジェクトを取得し、エージェントおよびアプライアンスのステータスとステータスメッセージを取得します。
コンピュータ拡張機能の
moduleStatusフィールドの値はオブジェクト (ModuleStatus) であるため、このフィールドを検索することはできません。すべてのコンピュータのモジュールステータスを確認するには、まず
ComputersApiクラスを使用してすべてのコンピュータをリストします。computers_api = api.ComputersApi(api.ApiClient(configuration)) computers = computers_api.list_computers(api_version, expand=expand.list(), overrides=False)
コンピュータごとに、対象の保護モジュールのエージェントのステータスを取得します。モジュールのステータスを取得し、エージェントまたはアプライアンスのステータスを確認します。アクティブ以外のステータスの場合、エージェントまたはアプライアンスに問題がある可能性があります。エージェントがインストールされていない場合、エージェントのステータスは表示されません。同様に、アプライアンスがインストールされていない場合、アプライアンスのステータスはありません。
if computer.anti_malware.module_status:
agent_status = computer.anti_malware.module_status.agent_status
appliance_status = computer.anti_malware.module_status.appliance_status
else:
agent_status = None
appliance_status = None
if agent_status and agent_status != "active":
...
if appliance_status and appliance_status != "active":
...
非アクティブなステータスの場合は、モジュールのエージェントまたはアプライアンスのステータスメッセージを取得します。
module_info.append(computer.anti_malware.module_status.agent_status_message) module_info.append(computer.anti_malware.module_status.appliance_status_message)
次の例では、不正プログラム対策モジュールが無効になっているコンピュータ、またはモジュールのステータスがアクティブでないコンピュータを見つけます。完全なソースコードサンプルでは、結果がCSVファイルとして保存され、スプレッドシートとして開くことができる形式で返されます。
computers_api = api.ComputersApi(api.ApiClient(configuration))
computers = computers_api.list_computers(api_version, expand=expand.list(), overrides=False)
# Get the list of computers and iterate over it
for computer in computers.computers:
# Module information to add to the CSV string
module_info = []
# Check that the computer has a an agent or appliance status
if computer.anti_malware.module_status:
agent_status = computer.anti_malware.module_status.agent_status
appliance_status = computer.anti_malware.module_status.appliance_status
else:
agent_status = None
appliance_status = None
# Agents that are not active for the module
if agent_status and agent_status != "active":
# Host name
module_info.append(computer.host_name)
# Module state
module_info.append(computer.anti_malware.state)
# Agent status and status message
module_info.append("Agent")
module_info.append(agent_status)
module_info.append(computer.anti_malware.module_status.agent_status_message)
# Appliances that are not active for the module
if appliance_status and appliance_status != "active":
# Host name
module_info.append(computer.host_name)
# Module state
module_info.append(computer.anti_malware.state)
# Appliance status and status message
module_info.append("Appliance")
module_info.append(appliance_status)
module_info.append(computer.anti_malware.module_status.appliance_status_message)
仮想マシンの状態を表示する
コンピュータが仮想マシンである場合、仮想マシンの状態 (仮想マシンベンダーによって定義される) を含むいくつかのプロパティを取得できます。
Computerクラスは、azureARMVirtualMachineSummary、ec2VirtualMachineSummary、vmwareVMVirtualMachineSummaryなど、いくつかの仮想マシン要約オブジェクトへのアクセスを提供します。完全なリストについては、APIレファレンスを参照してください。コンピュータの仮想マシンの概要を取得し、仮想マシンのプロパティ(状態など)を確認するために使用できます。
コンピュータの構成を取得する
コンピュータオブジェクトにはコンピュータの構成情報が含まれています。コンピュータオブジェクトを取得するには、ComputersApiオブジェクトを作成し、IDで特定のコンピュータを取得するか、他のプロパティで検索するか、すべてのコンピュータをリストしてそれらを反復処理します。
ヒントコンピュータを取得する際には、すべてのプロパティを含めるか、そのコンピュータに設定されているオーバーライドのみを含めるかを指定します。
|
コンピュータの現在の構成にアクセスするには、
Computerオブジェクトを使用して保護モジュールのコンピュータ拡張オブジェクトを取得します。例えば、コンピュータの不正プログラム対策の構成や状態に関する情報を取得するには、AntiMalwareComputerExtensionオブジェクトを取得します。必要なコンピュータ情報のみを取得するには、expandパラメータを使用します。# Include Anti-Malware information in the returned Computer object expand = api.Expand(api.Expand.anti_malware, api.Expand.computer_settings) # Get the computer object from Workload Security computers_api = api.ComputersApi(api.ApiClient(configuration)) computer = computers_api.describe_computer(computer_id, api_version, expand=expand.list(), overrides=False) # Get the Anti-Malware scan configuration id for the computer real_time_scan_configuration_id = computer.anti_malware.real_time_scan_configuration_id # Get the Anti-Malware properties for the computer am_configs_api = api.AntiMalwareConfigurationsApi(api.ApiClient(configuration)) return am_configs_api.describe_anti_malware(real_time_scan_configuration_id, api_version)
コンピュータの不正プログラム対策の構成を検出する
AntiMalwareComputerExtensionオブジェクトは、コンピュータの不正プログラム対策構成の次の項目へのアクセスを提供します。- 不正プログラム対策 モジュールの実行状態(オンまたはオフ)
- 不正プログラム検索設定
次の一般的な手順を使用して、お使いのコンピュータの不正プログラム対策の設定を取得してください。
ComputersApiオブジェクトを使用してコンピュータオブジェクトを取得します。Computerオブジェクトを使用してAntiMalwareComputerExtensionオブジェクトを取得します。- 不正プログラム対策 モジュールの状態を取得します。
- 検索設定を取得します。
次の例では、コンピュータの不正プログラム対策設定の特定のプロパティを取得します。
# Get the anti-malware scan configuration id for the computer real_time_scan_configuration_id = computer.anti_malware.real_time_scan_configuration_id # Get the anti-malware properties for the computer am_configs_api = api.AntiMalwareConfigurationsApi(api.ApiClient(configuration)) return am_configs_api.describe_anti_malware(real_time_scan_configuration_id, api_version)
侵入防御ルールの適用
コンピュータに適用する侵入防御ルールを決定して、必要な保護が確実に適用されるようにします。
ComputersApiオブジェクトを使用してコンピュータオブジェクトを取得します。- 各
コンピュータオブジェクトについて、IntrusionPreventionComputerExtensionオブジェクトを取得します。 - 侵入防御 ルールのリストを取得します。
以下の例では、コンピューターに適用されるIPSルールを取得します。
# Extract intrusion prevention rules from the computers
im_rules = {}
for computer in computers_list.computers:
im_rules[computer.host_name] = computer.intrusion_prevention.rule_ids
return im_rules
また、APIレファレンスのコンピュータ一覧、コンピュータの説明、コンピュータ検索操作を参照してください。API呼び出しの認証に関する情報については、Workload Securityで認証するを参照してください。
