推奨スキャンは、IPS変更監視、およびログ検査のルールを特定し、コンピュータまたはポリシーに割り当てるか削除するかを判断します。アプリケーションプログラミングインターフェース (API) は、コンピュータおよびポリシーレベルでこれらの保護モジュールの推奨スキャン結果にアクセスするための以下のクラスを提供します:
  • ComputerIntrusionPreventionAssignmentsRecommendationsApi
  • ComputerIntegrityMonitoringAssignmentsRecommendationsApi
  • ComputerLogInspectionAssignmentsRecommendationsApi
  • PolicyIntrusionPreventionAssignmentsRecommendationsApi
  • PolicyIntegrityMonitoringAssignmentsRecommendationsApi
  • PolicyLogInspectionAssignmentsRecommendationsApi
これらのクラスのメソッドと関数は、最新の推奨事項と検索情報を含むオブジェクトを返します。次のJSONは、返されるオブジェクトのデータ構造を表します。
{
    "assignedRuleIDs": [],
    "recommendationScanStatus": "valid",
    "lastRecommendationScanDate": "1562702362438",
    "recommendedToAssignRuleIDs": [],
    "recommendedToUnassignRuleIDs": []
}
強化された推奨スキャンを実行すると、次のAPIクラスはrecommendedToAssignRuleIDsおよびrecommendedToUnassignRuleIDsに対して空の値を返します:
  • PolicyIntrusionPreventionAssignmentsRecommendationsApi
  • PolicyIntegrityMonitoringAssignmentsRecommendationsApi
  • PolicyLogInspectionAssignmentsRecommendationsApi
推奨設定の検索を実行すると、侵入防御、変更監視、およびセキュリティログ監視の各セキュリティモジュールの推奨設定が決定されます。したがって、ComputerIntrusionPreventionAssignmentsRecommendationsApi ,ComputerIntegrityMonitoringAssignmentsRecommendationsApi 、およびComputerLogInspectionAssignmentsRecommendationsApi前回の検索の日付とステータスに同じ値を返します。
たとえば、環境内のすべてのコンピュータのリストを取得します (必要なのはIDのみであるため、expandパラメータnone最小限の情報を返す場合):
expand = api.Expand(api.Expand.none)
computers_api = api.ComputersApi(api.ApiClient(configuration))
computers = computers_api.list_computers(api_version, expand=expand.list(), overrides=False)
コンピュータごとに、適用されたルールと推奨設定の検索結果を取得します。
computer_ips_assignments_recommendations_api = (
    api.ComputerIntrusionPreventionRuleAssignmentsRecommendationsApi(api.ApiClient(configuration)))
