Merge pull request #2417 from socprime/TenableNessus

TenableNessus: added io and sc dataconnectors, parser, data sample
This commit is contained in:
v-jayakal 2021-06-24 20:16:10 -07:00 коммит произвёл GitHub
Родитель 63c1bc73aa 2a4cdd7dc6
Коммит 40c429d5fe
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 1158 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,77 @@
{
"Name":"NessusVM_CL",
"Properties":[
{
"Name":"EventVendor",
"Type":"String"
},
{
"Name":"EventProduct",
"Type":"String"
},
{
"Name":"vulnerability_count_d",
"Type":"Double"
},
{
"Name":"type_s",
"Type":"String"
},
{
"Name":"host_mac_addr_s",
"Type":"String"
},
{
"Name":"host_operating_system_s",
"Type":"String"
},
{
"Name":"vulnerability_cpe_s",
"Type":"String"
},
{
"Name":"scan_name_s",
"Type":"String"
},
{
"Name":"scan_owner_s",
"Type":"String"
},
{
"Name":"scan_last_modification_date_d",
"Type":"Double"
},
{
"Name":"scan_creation_date_d",
"Type":"Double"
},
{
"Name":"host_start_time_s",
"Type":"String"
},
{
"Name":"host_end_time_s",
"Type":"String"
},
{
"Name":"host_fqdn_s",
"Type":"String"
},
{
"Name":"host_ip_addr_s",
"Type":"String"
},
{
"Name":"vulnerability_plugin_name_s",
"Type":"String"
},
{
"Name":"vulnerability_severity_d",
"Type":"Double"
},
{
"Name":"vulnerability_plugin_family_s",
"Type":"String"
}
]
}

Просмотреть файл

