Skip to content

Commit 1b886c6

Browse files
authored
Merge pull request #1592 from oracle-devrel/ios-security-alarms
Ios security alarms
2 parents 0c5696a + b4591eb commit 1b886c6

27 files changed

+218
-1
lines changed

security/ciso-office/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ Last updated: 28.10.2024
8888
## Reusable Assets Overview
8989

9090
- [Identity Token Propagation Script](shared-assets/oic_iam_token_exchange_demo/readme.md)
91-
- [Adding a Group to an OCI IAM Admin Role](shared-assets/oci_iam_adding_group_to_admin_role/readme.md)
91+
- [Adding a Group to an OCI IAM Admin Role](shared-assets/oci_iam_adding_group_to_admin_role/)
92+
- [Adding OCI Observability alarms to security monitoring](shared-assets/security-alarms/README.md)
9293

9394
# Useful Links
9495

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# Generation of Securty Alarms from OCI logs
2+
3+
Oracle Cloud Infrastructure (OCI) and its 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 potentially risky configuration change or potential attack, respond. For protection of the environment, a strong security posture and essential cyber hygiene practices are imperative.
4+
5+
Creating alarms to be passed to the security responsible organization or individuals is a key requirement in order to gain early detection of a Advanced Persistent Threat type of attack.
6+
7+
# Security Protection, Detection, and Response
8+
9+
A common set of best practices for protection, detection, and response are:
10+
- **Security posture management** - Oracle [Cloud Guard](https://www.oracle.com/uk/security/cloud-security/cloud-guard/) provides strong security posture management, configuration change management, threat intelligence and unsecure configuration detection and remediation.
11+
- **Security monitoring** - For 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](https://blogs.oracle.com/observability/post/oracle-cloud-infrastructure-security-fundamentals-dashboards-using-oci-logging-analytics) proactively aggregate and analyse OCI logs.
12+
- **Compliance Checking** - It is important to check your tenancy against industry best practices. The Centre of Information Security (CIS) produces a [Benchmark for Oracle OCI](https://www.cisecurity.org/benchmark/oracle_cloud). This benchmark builds a foundation for minimum protection and detection within your OCI tenancy. Oracle Cloud Guard providers detectors for the CIS Controls related to protection.
13+
- **Security metrics and alerts** - With Oracle [Metrics](https://docs.public.oneportal.content.oci.oraclecloud.com/en-us/iaas/Content/managed-access/metrics.htm) and [Alarms](https://docs.oracle.com/en-us/iaas/Content/Monitoring/Tasks/managingalarms.htm), you may configure alarms that are triggered, and notifications created when a security-related metric exceeds a threshold. For configuration changes, Cloud Guard provides standard responders for notification in the event of unsecure configuration changes, with the option in many cases to remediate the change.
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+
For this example, egress traffic peak value, from the production VCN, will be used. One common sign of data loss is the unusually large increase in egress traffic as attackers exfiltrate data they have found. To mitigate this, monitoring a flux or large amount of egress traffic can be used as a detective security control.
19+
20+
As a security foundation, the following minimum are recommended
21+
- Ensure Cloud Guard is enabled and configured. It is not a requirement for the Security Fundamentals Dashboard, but it is industry best practice (as identified by CIS), and every organization is recommended to actively use Oracle Cloud Guard. It is included in all OCI subscriptions with no additional costs being incurred. [(Cloud Guard documentation)](https://docs.oracle.com/en-us/iaas/cloud-guard/using/part-start.htm)
22+
- Revisit [CIS Benchmark](https://www.cisecurity.org/benchmark/oracle_cloud) for OCI. The [OCI Security Health Check](https://github.com/oracle-devrel/technology-engineering/tree/main/security/security-design/shared-assets/oci-security-health-check-standard) is a freely available script that can be used to compare an existing tenancies configuration against the CIS benchmark, producing a report with findings and recommendations.
23+
- Deploy the [Security Fundamentals Dashboard](ttps://github.com/oracle-quickstart/oci-o11y-solutions/tree/main/knowledge-content/MAP/security-fundamentals-dashboards). After the few initial prerequisites, such as enabling a VCN Flow log, the dashboard is built as a terraform script that can be run directly as a stack.
24+
25+
Below are sample screenshots from the two Security Fundamentals Dashboards: Identity and Network
26+
27+
**Security Fundamentals Dashboard - Identity Security**
28+
![](images/identity_security_dashboard_identity_domain.png)
29+
<sub>Example Identity Dashboard</sub>
30+
31+
**Security Fundamentals Dashboard - Network Security**
32+
33+
![](images/network_dashboard.png)
34+
<sub>Example Network Dashboard</sub>
35+
36+
# Implementation flow
37+
38+
Let's now focus on the case for creating a security alarm and adding it to the dashboard. The building blocks and flow for security alarm creation are:
39+
- **OCI Observability & Management, with Logging Analytics** - Ingest OCI Flow Logs into Log Analytics, and use Log Analytics 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.
40+
The Security Fundamentals Dashboard automatically creates the ingestion from OCI Logging. Please review the [documentation](https://github.com/oracle-quickstart/oci-o11y-solutions/tree/main/knowledge-content/MAP/security-fundamentals-dashboards) on GIT.
41+
42+
- **OCI Metric services, detection rules** - The query result can be defined as a custom metric by defining a detection rule on the saved query. In this example below, the detection rule is run at a scheduled interval.
43+
- **Create an OCI Notification service** - The Notification service creates a subscribeable Notification Topic. The topic is fired when an alarm threshold is exceeded.
44+
- **OCI Metric Alarm** - Triggers a notification based on a threshold.
45+
46+
# Required IAM policies
47+
48+
There are two set of IAM policies that need to be defined:
49+
- Policies for enabling the Security Fundamentals Dashboard
50+
- Policies for enabling a detection rule
51+
52+
For the policies required 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-dashboards).
53+
54+
The policy definitions for detector rules, which require 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).
55+
56+
Below is an example of dynamic group membership rule and the policies for enabling detection rules:
57+
58+
```
59+
ALL {resource.type='loganalyticsscheduledtask'}
60+
```
61+
62+
Example root level policy definition
63+
64+
```
65+
66+
allow dynamic-group myloganalytics-detection-group to use metrics in tenancy
67+
allow dynamic-group myloganalytics-detection-group to read management-saved-search in tenancy
68+
allow dynamic-group myloganalytics-detection-group to {LOG_ANALYTICS_QUERY_VIEW} in tenancy
69+
allow dynamic-group myloganalytics-detection-group to {LOG_ANALYTICS_QUERYJOB_WORK_REQUEST_READ} in tenancy
70+
allow dynamic-group myloganalytics-detection-group to READ loganalytics-log-group in tenancy
71+
allow dynamic-group myloganalytics-detection-group to read compartments in tenancy
72+
```
73+
74+
# Define custom metrics query
75+
76+
Once we have the IAM pre-requisites in place, we can start by defining our custom metrics query.
77+
78+
Navigate to `Observability & Management -> Logging Analytics -> Dashboards` and select Network Dashboard.
79+
80+
![network_dashboard](images/network_dashboard_2.png)
81+
<sub>Network Dashboard from Securty Fundamentals Dashboard</sub>
82+
83+
Expand Egress traffic widget and you will see the Log Explorer
84+
85+
![drilldown](images/drilldown.png)
86+
<sub>Piture of log explorer</sub>
87+
88+
Run the modfied query:
89+
```
90+
'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)
91+
```
92+
![runquery](images/runquery.png)
93+
<sub>Picture of exection of modified query</sub>
94+
95+
![savequery1](images/savequery1.png)
96+
<sub>Picture of save query as</sub>
97+
98+
Pull the list of saved queries
99+
100+
![savedsearches](images/savedsearches.png)
101+
<sub>Picture of modified query</sub>
102+
103+
104+
# Create detection rule
105+
Having created the custom query, we now need to create the detection rule.
106+
107+
Navigate to `Analytics -> Dashboard -> Saved Searches`, and pull up the saved query.
108+
109+
![addmetric1](images/addmetric1.png)
110+
<sub>Picture of saved query screen</sub>
111+
112+
Create the Detection rule. In the detection rule creation screen, select the folowing:
113+
- "Scheduled Detection Rule" is the method for running the log analytic query
114+
- "Rule Name" is self-describing
115+
- "Saved search name" - Select the correct compartment and saved Log Analytics query for the metric
116+
- "Target service" - Select type **monitoring** (which the alarms are a function of), Metric namespace, name and frequency.
117+
> The metric namespace is either an existing customer namespace or a new one. The new one will be created if the namespace name doesn't exist. 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.
118+
- "Minimum interval" is 5 minutes, normally a good choice for security alarms.
119+
120+
![addmetric2](images/addmetric2.png)
121+
<sub>Picture of first rule creation step</sub>
122+
123+
![addmetric3](images/addmetric3.png)
124+
<sub>Picture of 2. step</sub>
125+
126+
When the detection rule is created verify the detection rule
127+
128+
![detectionrule](images/detectionrule.png)
129+
<sub>Picture of rule validation</sub>
130+
131+
# Topic Creation
132+
133+
Topics are the transport of an alarm to a target and needs to be present before the alarm can be created.
134+
135+
After the creation of a topic, one or many subscriptions needs to be added, which are the receivers of the topic.
136+
137+
The topic creation is straightforward, as illustrated below. Within the OCI console, navigate to `Developer Services -> Application Integration -> Notifications`
138+
139+
![create_topic_1](images/create_topic_1.png)
140+
<sub>Topic creation, step 1</sub>
141+
142+
![create_topic_2](images/create_topic_2.png)
143+
<sub>Topic creation, step 2</sub>
144+
145+
![create_topic_3](images/create_topic_3.png)
146+
<sub>Topic creation, step 3</sub>
147+
148+
After the topic is created, a subscription is reasonable to create, the receiver of the alarm.
149+
150+
![create_topic_4](images/create_topic_4.png)
151+
<sub>Topic creation, step 4</sub>
152+
153+
![create_topic_5](images/create_topic_5.png)
154+
<sub>Topic creation, step 5</sub>
155+
156+
When the subscription is created, the subscriber will receive an email with a link to a confirmation.
157+
> N.B. If a different type of subscription is chosen, the receiving user will receive a confirmation through that notification channel, e.g., Slack.
158+
159+
Use the link in the notification to confirm the subscription.
160+
161+
![confirm](images/confirm.png)
162+
<sub>Confirmation link mail</sub>
163+
164+
The subscription will then change to Active.
165+
166+
![create_topic_6](images/create_topic_6.png)
167+
<sub>Final status after successful confirmation of the subscription</sub>
168+
169+
# Define the alarm
170+
171+
The final configuration step is to build an alarm. The Alarm is defined within the OCI console under
172+
173+
`Observability & Management -> Monitoring -> Alarm Definitions`
174+
.
175+
The alarm requires a metric, in a metric namespace, a threshold value of the metric and a notification topic to trigger when the threshold is exceeded.
176+
177+
Ensure the fields are completed accurately:
178+
- "Metric namespace" - This is the link back to the saved query/detection rule from above
179+
- "Interval" - Matches the query interval
180+
- "Dimension" - Select Saved Search and dimension value, the name of the search.
181+
- "Statistics" - Select max(), the formula used to calculate the current value of the alarm
182+
- "Operator" - greater than, and the value 1000000
183+
184+
This will create an alarm that trigger if the last 5 minutes egress traffic exceed 1000000 bytes.
185+
186+
![alarm1a](images/alarm1a.png)
187+
<sub>Alarm definitions</sub>
188+
189+
![alarm1](images/alarm1b.png)
190+
<sub>Create Alarm definition</sub>
191+
192+
![alarm2](images/alarm2.png)
193+
<sub>Create Alarm definition continued</sub>
194+
195+
Here is an example of a mail alarm received when the egress volume exceeds 1000000 bytes within 5 min. This might indicate a potential data loss.
196+
197+
![alarm3](images/alarm3.png)
198+
<sub>Mail received when alarm is fired</sub>
199+
200+
# Summary
201+
202+
In this post, I have shown you how a single widget in the Securty Fundamentals Dashboard can be enhanced to create a custom alarm on a custom metric.
203+
204+
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.
205+
206+
When the alarms are created and triggers, it is important to have defined runbooks and procedures to determine what response and action to take.
207+
208+
209+
210+
# License
211+
212+
Copyright (c) 2025 Oracle and/or its affiliates.
213+
214+
Licensed under the Universal Permissive License (UPL), Version 1.0.
215+
216+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
464 KB
Loading
293 KB
Loading
287 KB
Loading
381 KB
Loading
86.2 KB
Loading
399 KB
Loading
95.6 KB
Loading
86 KB
Loading

0 commit comments

Comments
 (0)