intrusion_prevention_assignments = (
    computer_ips_assignments_recommendations_api.list_intrusion_prevention_rule_ids_on_computer(
        computer.id,
        api_version,
        overrides=False)
最後に、前回の検索の日付を抽出します。推奨設定の検索が実行されていない場合、プロパティはNone:
reco_scan_info = list()
if intrusion_prevention_assignments.last_recommendation_scan_date is not None:
    d = datetime.datetime.utcfromtimestamp(intrusion_prevention_assignments.last_recommendation_scan_date/1000)
    reco_scan_info.append(d.strftime('%Y-%m-%d %H:%M:%S'))
else:
    reco_scan_info.append("No scan on record")
APIを使用して推奨スキャンを実行するには、スケジュールされたタスクを使用します。また、APIレファレンスのIPSルールIDの一覧操作も参照してください。

推奨スキャンが最後に実行された日時を確認する 親トピック

最後の推奨スキャンの日付を取得して、コンピュータが最近スキャンされたかどうかを確認します。例えば、推奨スキャンが実行されるときにオフラインの場合、コンピュータがスキャンされないことがあります。各コンピュータで最後にスキャンが実行された時期を確認するスクリプトを実行できます。結果に応じて、すぐに推奨スキャンを実行することができます。
次の一般的な手順を使用して、1台以上のコンピュータで最後に推奨ファイルを検索した日付を取得します。

手順

  1. チェックするコンピュータのIDを取得するためにComputersApiオブジェクトを作成します。
  2. 作成するComputerIntrusionPreventionAssignmentsRecommendationsApiオブジェクトを作成し、それを使用して侵入防御ルールの割り当てと推奨事項を一覧表示します。
  3. 返されたIntrusionPreventionAssignmentsオブジェクト。

例: すべてのコンピュータの推奨設定ファイルの前回の検索の日付を取得する 親トピック

次の例では、すべてのコンピュータのリストを取得し、前回の推奨設定の検索の日付とステータスを確認します。コンピュータのホスト名とともに情報がカンマ区切り値 (CSV) 形式で返され、スプレッドシートとして開くことができます。
# Include minimal information in the returned Computer objects
expand = api.Expand(api.Expand.none)

# Get the list of computers and iterate over it
computers_api = api.ComputersApi(api.ApiClient(configuration))
computers = computers_api.list_computers(api_version, expand=expand.list(), overrides=False)

computer_ips_assignments_recommendations_api = (
    api.ComputerIntrusionPreventionRuleAssignmentsRecommendationsApi(api.ApiClient(configuration)))

for computer in computers.computers:
    # Get the recommendation scan information
    intrusion_prevention_assignments = (
        computer_ips_assignments_recommendations_api.list_intrusion_prevention_rule_ids_on_computer(
            computer.id,
            api_version,
            overrides=False))
    reco_scan_info = list()

    # Computer name
    reco_scan_info.append(computer.host_name)

    # Scan date
    if intrusion_prevention_assignments.last_recommendation_scan_date is not None:
        d = datetime.datetime.utcfromtimestamp(intrusion_prevention_assignments.last_recommendation_scan_date/1000)
        reco_scan_info.append(d.strftime('%Y-%m-%d %H:%M:%S'))
    else:
        reco_scan_info.append("No scan on record")

    # Scan status
    reco_scan_info.append(intrusion_prevention_assignments.recommendation_scan_status)

    # Add to the CSV string
    csv += format_for_csv(reco_scan_info)

return csv

推奨事項の適用 親トピック

APIは、変更監視、IPS、およびログ検査のためのコンピュータの推奨スキャン結果へのアクセスを提供します。ComputerIntrusionPreventionAssignmentsRecommendationsApiオブジェクトを使用して、コンピュータのIntrusionPreventionAssignmentsオブジェクトを取得します。IntrusionPreventionAssignmentsオブジェクトには、そのコンピュータの推奨事項が含まれており、アクセスを提供します。
  • 割り当ておよび割り当て解除に推奨される侵入防御ルール
  • 検索ステータス
  • 前回の検索日時
ルールの推奨を取得したら、次に示すように、それらをコンピュータポリシーに適用できます。コンピュータのポリシーに侵入防御ルールを追加するたとえば。
推奨スキャンがコンピュータで実行されていない場合、ComputerIntrusionPreventionAssignmentsRecommendationsApiはルールIDと最後のスキャン発生に対してnullを返します。
変更監視とログインスペクションのための同様のクラスが提供されています:
  • 変更監視
    • ComputerIntegrityMonitoringAssignmentsRecommendationsApi
    • IntegrityMonitoringAssignments
  • セキュリティログ監視
    • ComputerLogInspectionAssignmentsRecommendationsApi
    • LogInspectionAssignments
次の例では、コンピュータの侵入防御の推奨事項を取得します。
ip_recommendations_api = api.ComputerIntrusionPreventionRuleAssignmentsRecommendationsApi(api.ApiClient(configuration))
ip_assignments = None

ip_assignments = ip_recommendations_api.list_intrusion_prevention_rule_ids_on_computer(computer_id, api_version, overrides=False)
return ip_assignments.recommended_to_assign_rule_ids
また、 List Intrusion Prevention Rule IDs operation in the API Reference. For information about authenticating API calls, see Server & Workload Protectionによる認証