Skip to main content

Suspicious login detection

Workflow preview

Workflow preview
100%
Suspicious login detection preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n workflow is designed for security monitoring and incident response when suspicious login events are detected. It can be initiated either manually from within the n8n UI for testing or auto...

Best for

  • SecOps automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.set, n8n-nodes-base.webhook, n8n-nodes-base.if, n8n-nodes-base.postgres, n8n-nodes-base.httprequest, n8n-nodes-base.merge, n8n-nodes-base.noop, n8n-nodes-base.html

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by n8n Team.

Original n8n.io source

1.1 Workflow description

Title
Suspicious login detection
Workflow name
Suspicious login detection

This n8n workflow is designed for security monitoring and incident response when suspicious login events are detected. It can be initiated either manually from within the n8n UI for testing or automatically triggered by a webhook when a new login event occurs.

The workflow first extracts relevant data from the incoming webhook payload, including the IP address, user agent, timestamp, URL, and user ID. It then splits into three parallel processing paths.

In the first path, it queries GreyNoise's Community API to retrieve information about the investigated IP address. Depending on the classification and trust level received from GreyNoise, the alert is given a High, Medium, or Low priority. This priority is assigned based on the best practices documentation from GreyNoise on how to apply their data to analysis. Once a priority is assigned, a message is sent to a Slack channel to notify users about the alert.

The second path involves fetching geolocation data about the IP address using IP-API's Geolocation API and merging it with data from the UserParser node. This data is then combined with the data obtained from GreyNoise.

In the third path, the UserParser node queries the Userparser IP address and user agent lookup API to obtain information about the user's IP and user agent. This data is merged with the IP-API data and GreyNoise data.

The workflow then checks if the IP address is considered an unknown threat by examining both the noise and riot fields from GreyNoise. If it is considered an unknown threat, the workflow proceeds to retrieve the last 10 login records for the same user from a Postgres database.

If there are any discrepancies in the login information, indicating a new location or device/browser, the user is informed via email.

Potential issues when setting up this workflow include ensuring that credentials are correctly entered for GreyNoise and UserParser nodes, and addressing any discrepancies in the data sources that could lead to false positives or negatives in threat detection. Additionally, the usage of hardcoded API keys should be replaced with credentials for security and flexibility. Thorough testing and validation with sample data are crucial to ensure the workflow performs as expected and aligns with security incident response procedures.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Extract relevant data

Type / Role
n8n-nodes-base.set - set
Config choices
Version 2

Block 2 - New /login event

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 1

Block 3 - Unknown threat?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 4 - Get last 10 logins from the same user

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.2

Block 5 - Query IP API1

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 6 - New location?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 7 - Parse User Agent

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 8 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 2.1

Block 9 - New Device/Browser?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 10 - Complete login info

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 2.1

Block 11 - Query user by ID

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.2

Block 12 - New Location

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 13 - New Device/Browser

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 14 - User has email?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 15 - HTML

Type / Role
n8n-nodes-base.html - html
Config choices
Version 1

Block 16 - Inform user

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2

Block 17 - noise?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 18 - Slack

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2

Block 19 - Check trust level

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 1

Block 20 - Check classification

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 1

Block 21 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 43 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Suspicious login detection
Complexity advanced
Nodes 43
Categories SecOps
Author n8n Team
Published 27 Nov 2023

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/1993/1993.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Suspicious login detection do?

This n8n workflow is designed for security monitoring and incident response when suspicious login events are detected. It can be initiated either manually from within the n8n UI for testing or auto...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your SecOps use case.