8
n8n 中文网amn8n.com

SSL/TLS证书到期监控与Slack告警

中级

这是一个SecOps领域的自动化工作流,包含 7 个节点。主要使用 If, Code, Slack, HttpRequest, ScheduleTrigger 等节点。 带Slack告警的SSL/TLS证书到期监控

前置要求
  • Slack Bot Token 或 Webhook URL
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "N8lYj0OOkpuJcota",
  "meta": {
    "instanceId": "a287613f1596da776459594685fbf4e2b4a12124f80ab8c8772f5e37bff103ae",
    "templateCredsSetupCompleted": true
  },
  "name": "SSL/TLS 证书到期监控与 Slack 告警",
  "tags": [],
  "nodes": [
    {
      "id": "6123946e-b16c-46e4-9fba-3d923a607289",
      "name": "定时触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -224,
        -16
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "977d3ca9-ed8e-42d0-98c4-5bbbf40a7e7d",
      "name": "监控域名列表",
      "type": "n8n-nodes-base.code",
      "position": [
        0,
        -16
      ],
      "parameters": {
        "jsCode": "const domainsToMonitor = [\n    \"your-company.com\",\n    \"mail.your-company.com\",\n    \"api.your-company.com\"\n];\n\nreturn domainsToMonitor.map(domain => ({ json: { domain } }));"
      },
      "typeVersion": 2
    },
    {
      "id": "200ddf00-400e-478c-9380-06c416bc154b",
      "name": "检查证书到期时间",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        -16
      ],
      "parameters": {
        "url": "=https://api.certspotter.com/v1/certinfo?domain={{ $json.domain }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "060cb358-a136-4653-b82b-1546ae87351b",
      "name": "证书即将到期?",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        -16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a73d70ba-5324-4964-8212-46c32caa4750",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ new Date($json.result.expires) }}",
              "rightValue": "={{ new Date(Date.now() + 30 * 24 * 60 * 60 * 1000) }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a71bec8f-aa12-4eed-b67f-b28a94577f30",
      "name": "YOUR_SECURITY_ALERT_CHANNEL_ID",
      "type": "n8n-nodes-base.slack",
      "position": [
        672,
        -16
      ],
      "webhookId": "977718e1-8480-48f0-a6f8-238371e66fa4",
      "parameters": {
        "text": "=🚨 *URGENT: SSL Certificate Expiry Alert!* 🚨\n\nDomain: *{{ $json.domain }}*\nExpires on: *{{ new Date($json.result.expires).toLocaleDateString() }}*\n\nPlease renew this certificate immediately to avoid downtime!",
        "user": {
          "__rl": true,
          "mode": "id",
          "value": "123123"
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "AFKF0YsguyhsagR0",
          "name": "temp"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "eb0a1434-9d97-4744-8a60-61debe8ea595",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -64
      ],
      "parameters": {
        "color": 3,
        "width": 1184,
        "height": 240,
        "content": "## 流程"
      },
      "typeVersion": 1
    },
    {
      "id": "2a070150-1bef-4e3c-aac5-093b9804f224",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        208
      ],
      "parameters": {
        "color": 5,
        "width": 1184,
        "height": 1184,
        "content": "### 💡 SSL/TLS 证书到期监控 🗓️"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b8997d0d-d03b-424e-baeb-cda8afc9dd4c",
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "List Domains to Monitor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Domains to Monitor": {
      "main": [
        [
          {
            "node": "Check Certificate Expiry",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Certificate Expiry": {
      "main": [
        [
          {
            "node": "Is Certificate Expiring?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Certificate Expiring?": {
      "main": [
        [
          {
            "node": "YOUR_SECURITY_ALERT_CHANNEL_ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 安全运维

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量7
分类1
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Marth

Marth

@marth

Simplifying Business with Smart Automation. I create and share user-friendly, highly efficient n8n workflow templates for SMEs, focusing on digital marketing, sales, and operational excellence. Get ready to automate, innovate, and elevate your business. Connect me on Linkedin for custom solutions.

外部链接
在 n8n.io 查看

分享此工作流