|
| 1 | +Compliance Benchmarks |
| 2 | +====== |
| 3 | + |
| 4 | +CIS benchmarks are configuration guidelines published by the Center for Internet Security. |
| 5 | +The CIS Benchmark enable configuration and retrieval of Benchmark Sets and Rules in Carbon Black Cloud, and |
| 6 | +retrieval of the results from scans performed using these Rules. |
| 7 | + |
| 8 | +For more information on CIS Benchmarks, see the `Center for Internet Security <https://www.cisecurity.org/cis-benchmarks>`_. |
| 9 | +CIS benchmarks contain over 100 configuration guidelines created by a global community of cybersecurity experts to safeguard |
| 10 | +various systems against attacks targeting configuration vulnerabilities. |
| 11 | + |
| 12 | +You can use all the operations shown in the API, such as retrieving, filtering, reaccessing and enabling/disabling the benchmark rules. |
| 13 | +You can locate the full list of operations and attributes in the :py:mod:`ComplianceBenchmark() <cbc_sdk.workload.compliance_assessment.ComplianceBenchmark>` class. |
| 14 | + |
| 15 | +Resources |
| 16 | +--------- |
| 17 | +* `API Documentation <https://developer.carbonblack.com/reference/carbon-black-cloud/workload-protection/latest/cis-benchmark-api>`_ on Developer Network |
| 18 | +* `User Guide <https://docs.vmware.com/en/VMware-Carbon-Black-Cloud/services/carbon-black-cloud-user-guide/GUID-47645D2C-A093-47C8-B4CA-D6F685392733.html>`_ |
| 19 | + |
| 20 | +Retrieve Compliance Benchmarks |
| 21 | +--------------- |
| 22 | + |
| 23 | +By using the following the example, you can retrieve the list of supported benchmarks |
| 24 | + |
| 25 | +.. code-block:: python |
| 26 | +
|
| 27 | + >>> from cbc_sdk import CBCloudAPI |
| 28 | + >>> from cbc_sdk.workload import ComplianceBenchmark |
| 29 | + >>> api = CBCloudAPI(profile='sample') |
| 30 | + >>> benchmark_query = api.select(ComplianceBenchmark) |
| 31 | + >>> for benchmark in benchmark_query: |
| 32 | + >>> print(benchmark) |
| 33 | + ComplianceBenchmark object, bound to https://defense-test03.cbdtest.io. |
| 34 | + ------------------------------------------------------------------------------- |
| 35 | +
|
| 36 | + bundle_name: CIS Compliance - Microsoft Windows Server |
| 37 | + create_time: 2023-03-20T13:44:10.923039Z |
| 38 | + created_by: emuthu+csr@carbonblack.com |
| 39 | + enabled: True |
| 40 | + id: b7d1b266-d899-4e28-bae6-7619019447ba |
| 41 | + name: CIS Windows Server Retail application Prod |
| 42 | + os_family: WINDOWS_SERVER |
| 43 | + release_time: 2023-07-10T13:55:59.274881Z |
| 44 | + supported_os_info: [list:5 items]: |
| 45 | + [0]: {'os_metadata_id': '1', 'os_type': 'WINDOWS', '... |
| 46 | + [1]: {'os_metadata_id': '2', 'os_type': 'WINDOWS', '... |
| 47 | + [2]: {'os_metadata_id': '3', 'os_type': 'WINDOWS', '... |
| 48 | + [...] |
| 49 | + type: Custom |
| 50 | + update_time: 2024-04-15T21:24:43.283032Z |
| 51 | + updated_by: |
| 52 | + version: 1.0.0.4 |
| 53 | +
|
| 54 | +
|
| 55 | +Modify Compliance Benchmarks Schedule |
| 56 | +--------------- |
| 57 | +
|
| 58 | +By using the following the example, you can get and set the benchmark assessment schedule |
| 59 | +
|
| 60 | +.. code-block:: python |
| 61 | +
|
| 62 | + >>> from cbc_sdk import CBCloudAPI |
| 63 | + >>> from cbc_sdk.workload import ComplianceBenchmark |
| 64 | + >>> api = CBCloudAPI(profile='sample') |
| 65 | + >>> ComplianceBenchmark.set_compliance_schedule(api, "RRULE:FREQ=DAILY;BYHOUR=17;BYMINUTE=30;BYSECOND=0", "UTC") |
| 66 | + >>> schedule = ComplianceBenchmark.get_compliance_schedule(api) |
| 67 | + >>> print(schedule) |
| 68 | + { |
| 69 | + "scan_schedule": "FREQ=WEEKLY;BYDAY=TU;BYHOUR=11;BYMINUTE=30;BYSECOND=0", |
| 70 | + "scan_timezone": "UTC" |
| 71 | + } |
| 72 | +
|
| 73 | +
|
| 74 | +Reassess Compliance Benchmarks |
| 75 | +--------------- |
| 76 | +
|
| 77 | +By using the following the example, you can reasses a benchmark |
| 78 | +
|
| 79 | +.. code-block:: python |
| 80 | +
|
| 81 | + >>> from cbc_sdk import CBCloudAPI |
| 82 | + >>> from cbc_sdk.workload import ComplianceBenchmark |
| 83 | + >>> api = CBCloudAPI(profile='sample') |
| 84 | + >>> benchmark = api.select(ComplianceBenchmark).first() |
| 85 | + >>> # Execute for all devices matching benchmark |
| 86 | + >>> benchmark.execute_action("REASSESS") |
| 87 | + >>> # Execute for a specific set of devices |
| 88 | + >>> benchmark.execute_action("REASSESS", [ 1, 2, 3 ]) |
| 89 | +
|
| 90 | +
|
| 91 | +Device Compliance Summary |
| 92 | +--------------- |
| 93 | +
|
| 94 | +By using the following the example, you can fetch the compliance percentage for each device assessed by the Compliance Benchmark |
| 95 | +
|
| 96 | +.. code-block:: python |
| 97 | +
|
| 98 | + >>> from cbc_sdk import CBCloudAPI |
| 99 | + >>> from cbc_sdk.workload import ComplianceBenchmark |
| 100 | + >>> api = CBCloudAPI(profile='sample') |
| 101 | + >>> benchmark = api.select(ComplianceBenchmark).first() |
| 102 | + >>> summaries = benchmark.get_device_compliances() |
| 103 | + >>> print(summaries[0]) |
| 104 | + { |
| 105 | + "device_id": 39074613, |
| 106 | + "device_name": "Example\\Win2022", |
| 107 | + "os_version": "Windows Server 2022 x64", |
| 108 | + "compliance_percentage": 93, |
| 109 | + "last_assess_time": "2024-04-16T00:00:00.014765Z", |
| 110 | + "excluded_on": None, |
| 111 | + "excluded_by": None, |
| 112 | + "reason": None, |
| 113 | + "deployment_type": "WORKLOAD" |
| 114 | + } |
0 commit comments