@ -0,0 +1,92 @@
[
{
"scan_name":"My Basic Network Scan",
"scan_owner":"nessus",
"scan_last_modification_date":1620734588,
"scan_creation_date":1620734155,
"host_start_time":"Tue May 11 14:55:57 2021",
"host_end_time":"Tue May 11 15:02:57 2021",
"host_mac_addr":"00:50:56:B4:6B:1D",
"host_fqdn":"srv-1.company.com",
"host_operating_system":"CentOS Linux 7 Linux Kernel 3.10",
"host_ip_addr":"10.112.15.144",
"vulnerability_plugin_name":"Service Detection",
"vulnerability_severity":0,
"vulnerability_cpe":"None",
"vulnerability_plugin_family":"Service detection",
"vulnerability_count": 1,
"type":"host_vulnerability_info"
},
{
"scan_name":"My Basic Network Scan",
"scan_owner":"nessus",
"scan_last_modification_date":1620734588,
"scan_creation_date":1620734155,
"host_start_time":"Tue May 11 14:55:57 2021",
"host_end_time":"Tue May 11 15:02:57 2021",
"host_mac_addr":"00:50:56:B4:6B:1D",
"host_fqdn":"srv-2.company.com",
"host_operating_system":"CentOS Linux 7 Linux Kernel 3.10",
"host_ip_addr":"10.111.15.144",
"vulnerability_plugin_name":"SSH Server CBC Mode Ciphers Enabled",
"vulnerability_severity":1,
"vulnerability_cpe":"None",
"vulnerability_plugin_family":"Misc.",
"vulnerability_count": 1,
"type":"host_vulnerability_info"
},
{
"scan_name":"My Basic Network Scan",
"scan_owner":"nessus",
"scan_last_modification_date":1620734588,
"scan_creation_date":1620734155,
"host_start_time":"Tue May 11 14:55:57 2021",
"host_end_time":"Tue May 11 15:02:57 2021",
"host_mac_addr":"00:50:56:B4:6B:1D",
"host_fqdn":"srv-3.company.com",
"host_operating_system":"CentOS Linux 7 Linux Kernel 3.10",
"host_ip_addr":"10.111.115.44",
"vulnerability_plugin_name":"SSL Certificate Cannot Be Trusted",
"vulnerability_severity":2,
"vulnerability_cpe":"None",
"vulnerability_plugin_family":"General",
"vulnerability_count": 1,
"type":"host_vulnerability_info"
},
{
"scan_name":"My Basic Network Scan",
"scan_owner":"nessus",
"scan_last_modification_date":1620734588,
"scan_creation_date":1620734155,
"host_start_time":"Tue May 11 14:55:57 2021",
"host_end_time":"Tue May 11 15:02:57 2021",
"host_mac_addr":"00:50:56:B4:6B:1D",
"host_fqdn":"srv-4.company.com",
"host_operating_system":"CentOS Linux 7 Linux Kernel 3.10",
"host_ip_addr":"10.111.115.144",
"vulnerability_plugin_name":"HSTS Missing From HTTPS Server (RFC 6797)",
"vulnerability_severity":2,
"vulnerability_cpe":"None",
"vulnerability_plugin_family":"Web Servers",
"vulnerability_count": 1,
"type":"host_vulnerability_info"
},
{
"scan_name":"My Host Discovery Scan",
"scan_owner":"nessus",
"scan_last_modification_date":1620734161,
"scan_creation_date":1620734116,
"host_start_time":"Tue May 11 14:55:16 2021",
"host_end_time":"Tue May 11 14:55:57 2021",
"host_mac_addr":"None",
"host_fqdn":"srv-5.company.com",
"host_operating_system":"None",
"host_ip_addr":"10.111.115.110",
"vulnerability_plugin_name":"Ping the remote host",
"vulnerability_severity":0,
"vulnerability_cpe":"None",
"vulnerability_plugin_family":"Port scanners",
"vulnerability_count": 1,
"type":"host_vulnerability_info"
}
]

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,180 @@
import requests
import json
import datetime
from requests.auth import HTTPBasicAuth
import azure.functions as func
import base64
import hmac
import hashlib
import os
import logging
from .state_manager import StateManager
import urllib3
import re
from requests.packages.urllib3.util.retry import Retry
customer_id = os.environ['WorkspaceID']
shared_key = os.environ['WorkspaceKey']
secretKey = os.environ['NessusSecretKey']
accessKey = os.environ['NessusAccessKey']
url = os.environ['NessusUrl']
connection_string = os.environ['AzureWebJobsStorage']
logAnalyticsUri = os.environ.get('logAnalyticsUri')
log_type = 'Nessus_VM'
headers = {"X-ApiKeys": "secretKey={}; accessKey={}".format(secretKey, accessKey)}
if url == "https://cloud.tenable.com":
verify = True
else:
verify = False
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
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("Invalid Log Analytics Uri.")
def generate_date():
current_time = datetime.datetime.utcnow().replace(second=0, microsecond=0)
state = StateManager(connection_string=connection_string)
past_time = state.get()
if past_time is not None:
logging.info("The last time point is: {}".format(past_time))
else:
logging.info("There is no last time point, trying to get scans information for last 24 hours.")
past_time = (current_time - datetime.timedelta(hours=24)).strftime("%s")
state.post(current_time.strftime("%s"))
return (past_time, current_time.strftime("%s"))
def get_query(sub_req, start_time):
retries = Retry(
total=3,
status_forcelist={429, 501, 502, 503, 504},
backoff_factor=1,
respect_retry_after_header=True
)
adapter = requests.adapters.HTTPAdapter(max_retries=retries)
session = requests.Session()
session.mount('https://', adapter)
if start_time is not None:
params = {"last_modification_date": start_time}
else:
params = {}
try:
r = session.get(url="{}/{}".format(url, sub_req),
headers=headers,
verify=verify,
params=params
)
if r.status_code == 200:
return r
elif r.status_code == 401:
logging.error("The authentication credentials are incorrect or missing. Error code: {}".format(r.status_code))
else:
logging.error("Something wrong. Error code: {}".format(r.status_code))
except Exception as err:
logging.error("Something wrong. Exception error text: {}".format(err))
def get_result(start_time):
scans_query = get_query("scans", start_time)
if scans_query is not None:
scans = scans_query.json().get("scans")
if scans is not None:
for scan in scans:
scan_result_events = []
logging.info("Getting information events from scan '{}'.".format(scan.get("name")))
get_scan_details_query = get_query("scans/{}".format(scan.get("id")), None)
if get_scan_details_query is not None:
hosts = get_scan_details_query.json().get("hosts")
for host in hosts:
get_host_details_query = get_query("scans/{}/hosts/{}".format(scan.get("id"), host.get("host_id")), None)
if get_host_details_query is not None:
host_details = get_host_details_query.json()
for vulnerability_detail in host_details.get("vulnerabilities"):
result_event = {
"scan_name": scan.get("name"),
"scan_owner": scan.get("owner"),
"scan_last_modification_date": scan.get("last_modification_date"),
"scan_creation_date": scan.get("creation_date"),
"host_start_time": (host_details.get("info")).get("host_start"),
"host_end_time": (host_details.get("info")).get("host_end"),
"host_mac_addr": (host_details.get("info")).get("mac-address"),
"host_fqdn": (host_details.get("info")).get("host-fqdn"),
"host_operating_system": (host_details.get("info")).get("operating-system"),
"host_ip_addr": (host_details.get("info")).get("host-ip"),
"vulnerability_plugin_name": vulnerability_detail.get("plugin_name"),
"vulnerability_severity": vulnerability_detail.get("severity"),
"vulnerability_cpe": vulnerability_detail.get("cpe"),
"vulnerability_count": vulnerability_detail.get("count"),
"vulnerability_plugin_family": vulnerability_detail.get("plugin_family"),
"type": "host_vulnerability_info"
}
scan_result_events.append(result_event)
for compliance_detail in host_details.get("compliance"):
result_event = {
"scan_name": scan.get("name"),
"scan_owner": scan.get("owner"),
"scan_last_modification_date": scan.get("last_modification_date"),
"scan_creation_date": scan.get("creation_date"),
"host_start_time": (host_details.get("info")).get("host_start"),
"host_end_time": (host_details.get("info")).get("host_end"),
"host_mac_addr": (host_details.get("info")).get("mac-address"),
"host_fqdn": (host_details.get("info")).get("host-fqdn"),
"host_operating_system": (host_details.get("info")).get("operating-system"),
"host_ip_addr": (host_details.get("info")).get("host-ip"),
"compliance_plugin_name": compliance_detail.get("plugin_name"),
"complince_severity": compliance_detail.get("severity"),
"compliance_count": vulnerability_detail.get("count"),
"compliance_plugin_family": compliance_detail.get("plugin_family"),
"type": "host_compliance_info"
}
scan_result_events.append(result_event)
if post_data(json.dumps(scan_result_events)) is not None:
logging.info("{} events from scan '{}' successfully processed to Azure".format(len(scan_result_events),scan.get("name")))
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(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):
return response.status_code
else:
logging.warn("Events are not processed into Azure. Response code: {}".format(response.status_code))
return None
def main(mytimer: func.TimerRequest) -> None:
if mytimer.past_due:
logging.info('The timer is past due!')
logging.info('Starting program')
start_time, end_time = generate_date()
logging.info("Time period parameters: from {} - to {}.".format(start_time,end_time))
get_result(start_time)

