{
    "name": "ThinkstCanary",
    "apiVersion": "2022-09-01-preview",
    "type": "Microsoft.SecurityInsights/dataConnectorDefinitions",
    "location": "{{location}}",
    "kind": "Customizable",
    "availability": {
        "isPreview": true,
        "status": 1
    },
    "properties": {
        "connectorUiConfig": {
            "id": "ThinkstCanary",
            "title": "Thinkst Canary",
            "publisher": "Thinkst Engineering",
            "descriptionMarkdown": "The Thinkst Canary connector allows you to ingest security incidents from your Thinkst Canary honeypot network into Microsoft Sentinel. Canary devices detect unauthorized access attempts including SSH logins, RDP sessions, HTTP requests, database queries, file share access, and Canarytoken triggers. This connector automatically pulls all incident data for analysis and alerting.",
            "graphQueriesTableName": "ThinkstCanaryIncidents_CL",
            "graphQueries": [
                {
                    "metricName": "Total incidents received",
                    "legend": "Thinkst Canary Incidents",
                    "baseQuery": "{{graphQueriesTableName}}"
                }
            ],
            "sampleQueries": [
                {
                    "description": "All Thinkst Canary incidents in the last 24 hours",
                    "query": "ThinkstCanaryIncidents_CL\n| where TimeGenerated > ago(24h)\n| order by TimeGenerated desc"
                },
                {
                    "description": "Top 10 source IPs triggering incidents",
                    "query": "ThinkstCanaryIncidents_CL\n| summarize IncidentCount = count() by SourceIP\n| where isnotempty(SourceIP)\n| top 10 by IncidentCount desc"
                },
                {
                    "description": "Incidents by type",
                    "query": "ThinkstCanaryIncidents_CL\n| summarize Count = count() by Description\n| order by Count desc"
                },
                {
                    "description": "Incidents with event detail data",
                    "query": "ThinkstCanaryIncidents_CL\n| where isnotempty(RawEvent)\n| project TimeGenerated, Description, SourceIP, DestinationIP, DestinationPort, RawEvent"
                },
                {
                    "description": "Incidents by flock",
                    "query": "ThinkstCanaryIncidents_CL\n| summarize Count = count() by FlockId\n| order by Count desc"
                }
            ],
            "dataTypes": [
                {
                    "name": "ThinkstCanaryIncidents_CL",
                    "lastDataReceivedQuery": "ThinkstCanaryIncidents_CL\n| summarize Time = max(TimeGenerated)\n| where isnotempty(Time)"
                }
            ],
            "connectivityCriteria": [
                {
                    "type": "HasDataConnectors"
                }
            ],
            "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": false
                        }
                    },
                    {
                        "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": "Thinkst Canary API Key",
                        "description": "A Thinkst Canary API authentication token is required. [See the documentation](https://docs.canary.tools/guide/user-settings.html#generating-an-api-key) to learn how to generate an API key."
                    }
                ]
            },
            "instructionSteps": [
                {
                    "title": "Connect Thinkst Canary to Microsoft Sentinel",
                    "description": "Provide your Thinkst Canary Console domain (e.g. 'yourhash' from yourhash.canary.tools) and API authentication token.",
                    "instructions": [
                        {
                            "type": "Textbox",
                            "parameters": {
                                "label": "Canary Console Domain",
                                "placeholder": "yourhash",
                                "type": "text",
                                "name": "clientId",
                                "validations": {
                                    "required": true
                                }
                            }
                        },
                        {
                            "type": "Textbox",
                            "parameters": {
                                "label": "API Authentication Token",
                                "placeholder": "Enter your Canary API token",
                                "type": "password",
                                "name": "clientSecret",
                                "validations": {
                                    "required": true
                                }
                            }
                        },
                        {
                            "type": "ConnectionToggleButton",
                            "parameters": {
                                "name": "toggle",
                                "connectLabel": "Connect",
                                "disconnectLabel": "Disconnect"
                            }
                        }
                    ]
                }
            ]
        }
    }
}
