Коммит
43dea2f039
|
@ -0,0 +1,137 @@
|
|||
{
|
||||
"Name":"TheHive_CL",
|
||||
"Properties":[
|
||||
{
|
||||
"Name":"iobject_updatedBy_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"object_updatedAt_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"operation_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"object__type_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"object_id_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"startDate_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"requestId_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"details_description_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"details_flag_b",
|
||||
"Type":"Bool"
|
||||
},
|
||||
{
|
||||
"Name":"details_title_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"details_status_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"details_owner_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"details_caseId_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"details_severity_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"details_tlp_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"details_startDate_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"details_tags_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"base_b",
|
||||
"Type":"Bool"
|
||||
},
|
||||
{
|
||||
"Name":"rootId_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"object_createdBy_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"object_description_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"object_flag_b",
|
||||
"Type":"Bool"
|
||||
},
|
||||
{
|
||||
"Name":"object_user_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"object_title_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"object_status_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"object_owner_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"object_createdAt_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"object_caseId_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"object_severity_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"object_tlp_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"object_startDate_d",
|
||||
"Type":"Double"
|
||||
},
|
||||
{
|
||||
"Name":"object_tags_s",
|
||||
"Type":"String"
|
||||
},
|
||||
{
|
||||
"Name":"objectType_s",
|
||||
"Type":"String"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
[
|
||||
{
|
||||
"operation": "Creation",
|
||||
"objectType": "case",
|
||||
"objectId": "AV6FZsTj0KeanEfOQfd_",
|
||||
"startDate": 1505476659427,
|
||||
"requestId": "13b17ff13d1cfc56:2b7b048b:15e84f42c33:-8000:426",
|
||||
"details": {
|
||||
"customFields": {},
|
||||
"metrics": {},
|
||||
"description": "Example of case creation",
|
||||
"flag": false,
|
||||
"title": "Test case for webhook",
|
||||
"status": "Open",
|
||||
"owner": "me",
|
||||
"caseId": 1445,
|
||||
"severity": 2,
|
||||
"tlp": 2,
|
||||
"startDate": 1505476620000,
|
||||
"tags": []
|
||||
},
|
||||
"base": true,
|
||||
"rootId": "AV6FZsTj0KeanEfOQfd_",
|
||||
"object": {
|
||||
"customFields": {},
|
||||
"metrics": {},
|
||||
"createdBy": "me",
|
||||
"description": "Example of case creation",
|
||||
"flag": false,
|
||||
"user": "me",
|
||||
"title": "Test case for webhook",
|
||||
"status": "Open",
|
||||
"owner": "me",
|
||||
"createdAt": 1505476658289,
|
||||
"caseId": 1445,
|
||||
"severity": 2,
|
||||
"tlp": 2,
|
||||
"startDate": 1505476620000,
|
||||
"tags": [],
|
||||
"id": "AV6FZsTj0KeanEfOQfd_",
|
||||
"_type": "case"
|
||||
}
|
||||
},
|
||||
{
|
||||
"operation": "Update",
|
||||
"details": {
|
||||
"severity": 3
|
||||
},
|
||||
"objectType": "case",
|
||||
"objectId": "AV6FZsTj0KeanEfOQfd_",
|
||||
"base": true,
|
||||
"startDate": 1505477372601,
|
||||
"rootId": "AV6FZsTj0KeanEfOQfd_",
|
||||
"requestId": "13b17ff13d1cfc56:2b7b048b:15e84f42c33:-8000:446",
|
||||
"object": {
|
||||
"customFields": {},
|
||||
"metrics": {},
|
||||
"createdBy": "me",
|
||||
"description": "Example of case creation",
|
||||
"flag": false,
|
||||
"user": "me",
|
||||
"title": "Test case for webhook",
|
||||
"status": "Open",
|
||||
"owner": "me",
|
||||
"createdAt": 1505476658289,
|
||||
"caseId": 1445,
|
||||
"severity": 3,
|
||||
"tlp": 2,
|
||||
"startDate": 1505476620000,
|
||||
"tags": [],
|
||||
"updatedBy": "me",
|
||||
"updatedAt": 1505477372246,
|
||||
"id": "AV6FZsTj0KeanEfOQfd_",
|
||||
"_type": "case"
|
||||
}
|
||||
}
|
||||
]
|
Двоичный файл не отображается.
|
@ -0,0 +1,85 @@
|
|||
import logging
|
||||
import hashlib
|
||||
import hmac
|
||||
import os
|
||||
import azure.functions as func
|
||||
import json
|
||||
import re
|
||||
import base64
|
||||
import requests
|
||||
import datetime
|
||||
|
||||
TheHiveBearerToken = os.environ['TheHiveBearerToken']
|
||||
customer_id = os.environ['WorkspaceID']
|
||||
shared_key = os.environ['WorkspaceKey']
|
||||
logAnalyticsUri = os.environ.get('logAnalyticsUri')
|
||||
log_type = 'TheHive'
|
||||
|
||||
if ((logAnalyticsUri in (None, '') or str(logAnalyticsUri).isspace())):
|
||||
logAnalyticsUri = 'https://' + customer_id + '.ods.opinsights.azure.com'
|
||||
pattern = r'https:\/\/([\w\-]+)\.ods\.opinsights\.azure.([a-zA-Z\.]+)$'
|
||||
match = re.match(pattern,str(logAnalyticsUri))
|
||||
if(not match):
|
||||
raise Exception("TheHive Data Connector: Invalid Log Analytics Uri.")
|
||||
|
||||
def build_signature(customer_id, shared_key, date, content_length, method, content_type, resource):
|
||||
x_headers = 'x-ms-date:' + date
|
||||
string_to_hash = method + "\n" + str(content_length) + "\n" + content_type + "\n" + x_headers + "\n" + resource
|
||||
bytes_to_hash = bytes(string_to_hash, encoding="utf-8")
|
||||
decoded_key = base64.b64decode(shared_key)
|
||||
encoded_hash = base64.b64encode(hmac.new(decoded_key, bytes_to_hash, digestmod=hashlib.sha256).digest()).decode()
|
||||
authorization = "SharedKey {}:{}".format(customer_id,encoded_hash)
|
||||
return authorization
|
||||
|
||||
def post_data_to_sentinel(body):
|
||||
method = 'POST'
|
||||
content_type = 'application/json'
|
||||
resource = '/api/logs'
|
||||
rfc1123date = datetime.datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
|
||||
content_length = len(body)
|
||||
signature = build_signature(customer_id, shared_key, rfc1123date, content_length, method, content_type, resource)
|
||||
uri = logAnalyticsUri + resource + '?api-version=2016-04-01'
|
||||
headers = {
|
||||
'content-type': content_type,
|
||||
'Authorization': signature,
|
||||
'Log-Type': log_type,
|
||||
'x-ms-date': rfc1123date
|
||||
}
|
||||
response = requests.post(uri,data=body, headers=headers)
|
||||
if (response.status_code >= 200 and response.status_code <= 299):
|
||||
logging.info("TheHive event successfully processed to the Azure Sentinel.")
|
||||
return response.status_code
|
||||
else:
|
||||
logging.warn("Event is not processed into Azure. Response code: {}".format(response.status_code))
|
||||
return None
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
logging.info('Python HTTP trigger function processed a request. Start of processing.')
|
||||
method = req.method
|
||||
params = req.params
|
||||
if method == 'POST':
|
||||
if 'Authorization' in req.headers:
|
||||
bearer_string = re.match("^Bearer\s+(.*)", req.headers['Authorization'])
|
||||
if bearer_string:
|
||||
bearer_token = bearer_string.group(1)
|
||||
if bearer_token == TheHiveBearerToken:
|
||||
post_req_data = req.get_body()
|
||||
message = post_req_data.decode('utf-8')
|
||||
logging.info("200 OK HTTPS")
|
||||
try:
|
||||
message = json.loads(message)
|
||||
post_data_to_sentinel(json.dumps(message))
|
||||
except Exception as err:
|
||||
logging.error(f"Is not valid Message format. Error: {err}. Message: {message}.")
|
||||
return func.HttpResponse("200 OK HTTPS", status_code=200)
|
||||
else:
|
||||
logging.error("Unauthorized, Bearer token is not right. Error code: 401.")
|
||||
return func.HttpResponse("Unauthorized, Bearer token is not right.", status_code=401)
|
||||
else:
|
||||
logging.error("Unauthorized, Bearer token is not present in the request. Error code: 401.")
|
||||
return func.HttpResponse("Unauthorized, Bearer token is not present in the request.", status_code=401)
|
||||
else:
|
||||
logging.error("Unauthorized, Bearer token is not right. Error code: 401.")
|
||||
return func.HttpResponse("Unauthorized, Bearer token is not present in the request.", status_code=401)
|
||||
logging.error("HTTP method not supported. Error code: 405.")
|
||||
return func.HttpResponse("HTTP method not supported", status_code=405)
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "function",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
{
|
||||
"id": "TheHiveProjectTheHive",
|
||||
"title": "TheHive Project - TheHive",
|
||||
"publisher": "TheHive Project",
|
||||
"descriptionMarkdown": "The [TheHive](http://thehive-project.org/) data connector provides the capability to ingest common TheHive events into Azure Sentinel through Webhooks. TheHive can notify external system of modification events (case creation, alert update, task assignment) in real time. When a change occurs in the TheHive, an HTTPS POST request with event information is sent to a callback data connector URL. Refer to [Webhooks documentation](https://docs.thehive-project.org/thehive/legacy/thehive3/admin/webhooks/) for more information. The connector provides ability to get events which helps to examine potential security risks, analyze your team's use of collaboration, diagnose configuration problems and more.",
|
||||
"additionalRequirementBanner": ">This data connector depends on a parser based on a Kusto Function to work as expected [**TheHive**](https://aka.ms/sentinel-TheHive-parser) which is deployed with the Azure Sentinel Solution.",
|
||||
"graphQueries": [{
|
||||
"metricName": "Total data received",
|
||||
"legend": "TheHive_CL",
|
||||
"baseQuery": "TheHive_CL"
|
||||
}
|
||||
],
|
||||
"sampleQueries": [{
|
||||
"description": "TheHive Events - All Activities.",
|
||||
"query": "TheHive\n | sort by TimeGenerated desc"
|
||||
}
|
||||
],
|
||||
"dataTypes": [{
|
||||
"name": "TheHive_CL",
|
||||
"lastDataReceivedQuery": "TheHive_CL\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
|
||||
}
|
||||
],
|
||||
"connectivityCriterias": [{
|
||||
"type": "IsConnectedQuery",
|
||||
"value": [
|
||||
"TheHive_CL\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(30d)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"availability": {
|
||||
"status": 1,
|
||||
"isPreview": true
|
||||
},
|
||||
"permissions": {
|
||||
"resourceProvider": [{
|
||||
"provider": "Microsoft.OperationalInsights/workspaces",
|
||||
"permissionsDisplayText": "read and write permissions on the workspace are required.",
|
||||
"providerDisplayName": "Workspace",
|
||||
"scope": "Workspace",
|
||||
"requiredPermissions": {
|
||||
"write": true,
|
||||
"read": true,
|
||||
"delete": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"provider": "Microsoft.OperationalInsights/workspaces/sharedKeys",
|
||||
"permissionsDisplayText": "read permissions to shared keys for the workspace are required. [See the documentation to learn more about workspace keys](https://docs.microsoft.com/azure/azure-monitor/platform/agent-windows#obtain-workspace-id-and-key).",
|
||||
"providerDisplayName": "Keys",
|
||||
"scope": "Workspace",
|
||||
"requiredPermissions": {
|
||||
"action": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"customs": [{
|
||||
"name": "Microsoft.Web/sites permissions",
|
||||
"description": "Read and write permissions to Azure Functions to create a Function App is required. [See the documentation to learn more about Azure Functions](https://docs.microsoft.com/azure/azure-functions/)."
|
||||
},
|
||||
{
|
||||
"name": "Webhooks Credentials/permissions",
|
||||
"description": "**TheHiveBearerToken**, **Callback URL** are required for working Webhooks. See the documentation to learn more about [configuring Webhooks](https://docs.thehive-project.org/thehive/installation-and-configuration/configuration/webhooks/)."
|
||||
}
|
||||
]
|
||||
},
|
||||
"instructionSteps": [{
|
||||
"title": "",
|
||||
"description": ">**NOTE:** This data connector uses Azure Functions based on HTTP Trigger for waiting POST requests with logs to pull its logs into Azure Sentinel. This might result in additional data ingestion costs. Check the [Azure Functions pricing page](https://azure.microsoft.com/pricing/details/functions/) for details."
|
||||
},
|
||||
{
|
||||
"title": "",
|
||||
"description": ">**(Optional Step)** Securely store workspace and API authorization key(s) or token(s) in Azure Key Vault. Azure Key Vault provides a secure mechanism to store and retrieve key values. [Follow these instructions](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) to use Azure Key Vault with an Azure Function App."
|
||||
},
|
||||
{
|
||||
"description": ">**NOTE:** This data connector depends on a parser based on a Kusto Function to work as expected [**TheHive**](https://aka.ms/sentinel-TheHive-parser) which is deployed with the Azure Sentinel Solution."
|
||||
},
|
||||
{
|
||||
"title": "",
|
||||
"description": "**STEP 1 - Configuration steps for the TheHive**\n\n Follow the [instructions](https://docs.thehive-project.org/thehive/installation-and-configuration/configuration/webhooks/) to configure Webhooks.\n\n1. Authentication method is *Beared Auth*.\n2. Generate the **TheHiveBearerToken** according to your password policy.\n3. Setup Webhook notifications in the *application.conf* file including **TheHiveBearerToken** parameter."
|
||||
},
|
||||
{
|
||||
"title": "",
|
||||
"description": "**STEP 2 - Choose ONE from the following two deployment options to deploy the connector and the associated Azure Function**\n\n>**IMPORTANT:** Before deploying the TheHive data connector, have the Workspace ID and Workspace Primary Key (can be copied from the following).",
|
||||
"instructions": [{
|
||||
"parameters": {
|
||||
"fillWith": [
|
||||
"WorkspaceId"
|
||||
],
|
||||
"label": "Workspace ID"
|
||||
},
|
||||
"type": "CopyableLabel"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fillWith": [
|
||||
"PrimaryKey"
|
||||
],
|
||||
"label": "Primary Key"
|
||||
},
|
||||
"type": "CopyableLabel"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Option 1 - Azure Resource Manager (ARM) Template",
|
||||
"description": "Use this method for automated deployment of the TheHive data connector using an ARM Template.\n\n1. Click the **Deploy to Azure** button below. \n\n\t[![Deploy To Azure](https://aka.ms/deploytoazurebutton)](https://aka.ms/sentinel-TheHive-azuredeploy)\n2. Select the preferred **Subscription**, **Resource Group** and **Location**. \n> **NOTE:** Within the same resource group, you can't mix Windows and Linux apps in the same region. Select existing resource group without Windows apps in it or create new resource group.\n3. Enter the **TheHiveBearerToken** and deploy. \n4. Mark the checkbox labeled **I agree to the terms and conditions stated above**. \n5. Click **Purchase** to deploy.\n6. After deploying open Function App page, select your app, go to the **Functions** and click **Get Function Url** copy it and follow p.7 from STEP 1."
|
||||
},
|
||||
{
|
||||
"title": "Option 2 - Manual Deployment of Azure Functions",
|
||||
"description": "Use the following step-by-step instructions to deploy the TheHive data connector manually with Azure Functions (Deployment via Visual Studio Code)."
|
||||
},
|
||||
{
|
||||
"title": "",
|
||||
"description": "**1. Deploy a Function App**\n\n> **NOTE:** You will need to [prepare VS code](https://docs.microsoft.com/azure/azure-functions/functions-create-first-function-python#prerequisites) for Azure function development.\n\n1. Download the [Azure Function App](https://aka.ms/sentinel-TheHive-functionapp) file. Extract archive to your local development computer.\n2. Start VS Code. Choose File in the main menu and select Open Folder.\n3. Select the top level folder from extracted files.\n4. Choose the Azure icon in the Activity bar, then in the **Azure: Functions** area, choose the **Deploy to function app** button.\nIf you aren't already signed in, choose the Azure icon in the Activity bar, then in the **Azure: Functions** area, choose **Sign in to Azure**\nIf you're already signed in, go to the next step.\n5. Provide the following information at the prompts:\n\n\ta. **Select folder:** Choose a folder from your workspace or browse to one that contains your function app.\n\n\tb. **Select Subscription:** Choose the subscription to use.\n\n\tc. Select **Create new Function App in Azure** (Don't choose the Advanced option)\n\n\td. **Enter a globally unique name for the function app:** Type a name that is valid in a URL path. The name you type is validated to make sure that it's unique in Azure Functions. (e.g. TheHiveXXXXX).\n\n\te. **Select a runtime:** Choose Python 3.8.\n\n\tf. Select a location for new resources. For better performance and lower costs choose the same [region](https://azure.microsoft.com/regions/) where Azure Sentinel is located.\n\n6. Deployment will begin. A notification is displayed after your function app is created and the deployment package is applied.\n7. Go to Azure Portal for the Function App configuration."
|
||||
},
|
||||
{
|
||||
"title": "",
|
||||
"description": "**2. Configure the Function App**\n\n1. In the Function App, select the Function App Name and select **Configuration**.\n2. In the **Application settings** tab, select ** New application setting**.\n3. Add each of the following application settings individually, with their respective string values (case-sensitive): \n\t\tTheHiveBearerToken\n\t\tWorkspaceID\n\t\tWorkspaceKey\n\t\tlogAnalyticsUri (optional)\n> - Use logAnalyticsUri to override the log analytics API endpoint for dedicated cloud. For example, for public cloud, leave the value empty; for Azure GovUS cloud environment, specify the value in the following format: `https://<CustomerId>.ods.opinsights.azure.us`.\n4. Once all application settings have been entered, click **Save**."
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,194 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"FunctionName": {
|
||||
"defaultValue": "TheHive",
|
||||
"minLength": 1,
|
||||
"maxLength": 11,
|
||||
"type": "string"
|
||||
},
|
||||
"WorkspaceID": {
|
||||
"type": "string",
|
||||
"defaultValue": "<workspaceID>"
|
||||
},
|
||||
"WorkspaceKey": {
|
||||
"type": "securestring",
|
||||
"defaultValue": "<workspaceKey>"
|
||||
},
|
||||
"TheHiveBearerToken": {
|
||||
"type": "securestring",
|
||||
"defaultValue": "<TheHiveBearerToken>"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"FunctionName": "[concat(toLower(parameters('FunctionName')), uniqueString(resourceGroup().id))]",
|
||||
"StorageSuffix": "[environment().suffixes.storage]",
|
||||
"LogAnaltyicsUri": "[replace(environment().portal, 'https://portal', concat('https://', toLower(parameters('WorkspaceID')), '.ods.opinsights'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Insights/components",
|
||||
"apiVersion": "2015-05-01",
|
||||
"name": "[variables('FunctionName')]",
|
||||
"location": "[resourceGroup().location]",
|
||||
"kind": "web",
|
||||
"properties": {
|
||||
"Application_Type": "web",
|
||||
"ApplicationId": "[variables('FunctionName')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"apiVersion": "2019-06-01",
|
||||
"name": "[tolower(variables('FunctionName'))]",
|
||||
"location": "[resourceGroup().location]",
|
||||
"sku": {
|
||||
"name": "Standard_LRS",
|
||||
"tier": "Standard"
|
||||
},
|
||||
"kind": "StorageV2",
|
||||
"properties": {
|
||||
"networkAcls": {
|
||||
"bypass": "AzureServices",
|
||||
"virtualNetworkRules": [],
|
||||
"ipRules": [],
|
||||
"defaultAction": "Allow"
|
||||
},
|
||||
"supportsHttpsTrafficOnly": true,
|
||||
"encryption": {
|
||||
"services": {
|
||||
"file": {
|
||||
"keyType": "Account",
|
||||
"enabled": true
|
||||
},
|
||||
"blob": {
|
||||
"keyType": "Account",
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"keySource": "Microsoft.Storage"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts/blobServices",
|
||||
"apiVersion": "2019-06-01",
|
||||
"name": "[concat(variables('FunctionName'), '/default')]",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.Storage/storageAccounts', tolower(variables('FunctionName')))]"
|
||||
],
|
||||
"sku": {
|
||||
"name": "Standard_LRS",
|
||||
"tier": "Standard"
|
||||
},
|
||||
"properties": {
|
||||
"cors": {
|
||||
"corsRules": []
|
||||
},
|
||||
"deleteRetentionPolicy": {
|
||||
"enabled": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts/fileServices",
|
||||
"apiVersion": "2019-06-01",
|
||||
"name": "[concat(variables('FunctionName'), '/default')]",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.Storage/storageAccounts', tolower(variables('FunctionName')))]"
|
||||
],
|
||||
"sku": {
|
||||
"name": "Standard_LRS",
|
||||
"tier": "Standard"
|
||||
},
|
||||
"properties": {
|
||||
"cors": {
|
||||
"corsRules": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Web/sites",
|
||||
"apiVersion": "2018-11-01",
|
||||
"name": "[variables('FunctionName')]",
|
||||
"location": "[resourceGroup().location]",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.Storage/storageAccounts', tolower(variables('FunctionName')))]",
|
||||
"[resourceId('Microsoft.Insights/components', variables('FunctionName'))]"
|
||||
],
|
||||
"kind": "functionapp,linux",
|
||||
"identity": {
|
||||
"type": "SystemAssigned"
|
||||
},
|
||||
"properties": {
|
||||
"name": "[variables('FunctionName')]",
|
||||
"httpsOnly": true,
|
||||
"clientAffinityEnabled": true,
|
||||
"alwaysOn": true,
|
||||
"reserved": true,
|
||||
"siteConfig": {
|
||||
"linuxFxVersion": "python|3.8"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "2018-11-01",
|
||||
"type": "config",
|
||||
"name": "appsettings",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Web/sites/', variables('FunctionName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"FUNCTIONS_EXTENSION_VERSION": "~3",
|
||||
"FUNCTIONS_WORKER_RUNTIME": "python",
|
||||
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.insights/components', variables('FunctionName')), '2015-05-01').InstrumentationKey]",
|
||||
"APPLICATIONINSIGHTS_CONNECTION_STRING": "[reference(resourceId('microsoft.insights/components', variables('FunctionName')), '2015-05-01').ConnectionString]",
|
||||
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=', toLower(variables('FunctionName')),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', toLower(variables('FunctionName'))), '2019-06-01').keys[0].value, ';EndpointSuffix=',toLower(variables('StorageSuffix')))]",
|
||||
"logAnalyticsUri": "[variables('LogAnaltyicsUri')]",
|
||||
"WorkspaceID": "[parameters('WorkspaceID')]",
|
||||
"WorkspaceKey": "[parameters('WorkspaceKey')]",
|
||||
"TheHiveBearerToken": "[parameters('TheHiveBearerToken')]",
|
||||
"WEBSITE_RUN_FROM_PACKAGE": "https://github.com/averbn/azure_sentinel_data_connectors/raw/main/thehive-azure-sentinel-connector/TheHiveWebhooksSentinelConn.zip?raw=true"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
|
||||
"apiVersion": "2019-06-01",
|
||||
"name": "[concat(variables('FunctionName'), '/default/azure-webjobs-hosts')]",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', variables('FunctionName'), 'default')]",
|
||||
"[resourceId('Microsoft.Storage/storageAccounts', variables('FunctionName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"publicAccess": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
|
||||
"apiVersion": "2019-06-01",
|
||||
"name": "[concat(variables('FunctionName'), '/default/azure-webjobs-secrets')]",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', variables('FunctionName'), 'default')]",
|
||||
"[resourceId('Microsoft.Storage/storageAccounts', variables('FunctionName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"publicAccess": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
|
||||
"apiVersion": "2019-06-01",
|
||||
"name": "[concat(variables('FunctionName'), '/default/', tolower(variables('FunctionName')))]",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.Storage/storageAccounts/fileServices', variables('FunctionName'), 'default')]",
|
||||
"[resourceId('Microsoft.Storage/storageAccounts', variables('FunctionName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"shareQuota": 5120
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"version": "2.0",
|
||||
"logging": {
|
||||
"applicationInsights": {
|
||||
"samplingSettings": {
|
||||
"isEnabled": true,
|
||||
"excludedTypes": "Request"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extensionBundle": {
|
||||
"id": "Microsoft.Azure.Functions.ExtensionBundle",
|
||||
"version": "[1.*, 2.0.0)"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/proxies",
|
||||
"proxies": {}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
# DO NOT include azure-functions-worker in this file
|
||||
# The Python Worker is managed by Azure Functions platform
|
||||
# Manually managing azure-functions-worker may cause unexpected issues
|
||||
|
||||
azure-functions
|
||||
requests
|
|
@ -0,0 +1,82 @@
|
|||
// Usage Instruction :
|
||||
// Paste below query in log analytics, click on Save button and select as Function from drop down by specifying function name and alias (e.g. TheHive).
|
||||
// Function usually takes 10-15 minutes to activate. You can then use function alias from any other queries (e.g. TheHive | take 10).
|
||||
// References :
|
||||
// Using functions in Azure monitor log queries : https://docs.microsoft.com/azure/azure-monitor/log-query/functions
|
||||
// Tech Community Blog on KQL Functions : https://techcommunity.microsoft.com/t5/Azure-Sentinel/Using-KQL-functions-to-speed-up-analysis-in-Azure-Sentinel/ba-p/712381
|
||||
//
|
||||
let TheHive_view = view () {
|
||||
TheHive_CL
|
||||
| extend
|
||||
EventVendor="TheHive Project",
|
||||
EventProduct="TheHive",
|
||||
ObjectUpdatedBy=column_ifexists('object_updatedBy_s', ''),
|
||||
ObjectUpdatedAt=unixtime_milliseconds_todatetime(column_ifexists('object_updatedAt_d', '')),
|
||||
Operation=column_ifexists('operation_s', ''),
|
||||
ObjectType=column_ifexists('objectType_s', column_ifexists('object__type_s', '')),
|
||||
ObjectId=column_ifexists('objectId_s', column_ifexists('object_id_s', '')),
|
||||
StartDate=unixtime_milliseconds_todatetime(column_ifexists('startDate_d', '')),
|
||||
RequestId=column_ifexists('requestId_s', ''),
|
||||
DetailsDescription=column_ifexists('details_description_s', ''),
|
||||
DetailsFlag=column_ifexists('details_flag_b', ''),
|
||||
DetailsTitle=column_ifexists('details_title_s', ''),
|
||||
DetailsStatus=column_ifexists('details_status_s', ''),
|
||||
DetailsOwner=column_ifexists('details_owner_s', ''),
|
||||
DetailsCaseId=column_ifexists('details_caseId_d', ''),
|
||||
DetailsSeverity=column_ifexists('details_severity_d', ''),
|
||||
DetailsTlp=column_ifexists('details_tlp_d', ''),
|
||||
DetailsStartDate=unixtime_milliseconds_todatetime(column_ifexists('details_startDate_d', '')),
|
||||
DetailsTags=column_ifexists('details_tags_s', ''),
|
||||
Base=column_ifexists('base_b', ''),
|
||||
RootId=column_ifexists('rootId_s', ''),
|
||||
ObjectCreatedBy=column_ifexists('object_createdBy_s', ''),
|
||||
ObjectDescription=column_ifexists('object_description_s', ''),
|
||||
ObjectFlag=column_ifexists('object_flag_b', ''),
|
||||
ObjectUser=column_ifexists('object_user_s', ''),
|
||||
ObjectTitle=column_ifexists('object_title_s', ''),
|
||||
ObjectStatus=column_ifexists('object_status_s', ''),
|
||||
ObjectOwner=column_ifexists('object_owner_s', ''),
|
||||
ObjectCreatedAt=unixtime_milliseconds_todatetime(column_ifexists('object_createdAt_d', '')),
|
||||
ObjectCaseId=column_ifexists('object_caseId_d', ''),
|
||||
ObjectSeverity=column_ifexists('object_severity_d', ''),
|
||||
ObjectTlp=column_ifexists('object_tlp_d', ''),
|
||||
ObjectStartDate=unixtime_milliseconds_todatetime(column_ifexists('object_startDate_d', '')),
|
||||
ObjectTags=column_ifexists('object_tags_s', '')
|
||||
| project
|
||||
TimeGenerated,
|
||||
EventVendor,
|
||||
EventProduct,
|
||||
ObjectUpdatedBy,
|
||||
ObjectUpdatedAt,
|
||||
Operation,
|
||||
ObjectType,
|
||||
ObjectId,
|
||||
StartDate,
|
||||
RequestId,
|
||||
DetailsDescription,
|
||||
DetailsFlag,
|
||||
DetailsTitle,
|
||||
DetailsStatus,
|
||||
DetailsOwner,
|
||||
DetailsCaseId,
|
||||
DetailsSeverity,
|
||||
DetailsTlp,
|
||||
DetailsStartDate,
|
||||
DetailsTags,
|
||||
Base,
|
||||
RootId,
|
||||
ObjectCreatedBy,
|
||||
ObjectDescription,
|
||||
ObjectFlag,
|
||||
ObjectUser,
|
||||
ObjectTitle,
|
||||
ObjectStatus,
|
||||
ObjectOwner,
|
||||
ObjectCreatedAt,
|
||||
ObjectCaseId,
|
||||
ObjectSeverity,
|
||||
ObjectTlp,
|
||||
ObjectStartDate,
|
||||
ObjectTags
|
||||
};
|
||||
TheHive_view
|
Загрузка…
Ссылка в новой задаче