Просмотреть файл

@ -0,0 +1,11 @@
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "mytimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 0 * * * *"
}
]
}

Просмотреть файл

@ -0,0 +1,22 @@
from azure.storage.fileshare import ShareClient
from azure.storage.fileshare import ShareFileClient
from azure.core.exceptions import ResourceNotFoundError
class StateManager:
def __init__(self, connection_string, share_name='funcstatemarkershare', file_path='funcstatemarkerfile'):
self.share_cli = ShareClient.from_connection_string(conn_str=connection_string, share_name=share_name)
self.file_cli = ShareFileClient.from_connection_string(conn_str=connection_string, share_name=share_name, file_path=file_path)
def post(self, marker_text: str):
try:
self.file_cli.upload_file(marker_text)
except ResourceNotFoundError:
self.share_cli.create_share()
self.file_cli.upload_file(marker_text)
def get(self):
try:
return self.file_cli.download_file().readall().decode()
except ResourceNotFoundError:
return None

Просмотреть файл

@ -0,0 +1,129 @@
{
"id":"NessusVMAPI",
"title":"Tenable.io Vulnerability Management Reports",
"publisher":"Tenable",
"descriptionMarkdown":"The [Tenable.io Nessus Vulnerability Management](https://www.tenable.com/products/tenable-io) Report data connector provides the capability to ingest Scan reports events into Azure Sentinel through the REST API from the Tenable.io platform (Managed in the cloud). Refer to [API documentation](https://developer.tenable.com/reference) 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":"These queries and workbooks are dependent on a parser based on Kusto to work as expected. Follow the steps to use this Kusto functions alias **NessusVM** in queries and workbooks [Follow steps to get this Kusto functions>](https://aka.ms/NessusVM)",
"graphQueries":[
{
"metricName":"Total data received",
"legend":"Nessus_VM_CL",
"baseQuery":"Nessus_VM_CL"
}
],
"sampleQueries":[
{
"description":"Nessus VM Report Events - All Activities",
"query":"NessusVM\n | sort by TimeGenerated desc"
}
],
"dataTypes":[
{
"name":"Nessus_VM_CL",
"lastDataReceivedQuery":"Nessus_VM_CL\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
}
],
"connectivityCriterias":[
{
"type":"IsConnectedQuery",
"value":[
"Nessus_VM_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 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":"REST API Credentials/permissions",
"description":"**NessusSecretKey**, **NessusAccessKey** is required for REST API. [See the documentation to learn more about API](https://developer.tenable.com/reference#vulnerability-management). Check all [requirements and follow the instructions](https://docs.tenable.com/tenableio/vulnerabilitymanagement/Content/Settings/GenerateAPIKey.htm) for obtaining credentials."
}
]
},
"instructionSteps":[
{
"title":"",
"description":">**NOTE:** This connector uses Azure Functions to connect to the Tenable.io API 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. [Follow these steps](https://aka.ms/NessusVM) to create the Kusto functions alias, **NessusVM**"
},
{
"title":"",
"description":"**STEP 1 - Configuration steps for the Tenable.io Nessus VM**\n\n [Follow the instructions](https://docs.tenable.com/tenableio/vulnerabilitymanagement/Content/Settings/GenerateAPIKey.htm) to obtain the credentials. \n"
},
{
"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 Workspace 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 Tenable.io Nessus Vulnerability Management Report data connector using an ARM Tempate.\n\n1. Click the **Deploy to Azure** button below. \n\n\t[![Deploy To Azure](https://aka.ms/deploytoazurebutton)](https://aka.ms/sentinelnessusvmazuredeploy)\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 **NessusSecretKey**, **NessusAccessKey**, **NessusUrl** (https://cloud.tenable.com) and deploy. \n4. Mark the checkbox labeled **I agree to the terms and conditions stated above**. \n5. Click **Purchase** to deploy."
},
{
"title":"Option 2 - Manual Deployment of Azure Functions",
"description":"Use the following step-by-step instructions to deploy the Tenable.io Nessus Vulnerability Management Report 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://github.com/averbn/azure_sentinel_data_connectors/blob/main/nessus-vm-azure-sentinel-data-connector/NessusVMAPISentinelConn.zip?raw=true) 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. NessusVMXXXXX).\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\tNessusSecretKey\n\t\tNessusAccessKey\n\t\tNessusUrl\n\t\tWorkspaceID\n\t\tWorkspaceKey\n3. Once all application settings have been entered, click **Save**."
}
]
}

