|
| 1 | +# security-alarms |
| 2 | + |
| 3 | +Oracle Cloud Infrastructure (OCI) and services provide effective and manageable security that enables you to run mission-critical workloads and store your data with confidence. To achieve cloud security operational excellence, it is crucial to continuously protect, detect and in the event of a protentional risky configuration change or potential attack, respond. For protection of the environment, a string security posture and essential cyber hygiene practice is imperative. |
| 4 | + |
| 5 | +Creating alarms to be passed to the security responsible organization or individuals are a key requirement to be able to early detection of a Advanced Persistent threat type of attack. |
| 6 | + |
| 7 | +# Security Protection, Detection and Response |
| 8 | + |
| 9 | + A common set of best practises for protection, detection and response are: |
| 10 | +- Security posture management. Oracle Cloud Guard provides strong security posture management, configuration change management, threat intelligence and unsecure configuration detection and remediation. |
| 11 | +- Security monitoring. For our customers navigating the dynamic cloud security landscape without a dedicated Security Information and Event Management (SIEM) system, the Security Fundamentals Dashboards are set to support our customers in building and maintaining strong security monitoring, observability and governance around the OCI cloud. The Security Fundamentals Dashboards proactively aggregate and analyse OCI logs. |
| 12 | +- Centre of Information Security, CIS, [CIS Benchmark for Oracle OCI](https://www.cisecurity.org/benchmark/oracle_cloud). The CIS benchmark builds a foundation for minimum protection and detection of your OCI tenancy. Oracle Cloud Guard providers detectors for the CIS Controls related to protection. |
| 13 | +- Security metrics and alerts. With Oracle metrics and alarms, you may configure alarms that is triggered, and notifications created when an security related metrics exceeds a threshold. For configuration changes, Cloud Guard provides standard responders for notification in the event of unsecure configuration changes. |
| 14 | + |
| 15 | +The scope of this post is to show how the Security Fundamentals Dashboard can be enhanced with alarms and notifications. |
| 16 | + |
| 17 | + |
| 18 | +In the example, egress traffic peak value, from the production VCN, will be used as an example. For data loss prevention, monitoring a flux or massive egress traffic can be created as a detective security control. |
| 19 | +As a security foundation the following minimum are recommended |
| 20 | +- Ensure Cloud Guard is enabled and configured. It is not a requirement for SFD, but it is common best practice, and any organization is recommended to actively use Oracle Cloud Guard. It is included in your subscription; no additional cost incurs. |
| 21 | + |
| 22 | +[Cloud Guard Documentation](https://docs.oracle.com/en-us/iaas/cloud-guard/using/part-start.htm) |
| 23 | +- Revisit CIS Benchmark for OCI at: [https://www.cisecurity.org/benchmark/oracle_cloud](https://www.cisecurity.org/benchmark/oracle_cloud) |
| 24 | +- Deploy Security Foundation Dashboard. After the few initial prerequisites, like enabling a VCN Flow log, the dashboard is built as a terraform script, that can be run directly as a stack. |
| 25 | + [Security Fundamentals Dashboard on GIT](https://github.com/oracle-quickstart/oci-o11y-solutions/tree/main/knowledge-content/MAP/security-fundamentals-dashboards) |
| 26 | + |
| 27 | +Below are a few samples from the Security Fundamentals Dashboard |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +Sample of Security Fundamentals Dashboard, identity |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +Sample of Securtity Fundamentals Dashboard, network. |
| 36 | + |
| 37 | +# Implementation flow |
| 38 | + |
| 39 | +The building blocks and flow for security alarm creation are: |
| 40 | +- OCI Observability and Logging, with Logging Analytic |
| 41 | +Ingest OCI Flow Logs into log analytics, and use log analytic explorer to create a query. The query may be run at ingestion time or at a scheduled interval. The query is saved as a custom log explorer query. |
| 42 | +The Security Fundamentals Dashboard automatically creates the ingestion from OCI Logging. Please review the [Documentation on GIT(https://github.com/oracle-quickstart/oci-o11y-solutions/tree/main/knowledge-content/MAP/security-fundamentals-dashboard)] |
| 43 | + |
| 44 | +- OCI Metric services, detection rules |
| 45 | +The query result can be defined as a custom metric, by defining a detection rule on the saved query. In the example below the detection rule is run at a scheduled interval. |
| 46 | +- Create a OCI Notification service. The Notification service creates a subscribeable Notification Topic. The topic is fired when an alarm threshold is exceeded. |
| 47 | +- OCI Metric Alarm triggers a notification based on a threshold |
| 48 | + |
| 49 | +# Required policies |
| 50 | + |
| 51 | +There are two set of policies that needs to be defined: |
| 52 | +- Policies for enabling the Security Fundamentals Dashboard |
| 53 | +- Policies for enabling a detection rule |
| 54 | + |
| 55 | +The policies for the Security Fundamentals Dashboard, please refer to the [documentation](https://github.com/oracle-quickstart/oci-o11y-solutions/tree/main/knowledge-content/MAP/security-fundamentals-dashboard) |
| 56 | + |
| 57 | +The policy definitions for detector rules, which requires a dynamic group, are defined in the [documentation](https://docs.public.oneportal.content.oci.oraclecloud.com/en-us/iaas/logging-analytics/doc/create-schedule-run-saved-search.html#GUID-A37A3F93-BE74-4850-859D-C8D293781036) |
| 58 | +Below is an example of dynamic group membership rule and policies enabling detection rules: |
| 59 | + |
| 60 | +``` |
| 61 | +ALL {resource.type='loganalyticsscheduledtask'} |
| 62 | +``` |
| 63 | + |
| 64 | +Example root level policy definition |
| 65 | + |
| 66 | + ``` |
| 67 | + |
| 68 | +allow dynamic-group myloganalytics-detection-group to use metrics in tenancy |
| 69 | +allow dynamic-group myoganalytics-detection-group to read management-saved-search in tenancy |
| 70 | +allow dynamic-group myoganalytics-detection-group to {LOG_ANALYTICS_QUERY_VIEW} in tenancy |
| 71 | +allow dynamic-group myoganalytics-detection-group to {LOG_ANALYTICS_QUERYJOB_WORK_REQUEST_READ} in tenancy |
| 72 | +allow dynamic-group myoganalytics-detection-group to READ loganalytics-log-group in tenancy |
| 73 | +allow dynamic-group myoganalytics-detection-group to read compartments in tenancy |
| 74 | +``` |
| 75 | + |
| 76 | +# Define custom metrics query |
| 77 | + |
| 78 | +Navigate to the dashboard, and select one widget, in our case the egress widget. You will then see the log explorer of log analytics |
| 79 | +- Alter the query to accommodate your need, in the sample below, we look at MB egress pr. 10 min. |
| 80 | +- Save the modified query as a new query |
| 81 | +- Pull up the new query and add it as a metric. |
| 82 | + |
| 83 | + |
| 84 | +Picture of Network dashboard |
| 85 | + |
| 86 | +Expand Egress traffic widget expanded to log explorer |
| 87 | + |
| 88 | + |
| 89 | +Piture of log explorer |
| 90 | + |
| 91 | +Run the modfied query: |
| 92 | +``` |
| 93 | +'Log Source' = 'OCI VCN Flow Unified Schema Logs' | where 'Destination IP' = 'Public IP' | eval vol = 'Content Size Out' / 1024 | timestats span = 10minute sum(vol) as 'Volume (KB) |
| 94 | +``` |
| 95 | +and save it. |
| 96 | + |
| 97 | + |
| 98 | +Picture of exection of modified query |
| 99 | + |
| 100 | + |
| 101 | +Picture of modified query |
| 102 | + |
| 103 | +# Create detection rule |
| 104 | +Navigate to log analytics, dashboard saved query, and pull up the saved query |
| 105 | + |
| 106 | + |
| 107 | +Picture of saved query screen |
| 108 | + |
| 109 | +Create the Detection rule. In the detection rule creation screen, select the folowing: |
| 110 | +- "Scheduled Detection Rule" The method for running the log analytic query |
| 111 | +- "Rule Name", self-describing |
| 112 | +- "Saved search name", select the correct compartment and saved log analytics query for the metric |
| 113 | +- "target service", select type monitoring (which the alarm are a function of), Metric namespace, name and frequency. |
| 114 | +The metric namespace is either an existing customer namespace or a new one. The new one will be created if the namespace name is nonexisting. If this is the first alarm, create a new descriptive name, otherwise select an existing name, if you want to group several alarms in the same namespace. Minimum interval is 5 minutes, normally a good choice for security alarms. |
| 115 | + |
| 116 | + |
| 117 | +Picture of first rule creation step |
| 118 | + |
| 119 | + |
| 120 | +Picture of 2. step |
| 121 | + |
| 122 | +When the detection rule is created verify the detection rule |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | +Picture of rule validation |
| 128 | + |
| 129 | +# Topic Creation |
| 130 | + |
| 131 | +Topics are the transport of an alarm to a target and needs to be present before the alarm can be created. Topics are created under Notifications (Developer Services/Application Integration) |
| 132 | + |
| 133 | +After the creation of a topic one or many subscriptions needs to be added, the receivers of the topic. |
| 134 | +The topic creation is straight forward, as illustrated below. Navigate to ```Developer Series/Application Integration/Notifications``` |
| 135 | + |
| 136 | + |
| 137 | +Topic creation, step 1 |
| 138 | + |
| 139 | +Topic creation, step 2 |
| 140 | + |
| 141 | +Topic creation, step 3 |
| 142 | + |
| 143 | +After the topic is created, a subscription is reasonable to create, the receiver of the alarm. |
| 144 | + |
| 145 | +Topic creation, step 4 |
| 146 | + |
| 147 | +Topic creation, step 5 |
| 148 | + |
| 149 | +When the subscription is created, the subscriber will receive an email with a link to a confirmation. |
| 150 | + |
| 151 | +Confiormation link mail, step 5 |
| 152 | + |
| 153 | + |
| 154 | +Final status after successful confirmation of the subscription |
| 155 | + |
| 156 | +# Define the alarm |
| 157 | + |
| 158 | +The final configuration is to build a alarm. |
| 159 | +The Alarm is defined under Observability and logging, in the Monitoring/alarm section: |
| 160 | + |
| 161 | +The alarm require a metric, in a metric namespace, a threshold value of the metric and a notification topic to trigger when the threshold is exceeded. |
| 162 | +The trick of the trade here is the fields: |
| 163 | +- Metric namespace. This is the link back to the saved query/detection rule from above |
| 164 | +- Interval, matches the query interval |
| 165 | +- As dimension select saved search and dimension value, the name of the search. |
| 166 | +- Statistics, select max(), the formula used to calculate the current value of the alarm |
| 167 | +- Operator, greater than and the value 1000000 |
| 168 | + |
| 169 | +This will create an alarm that trigger if the last 5 minutes egress traffic exceed 1000000 bytes. |
| 170 | + |
| 171 | + |
| 172 | +Alarm definition |
| 173 | + |
| 174 | +Alarm definition continued |
| 175 | + |
| 176 | +Example of mail alarm received when the egress volume exceeds 1000000 bytes within 5 min. This might indicate a potential data loss. |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | +# Summary |
| 181 | + |
| 182 | +In the post there has been show how a single widget in the Securty Foundation Dashboard can be enhanced to create a custom alarm on a custom metric. |
| 183 | + |
| 184 | +The natural next step is to assess which alarms will be required based on your risk assessment, and with terraform create all the required alarms. |
| 185 | +When the alarms are createrd, the real value lies in how you choose to respond to the events receved. |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | +# License |
| 190 | + |
| 191 | +Copyright (c) 2024 Oracle and/or its affiliates. |
| 192 | + |
| 193 | +Licensed under the Universal Permissive License (UPL), Version 1.0. |
| 194 | + |
| 195 | +See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details. |
0 commit comments