Azure Database for MySQL
Overview
Azure Database for MySQL provides fully managed, enterprise-ready community MySQL database as a service. The service is developed and managed by Microsoft Corp.
Related Built-in Rules
The following Sekoia.io built-in rules match the intake Azure Database for MySQL. This documentation is updated automatically and is based solely on the fields used by the intake which are checked against our rules. This means that some rules will be listed but might not be relevant with the intake.
SEKOIA.IO x Azure Database for MySQL on ATT&CK Navigator
SEKOIA.IO Intelligence Feed
Detect threats based on indicators of compromise (IOCs) collected by SEKOIA's Threat and Detection Research team.
- Effort: elementary
Event Categories
The following table lists the data source offered by this integration.
Data Source | Description |
---|---|
Authentication logs |
user authentication events are parsed |
Application logs |
SQL requests are analyzed |
Event Samples
Find below few samples of events and how they are normalized by Sekoia.io.
{
"message": "{ \"LogicalServerName\": \"abc\", \"SubscriptionId\": \"1072bad1-5e23-468e-9680-52177642cd13\", \"ResourceGroup\": \"group\", \"time\": \"2019-10-25T12:46:45Z\", \"resourceId\": \"/SUBSCRIPTIONS/1072BAD1-5E23-468E-9680-52177642CD13/RESOURCEGROUPS/group/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/abc\", \"category\": \"MySqlAuditLogs\", \"operationName\": \"LogEvent\", \"properties\": {\"event_class\":\"connection_log\",\"event_subclass\":\"CONNECT\",\"connection_id\":7304735,\"host\":\"\",\"ip\":\"1.1.1.1\",\"user\":\"grafana\",\"db\":\"grafana\"}}",
"event": {
"outcome": "success"
},
"action": {
"name": "CONNECT",
"outcome": "success",
"type": "connection_log"
},
"group": {
"name": "group"
},
"host": {
"hostname": "abc",
"name": "abc"
},
"log": {
"hostname": "abc"
},
"related": {
"hosts": [
"abc"
],
"ip": [
"1.1.1.1"
],
"user": [
"grafana"
]
},
"source": {
"address": "1.1.1.1",
"ip": "1.1.1.1"
},
"user": {
"name": "grafana"
}
}
{
"message": "{ \"LogicalServerName\": \"abc\", \"SubscriptionId\": \"123\", \"ResourceGroup\": \"group\", \"time\": \"2019-10-25T12:46:45Z\", \"resourceId\": \"/SUBSCRIPTIONS/123/RESOURCEGROUPS/group/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/abc\", \"category\": \"MySqlAuditLogs\", \"operationName\": \"LogEvent\", \"properties\": {\"event_class\":\"connection_log\",\"event_subclass\":\"DISCONNECT\",\"connection_id\":7304732,\"host\":\"\",\"ip\":\"1.1.1.1\",\"user\":\"grafana\",\"db\":\"grafana\"}}",
"event": {
"outcome": "success"
},
"action": {
"name": "DISCONNECT",
"outcome": "success",
"type": "connection_log"
},
"group": {
"name": "group"
},
"host": {
"hostname": "abc",
"name": "abc"
},
"log": {
"hostname": "abc"
},
"related": {
"hosts": [
"abc"
],
"ip": [
"1.1.1.1"
],
"user": [
"grafana"
]
},
"source": {
"address": "1.1.1.1",
"ip": "1.1.1.1"
},
"user": {
"name": "grafana"
}
}
Extracted Fields
The following table lists the fields that are extracted, normalized under the ECS format, analyzed and indexed by the parser. It should be noted that infered fields are not listed.
Name | Type | Description |
---|---|---|
group.name |
keyword |
Name of the group. |
host.hostname |
keyword |
Hostname of the host. |
source.ip |
ip |
IP address of the source. |
user.name |
keyword |
Short name or login of the user. |
Configure
This setup guide will show you how to forward events produced by Azure MySQL service to Sekoia.io.
Theses changes have to be made from the Azure Web Portal.
Azure Event Hubs
As a prerequisite, you need to choose an existing resource group, or create a new one (e.g. company-resource-group
).
Retrieve your Subscription ID
You also need your Subscription ID if you don't have a default one.
In Azure Web Portal:
- Navigate to:
Home
>Cost Management + Billing
>Subscriptions
- From there, copy the relevant Subscription ID that will be used in the command line (e.g.
uuid
)
Create the Event Hubs
Use Azure PowerShell (within Cloud Shell interface for example) to create a namespace (e.g. company-eventhub
) and a specific Event Hub (e.g. mysql-event
) within your resource group (e.g. company-resource-group
)
PS Azure:\> az eventhubs namespace create --name company-eventhub --resource-group company-resource-group --enable-kafka true --subscription uuid
PS Azure:\> az eventhubs eventhub create --resource-group company-resource-group --namespace-name company-eventhub --name mysql-event --message-retention 3 --partition-count 4 --subscription uuid
Info
Please replace :
company-resource-group
with the name of your resource groupuuid
with your subscription ID retrieved previously (see below)
Create “Shared Access Policies”
-
Navigate to
Home
>Event Hubs
>company-eventhub - Shared access policies
- From there, you can create a policy (e.g.
RootManageSharedAccessKey
) with the claimsManage
,Send
andListen
and note the Primary Key that will be used as the SharedAccessKey
- From there, you can create a policy (e.g.
-
Navigate to
Home
>Event Hubs
>company-eventhub
>mysql-event - Shared access policies
- From there, you can create a policy (e.g.
sekoiaio
) with the claimsListen
- Once created, click on the policy and save the Connection string-primary key, to be sent to Sekoia.io
- From there, you can create a policy (e.g.
-
Navigate to
Home
>Event Hubs
>company-eventhub
>mysql-event - Consumer groups
- From there, you can create a consumer group (e.g.
sekoiaio
)
- From there, you can create a consumer group (e.g.
Create a Blob Storage for Checkpointing
In order to allow Sekoia.io, keep track of the consumed events, the next step consists in creating a dedicated Azure Blob Storage.
To proceed, you can use Azure PowerShell:
PS Azure:\> az storage account create --name "sekoiaiocheckpoint" --resource-group "company-resource-group"
PS Azure:\> az storage container create --name "mysql-event" --account-name "sekoiaiocheckpoint"
Info
The container name, here mysql-event
should be the same as the Event Hub’s one.
You also need to replace company-resource-group
with the name of your resource group.
Finally, you have to retrieve the connection string from Azure Web Portal by going in Storage Accounts, then in the created storage (sekoiaiocheckpoint
) and finally in the Access Keys section. After clicking on Show keys, you can copy the first of the two connection strings.
Azure MySQL
You need to activate and configure the Azure MySQL diagnostic settings (e.g. company-mysql
).
To configure these settings, follow these steps:
- Navigate to
Home
>SQL databases
(e.g.company-mysql
) >Monitoring
>Diagnostic settings
- Add a new diagnostic setting, select Stream to an event hub and click on Configure
- Select the previously created Event hubs, Event Hub and SharedAccessKey
- In the log section, select MySqlAuditLogs and MySqlSlowLogs
- Choose a name for this configuration and click on Save
Forward the Connection Keys to Sekoia.io
Finally, please send to Sekoia.io the following information:
- Azure Event Hub’s Connection string-primary key (e.g.
"Endpoint=sb://company-eventhub.servicebus.windows.net/;SharedAccessKeyName=sekoiaio;SharedAccessKey=XXXXXX;EntityPath=mysql-event"
) - Azure Event Hub’s consumer group name (e.g.
sekoiaio
) - Azure Blob Storage’s connection string (e.g.
"DefaultEndpointsProtocol=https;AccountName=sekoiaiocheckpoint;AccountKey=XXXXX"
)