Просмотреть файл

@ -0,0 +1,129 @@
{
"id":"NessusVMAPI",
"title":"Tenable.sc Vulnerability Management Reports",
"publisher":"Tenable",
"descriptionMarkdown":"The [Tenable.sc Nessus Vulnerability Management](https://www.tenable.com/products/tenable-sc) Report data connector provides the capability to ingest Scan reports events into Azure Sentinel through the REST API from the Tenable.sc vulnerability management solution (Managed on-premises). Refer to [API documentation](https://developer.tenable.com/reference) 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":"These queries and workbooks are dependent on a parser based on Kusto to work as expected. Follow the steps to use this Kusto functions alias **NessusVM** in queries and workbooks [Follow steps to get this Kusto functions>](https://aka.ms/NessusVM)",
"graphQueries":[
{
"metricName":"Total data received",
"legend":"Nessus_VM_CL",
"baseQuery":"Nessus_VM_CL"
}
],
"sampleQueries":[
{
"description":"Nessus VM Report Events - All Activities",
"query":"NessusVM\n | sort by TimeGenerated desc"
}
],
"dataTypes":[
{
"name":"Nessus_VM_CL",
"lastDataReceivedQuery":"Nessus_VM_CL\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
}
],
"connectivityCriterias":[
{
"type":"IsConnectedQuery",
"value":[
"Nessus_VM_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 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":"REST API Credentials/permissions",
"description":"**NessusSecretKey**, **NessusAccessKey** is required for REST API. [See the documentation to learn more about API](https://<ConsoleIP>:8834/api#). Check all [requirements and follow the instructions](https://docs.tenable.com/tenablesc/Content/GenerateAPIKey.htm) for obtaining credentials."
}
]
},
"instructionSteps":[
{
"title":"",
"description":">**NOTE:** This connector uses Azure Functions to connect to the Tenable.sc API 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.\n\n This connector uses [Hybrid Connection](https://docs.microsoft.com/azure/app-service/app-service-hybrid-connections) for access to the on-premises system.\n\n In addition to there being an App Service plan SKU requirement, there is an additional cost to using Hybrid Connections. "
},
{
"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. [Follow these steps](https://aka.ms/NessusVM) to create the Kusto functions alias, **NessusVM**"
},
{
"title":"",
"description":"**STEP 1 - Configuration steps for the Tenable.sc Nessus VM**\n\n [Follow the instructions](https://docs.tenable.com/tenablesc/Content/GenerateAPIKey.htm) to obtain the credentials. \n"
},
{
"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 Workspace 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 Tenable.sc Nessus Vulnerability Management Report data connector using an ARM Tempate.\n\n1. Click the **Deploy to Azure** button below. \n\n\t[![Deploy To Azure](https://aka.ms/deploytoazurebutton)](https://aka.ms/sentinelnessusvmazuredeploy)\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 **NessusSecretKey**, **NessusAccessKey**, **NessusUrl** (https://NessusHost:8834) and deploy. \n> **NOTE:** The outbound TCP traffic from this data connector will be redirected through the Hybrid Connection using DNS request that matches a configured Hybrid Connection endpoint. This means that you should try to always use a DNS name for your Hybrid Connection. \n4. Configure Hybrid Connection for this Function App using right **NessusHost** alias. \n5. Mark the checkbox labeled **I agree to the terms and conditions stated above**. \n5. Click **Purchase** to deploy."
},
{
"title":"Option 2 - Manual Deployment of Azure Functions",
"description":"Use the following step-by-step instructions to deploy the Tenable.sc Nessus Vulnerability Management Report 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://github.com/averbn/azure_sentinel_data_connectors/blob/main/nessus-vm-azure-sentinel-data-connector/NessusVMAPISentinelConn.zip?raw=true) 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. NessusVMXXXXX).\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\tNessusSecretKey\n\t\tNessusAccessKey\n\t\tNessusUrl\n\t\tWorkspaceID\n\t\tWorkspaceKey\n3. Once all application settings have been entered, click **Save**."
}
]
}

