8
n8n 中文网amn8n.com

使用Jamf补丁摘要监控软件合规性

中级

这是一个SecOps领域的自动化工作流,包含 15 个节点。主要使用 Set, Code, Slack, Filter, HttpRequest 等节点。 使用Jamf补丁摘要监控软件合规性

前置要求
  • Slack Bot Token 或 Webhook URL
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "94319767a20e644ffd5de1e0c40fb7012117450455597a81d94d975752474e8a",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "226fd53a-e08f-42f3-912f-4721aec86472",
      "name": "获取软件标题/ID",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        320,
        140
      ],
      "parameters": {
        "url": "=https://{{ $json.server }}.jamfcloud.com/api/v2/patch-software-title-configurations",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api"
      },
      "typeVersion": 4.2
    },
    {
      "id": "a4dea0cd-c994-46b0-87e3-3e4b1e5612c5",
      "name": "ID列表",
      "type": "n8n-nodes-base.filter",
      "position": [
        520,
        140
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "73ade79a-103b-412a-b2d4-0fd65fdabe76",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": "<software_id>"
            },
            {
              "id": "8c8cab85-59b3-4140-b446-2b9f9d5cd18f",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": "<software_id>"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "51e129c7-8d8e-4735-b400-7819b55dd97b",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "height": 320,
        "content": "## 设置"
      },
      "typeVersion": 1
    },
    {
      "id": "5ec83d8c-dedd-4368-856f-b98acb1ac256",
      "name": "Jamf服务器",
      "type": "n8n-nodes-base.set",
      "position": [
        60,
        140
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d5945b47-962f-4cea-8bb8-a8f61ee468ec",
              "name": "server",
              "type": "string",
              "value": "yourServer"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e3dce605-bd5f-4864-a827-3018a35834e0",
      "name": "获取补丁摘要:ID",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        740,
        140
      ],
      "parameters": {
        "url": "=https://{{ $('Jamf Server').item.json.server }}.jamfcloud.com/api/v2/patch-software-title-configurations/{{ $json.id }}/patch-summary",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api"
      },
      "typeVersion": 4.2
    },
    {
      "id": "d8741756-75e6-45fe-aac7-f1f463d56717",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        0
      ],
      "parameters": {
        "color": 3,
        "width": 220,
        "height": 320,
        "content": "## 获取"
      },
      "typeVersion": 1
    },
    {
      "id": "7abad52f-3f32-4e80-8c37-31d8817090dc",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 150,
        "height": 320,
        "content": "## 筛选"
      },
      "typeVersion": 1
    },
    {
      "id": "729f6733-0202-4f91-ad2a-285ca0f10b02",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 200,
        "height": 320,
        "content": "## 检索"
      },
      "typeVersion": 1
    },
    {
      "id": "2629706b-a122-42c7-adfa-3e8bb3baa5b6",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 180,
        "height": 320,
        "content": "## 格式化"
      },
      "typeVersion": 1
    },
    {
      "id": "66445f95-eaa1-4bec-b381-9a39ce72f13e",
      "name": "区块格式化",
      "type": "n8n-nodes-base.code",
      "position": [
        1140,
        140
      ],
      "parameters": {
        "jsCode": "// Get all input items\nconst inputItems = $input.all();\n\n// Initialize the Slack blocks array\nconst blocks = [\n  {\n    type: \"header\",\n    text: {\n      type: \"plain_text\",\n      text: \"📋 Patch Management Status\"\n    }\n  }\n];\n\n// Loop through each browser and create a section block\ninputItems.forEach(item => {\n  const browser = item.json;\n\n  blocks.push({\n    type: \"section\",\n    text: {\n      type: \"mrkdwn\",\n      text: `*${browser.Title}*\\n• Latest version: \\`${browser[\"Latest version\"]}\\`\\n• ✅ Up to date: *${browser[\"up To Date\"]}*\\n• ⚠️ Out of date: *${browser[\"out Of Date\"]}*\\n• 🔗 URL: ${browser[\"Jamf application url\"]}`\n    }\n  });\n\n  blocks.push({ type: \"divider\" });\n});\n\n// Remove last divider\nblocks.pop();\n\n// Return the blocks in a format usable by the next node \nreturn [\n  {\n    json: {\n      blocks\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "1000a5a8-b47b-4b70-8f3a-407fed69b638",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1300,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 200,
        "height": 320,
        "content": "## 发布"
      },
      "typeVersion": 1
    },
    {
      "id": "5c88acec-e5bc-46d2-932b-45f4ffa4a68d",
      "name": "点击",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -140,
        140
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "768eaad7-d0b9-4ff3-801e-d4e78142ab7a",
      "name": "手动字段映射",
      "type": "n8n-nodes-base.set",
      "position": [
        940,
        140
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "74db45cd-d40d-4b89-a820-24d3c2bb55a2",
              "name": "Title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "fe43cbfd-691e-465c-9403-473f99bdbb3c",
              "name": "Latest version",
              "type": "string",
              "value": "={{ $json.latestVersion }}"
            },
            {
              "id": "1153e83c-dad4-4f5a-9389-0b26f71bbace",
              "name": "up To Date",
              "type": "number",
              "value": "={{ $json.upToDate }}"
            },
            {
              "id": "7158cdf5-76d5-4cf9-b73c-ae7fcd061ee3",
              "name": "out Of Date",
              "type": "number",
              "value": "={{ $json.outOfDate }}"
            },
            {
              "id": "ee52008d-e0d0-403d-8ce2-cdfc3646a130",
              "name": "Jamf application url",
              "type": "string",
              "value": "=https://{{ $('Jamf Server').item.json.server }}.jamfcloud.com/view/computers/patch/{{ $json.softwareTitleId }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4c164dd2-ad19-4dc6-a4f2-e8c2e9fed712",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        900,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 180,
        "height": 320,
        "content": "## 选择"
      },
      "typeVersion": 1
    },
    {
      "id": "d59af125-d1f8-4570-a28b-1fa55c1e263f",
      "name": "Slack频道",
      "type": "n8n-nodes-base.slack",
      "position": [
        1360,
        140
      ],
      "webhookId": "42a6cd46-61c3-4124-93db-e136b717e700",
      "parameters": {
        "text": "=",
        "select": "channel",
        "blocksUi": "={{ '{ \"blocks\": [' + JSON.stringify($json.blocks).slice(1, -1) + '] }' }}",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": ""
        },
        "messageType": "block",
        "otherOptions": {
          "includeLinkToWorkflow": false
        }
      },
      "credentials": {
        "slackApi": {
          "id": "HunlY8HqfhPXu0oy",
          "name": ""
        }
      },
      "typeVersion": 2.3
    }
  ],
  "pinData": {},
  "connections": {
    "Click": {
      "main": [
        [
          {
            "node": "Jamf Server",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ID List": {
      "main": [
        [
          {
            "node": "Get Patch Summary:ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Jamf Server": {
      "main": [
        [
          {
            "node": "Get Software Title/ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Block Formatting": {
      "main": [
        [
          {
            "node": "Slack Channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Patch Summary:ID": {
      "main": [
        [
          {
            "node": "Manual Field Mapping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Field Mapping": {
      "main": [
        [
          {
            "node": "Block Formatting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Software Title/ID": {
      "main": [
        [
          {
            "node": "ID List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 安全运维

需要付费吗?

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

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

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

作者
外部链接
在 n8n.io 查看

分享此工作流