Просмотреть файл

@ -0,0 +1,205 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"FunctionName": {
"defaultValue": "TenableIOVM",
"minLength": 1,
"maxLength": 11,
"type": "string"
},
"WorkspaceID": {
"type": "string",
"defaultValue": "<workspaceID>"
},
"WorkspaceKey": {
"type": "securestring",
"defaultValue": "<workspaceKey>"
},
"NessusSecretKey": {
"type": "securestring",
"defaultValue": "<NessusSecretKey>"
},
"NessusAccessKey": {
"type": "securestring",
"defaultValue": "<NessusAccessKey>"
},
"NessusUrl": {
"type": "string",
"defaultValue": "https://cloud.tenable.com"
}
},
"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')))]",
"WorkspaceID": "[parameters('WorkspaceID')]",
"WorkspaceKey": "[parameters('WorkspaceKey')]",
"NessusSecretKey": "[parameters('NessusSecretKey')]",
"NessusAccessKey": "[parameters('NessusAccessKey')]",
"NessusUrl": "[parameters('NessusUrl')]",
"logAnalyticsUri": "[variables('LogAnaltyicsUri')]",
"WEBSITE_RUN_FROM_PACKAGE": "https://github.com/averbn/azure_sentinel_data_connectors/blob/main/nessus-vm-azure-sentinel-data-connector/NessusVMAPISentinelConn.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,225 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"FunctionName": {
"defaultValue": "TenableSCVM",
"minLength": 1,
"maxLength": 11,
"type": "string"
},
"WorkspaceID": {
"type": "string",
"defaultValue": "<workspaceID>"
},
"WorkspaceKey": {
"type": "securestring",
"defaultValue": "<workspaceKey>"
},
"NessusSecretKey": {
"type": "securestring",
"defaultValue": "<NessusSecretKey>"
},
"NessusAccessKey": {
"type": "securestring",
"defaultValue": "<NessusAccessKey>"
},
"NessusUrl": {
"type": "string",
"defaultValue": "https://<NessusHostname>:8834"
}
},
"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'))]",
"hostingPlanName": "[concat('AppServicePlan-', parameters('FunctionName'))]"
},
"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]",
"kind": "functionapp,linux",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', tolower(variables('FunctionName')))]",
"[resourceId('Microsoft.Insights/components', variables('FunctionName'))]",
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]"
],
"identity": {
"type": "SystemAssigned"
},
"properties": {
"name": "[variables('FunctionName')]",
"httpsOnly": true,
"clientAffinityEnabled": true,
"alwaysOn": true,
"reserved": true,
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
"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')))]",
"WorkspaceID": "[parameters('WorkspaceID')]",
"WorkspaceKey": "[parameters('WorkspaceKey')]",
"NessusSecretKey": "[parameters('NessusSecretKey')]",
"NessusAccessKey": "[parameters('NessusAccessKey')]",
"NessusUrl": "[parameters('NessusUrl')]",
"logAnalyticsUri": "[variables('LogAnaltyicsUri')]",
"WEBSITE_RUN_FROM_PACKAGE": "https://github.com/averbn/azure_sentinel_data_connectors/blob/main/nessus-vm-azure-sentinel-data-connector/NessusVMAPISentinelConn.zip?raw=true"
}
}
]
},
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"name": "[variables('hostingPlanName')]",
"location": "[resourceGroup().location]",
"kind": "Linux",
"sku": {
"name": "S1",
"tier": "Standard",
"size": "S1",
"family": "S",
"capacity": 1
},
"properties": {
"reserved": 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,7 @@
# 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
azure-storage-file-share==12.3.0

Просмотреть файл

@ -0,0 +1,62 @@
// 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 as NessusVM.
// Function usually takes 10-15 minutes to activate. You can then use function alias from any other queries (e.g. NessusVM | take 10).
// Reference : Using functions in Azure monitor log queries : https://docs.microsoft.com/azure/azure-monitor/log-query/functions
let Nessus_VM_view = view () {
Nessus_VM_CL
| extend
EventVendor="Tenable",
EventProduct="Nessus VM",
EventType=column_ifexists('type_s', ''),
DvcMacAddr=column_ifexists('host_mac_addr_s', ''),
DvcOs=column_ifexists('host_operating_system_s', ''),
VulnerabilityCpe=column_ifexists('vulnerability_cpe_s', ''),
ScanName=column_ifexists('scan_name_s', ''),
ScanOwner=column_ifexists('scan_owner_s', ''),
ScanLastModificationDate = unixtime_seconds_todatetime(scan_last_modification_date_d),
ScanCreationDate=unixtime_seconds_todatetime(scan_creation_date_d),
HostStartTime=column_ifexists('host_start_time_s', ''),
HostEndTime=column_ifexists('host_end_time_s', ''),
DvcFqdn=column_ifexists('host_fqdn_s', ''),
DvcIpAddr=column_ifexists('host_ip_addr_s', ''),
VulnerabilityPluginName=column_ifexists('vulnerability_plugin_name_s', ''),
Severity=column_ifexists('vulnerability_severity_d', ''),
VulnerabilityPluginFamily=column_ifexists('vulnerability_plugin_family_s', ''),
VulnerabilityCount=column_ifexists('vulnerability_count_d', '')
| project
TimeGenerated,
EventVendor,
EventProduct,
EventType,
DvcMacAddr,
DvcOs,
VulnerabilityCpe,
ScanName,
ScanOwner,
ScanLastModificationDate,
ScanCreationDate,
HostStartTime,
HostEndTime,
DvcFqdn,
DvcIpAddr,
VulnerabilityPluginName,
Severity,
VulnerabilityPluginFamily,
VulnerabilityCount
};
Nessus_VM_view