将 Atlassian Confluence Server 与 Google SecOps 集成

本文档介绍了如何将 Atlassian Confluence Server 与 Google Security Operations (Google SecOps) 集成。

前提条件

如需向 Confluence Server 进行身份验证,请选择以下任一选项:

  • 专用账号的用户名和密码。
  • 个人访问令牌 (PAT)。

如果为集成提供了这两种身份验证选项,则 PAT 优先于用户名和密码。

基于用户名和密码的身份验证需要创建将用于集成的专用账号。
基于访问令牌的身份验证需要配置账号权限。创建后,新的 PAT 将对应于账号的当前权限级别。

如需创建令牌,请按以下步骤操作:

  1. 在 Confluence 中,依次前往账号 > 账号设置 > 个人访问令牌。
  2. 选择创建令牌。
  3. 为要创建的令牌命名。
  4. (可选)为了提高安全性,您可以将令牌配置为在设定的天数后自动过期。
  5. 点击创建。

集成参数

集成需要以下参数:

参数名称 类型 默认值 为必填项 说明
API 根 字符串 https://ip_address 正确 指定要连接到的 Confluence Server API 根。
用户名 字符串 不适用 False 指定要用于连接的用户名。集成支持使用用户名 + 密码或个人访问令牌进行身份验证。
密码 密码 不适用 False 指定要用于连接的密码。集成支持使用用户名 + 密码或个人访问令牌进行身份验证。
个人访问令牌 密码 不适用 False 指定要用于连接的令牌。集成支持使用用户名 + 密码或个人访问令牌进行身份验证。
验证 SSL 复选框 已选中复选框 False 如果启用,系统会验证为 API 根配置的证书。

如需了解如何在 Google SecOps 中配置集成,请参阅配置集成。

如有需要,您可以在后续阶段进行更改。配置集成实例后,您可以在 playbook 中使用该实例。如需详细了解如何配置和支持多个实例,请参阅支持多个实例。

操作

如需详细了解操作,请参阅 在工作桌上响应待处理的操作和在案例中运行手动操作。

Ping

测试连接。

参数

不适用

运行时间

该操作未在实体上运行。

操作结果

脚本结果
脚本结果名称 值选项 示例
is_success True/False is_success:False

如果操作成功(响应中包含 JSON 且服务器响应为 200),则应将 is_success 设置为 True。否则,False。

案例墙
结果类型 值/说明 类型(实体/常规)
输出消息* 操作不应失败,也不应停止 playbook 执行:
  • 如果成功:
    print "Successfully connected to the Atlassian Confluence Server instance with the provided connection parameters!"
  • 如果同时提供了用户名和密码以及 PAT:
    “同时提供了用户名和密码以及个人访问令牌,将使用个人访问令牌进行连接”

操作应失败并停止 playbook 执行:
  • 如果(用户名 + 密码)和 PAT 均未提供:
    print "Failed to connect to Atlassian Confluence Server, expecting either username and password, or personal access token to connect with!"
  • 如果出现严重错误,例如凭据错误或连接中断:
    print "Failed to connect to the Atlassian Confluence Server instance! 错误为 {0}”。format(exception.stacktrace)
常规

列出页面

根据提供的条件,列出 Atlassian Confluence Server 实例中可用的页面。

参数

参数名称 类型 默认值 为必填项 说明
过滤键 DDL 选择一个

DDL 可能的值:
  • 标题
  • 聊天室名称
  • 状态
False 指定需要用于过滤页面的键。
过滤逻辑 DDL 未指定

DDL 可能的值:
  • 未指定
  • 等于
  • 包含
False 指定应应用哪种过滤逻辑。过滤逻辑会根据 Filter Key 参数中提供的值运行。
过滤值 字符串 不适用 False 指定应在过滤条件中使用哪个值。
如果选择 Equal,该操作会尝试在结果中查找完全匹配项。
如果选择 Contains,该操作会尝试查找包含该子字符串的结果。
如果此参数中未提供任何内容,则不会应用过滤条件。
过滤逻辑会根据 Filter Key 参数中提供的值运行。
返回的记录数上限 整数 50 False 指定要返回的记录数。
如果未提供任何内容,该操作将返回 50 条记录。

运行时间

该操作未在实体上运行。

操作结果

脚本结果
脚本结果名称 值选项 示例
is_success True/False is_success:False

如果操作成功运行(未返回任何错误,服务器响应为 200 OK),则应将 is_success 设置为 True。

JSON 结果
{
   "results": [
       {
           "id": "PAGE_ID",
           "type": "page",
           "status": "current",
           "title": "Tell people what you think in a comment (step 8 of 9)",
           "space": {
               "id": 131073,
               "key": "ds",
               "name": "Demonstration Space",
               "type": "global",
               "_links": {
                   "webui": "/display/ds",
                   "self": "http://192.0.2.45:8090/rest/api/space/ds"
               },
               "_expandable": {
                   "metadata": "",
                   "icon": "",
                   "description": "",
                   "retentionPolicy": "",
                   "homepage": "/rest/api/content/PAGE_ID"
               }
           },
           "extensions": {
               "position": 7
           },
           "_links": {
               "webui": "/pages/viewpage.action?pageId=PAGE_ID",
               "edit": "/pages/resumedraft.action?draftId=DRAFT_ID",
               "tinyui": "/x/AYAB",
               "self": "http://192.0.2.45:8090/rest/api/content/PAGE_ID"
           },
           "_expandable": {
               "container": "/rest/api/space/ds",
               "metadata": "",
               "operations": "",
               "children": "/rest/api/content/PAGE_ID/child",
               "restrictions": "/rest/api/content/PAGE_ID/restriction/byOperation",
               "history": "/rest/api/content/PAGE_ID/history",
               "ancestors": "",
               "body": "",
               "version": "",
               "descendants": "/rest/api/content/PAGE_ID/descendant"
           }
       },
       ...
   ],
   "start": 0,
   "limit": 5,
   "size": 5,
   "_links": {
       "self": "http://192.0.2.45:8090/rest/api/content?expand=space",
       "next": "/rest/api/content?expand=space&limit=5&start=5",
       "base": "http://192.0.2.45:8090",
       "context": ""
   }
}
案例墙
结果类型 值/说明 类型(实体/常规)
输出消息* 操作不应失败,也不应停止 playbook 执行:

  • 如果数据可用(is_success = true):
print "Successfully found pages for the provided criteria in Atlassian Confluence Server".

  • 如果数据不可用 (is_success=false)
print "No pages were found for the provided criteria in Atlassian Confluence Server"

  • 如果“过滤值”为空 (is_success=true):
由于“过滤条件值”参数的值为空,因此未应用过滤条件。

操作应失败并停止 playbook 执行:

  • 如果过滤键 ==“选择一个”且过滤逻辑为“等于”或“包含”:
执行操作“{action name}”时出错。原因:您需要从 Filter Key 参数中选择一个字段。

  • 如果为“要返回的记录数上限”提供了无效值:
执行操作“{action name}”时出错。原因:“为‘要返回的最大记录数’提供的值无效:<提供的值>。应提供正数”。

  • 如果发生严重错误,例如凭据错误、无法连接到服务器等:
“执行操作‘{action name}’时出错。原因:{0}''.format(error.Stacktrace)

  • 如果未提供用户名+密码和 PAT:
print "Failed to connect to Atlassian Confluence Server, expecting either username and password, or personal access token to connect with!"
常规
案例墙表格 名称:Available Confluence Pages
列:
  • ID
  • 标题
  • 空格
  • 状态
  • 创建时间
常规

按 ID 获取页面

按 ID 获取 Atlassian Confluence Server 页面。

参数

参数名称 类型 默认值 为必填项 说明
页面 ID 字符串 不适用 正确 指定要返回的页面 ID。
展开 CSV body.storage False 指定 expand 参数,以返回有关页面的其他信息。此参数接受多个值,以逗号分隔列表的形式提供。
默认情况下,系统会使用 body.storage 提取网页内容。

运行时间

该操作未在实体上运行。

操作结果

脚本结果
脚本结果名称 值选项 示例
is_success True/False is_success:False

如果操作成功运行(返回页面,服务器响应为 200 OK),则应将 is_success 设置为 True。

JSON 结果
{
   "id": "PAGE_ID",
   "type": "page",
   "status": "current",
   "title": "title",
   "body": {
       "storage": {
           "value": "<p>test page</p><p>11</p><p>aa</p><p>aa</p><p>aa</p><p><br /></p><p><br /></p>",
           "representation": "storage",
           "_expandable": {
               "content": "/rest/api/content/PAGE_ID"
           }
       },
       "_expandable": {
           "editor": "",
           "view": "",
           "export_view": "",
           "styled_view": "",
           "anonymous_export_view": ""
       }
   },
   "extensions": {
       "position": "none"
   },
   "_links": {
       "webui": "/display/SIEM/111",
       "edit": "/pages/resumedraft.action?draftId=PAGE_ID&draftShareId=cf8b3a21-8e36-4a83-a696-51fcb4428d1c",
       "tinyui": "/x/TIAB",
       "collection": "/rest/api/content",
       "base": "http://192.0.2.45:8090",
       "context": "",
       "self": "http://192.0.2.45:8090/rest/api/content/PAGE_ID"
   },
   "_expandable": {
       "container": "/rest/api/space/SIEM",
       "metadata": "",
       "operations": "",
       "children": "/rest/api/content/PAGE_ID/child",
       "restrictions": "/rest/api/content/PAGE_ID/restriction/byOperation",
       "history": "/rest/api/content/PAGE_ID/history",
       "ancestors": "",
       "version": "",
       "descendants": "/rest/api/content/PAGE_ID/descendant",
       "space": "/rest/api/space/SIEM"
   }
}
案例墙
结果类型 值/说明 类型(实体/常规)
输出消息* 操作不应失败,也不应停止 playbook 执行:

  • 如果找到网页 (is_success = true):
print "Successfully fetched page information with id: <id>"

  • 如果数据不可用 (is_success=false):
print "The following page id was not found in the Atlassian Confluence Server: <page id>"

该操作应失败并停止 playbook 执行:

  • 如果发生严重错误,例如凭据错误、无法连接到服务器等:
"Error executing action "<Action name>". Reason: {0}''.format(error.Stacktrace)

  • 如果未提供用户名 + 密码和 PAT:
print "Failed to connect to Atlassian Confluence Server, expecting either username and password, or personal access token to connect with!"
常规

获取子页面

获取 Atlassian Confluence Server 页面的子页面。

参数

参数名称 类型 默认值 为必填项 说明
页面 ID 字符串 不适用 正确 指定要返回的页面 ID。
要返回的记录数上限 整数 10 正确 指定要返回的子页面数量上限。

运行时间

该操作未在实体上运行。

操作结果

脚本结果
脚本结果名称 值选项 示例
is_success True/False is_success:False

如果操作成功运行(返回页面,服务器响应为 200 OK),则应将 is_success 设置为 True。

JSON 结果
{
   "results": [
       {
           "id": "PAGE_ID",
           "type": "page",
           "status": "current",
           "title": "test child page!",
           "extensions": {
               "position": "none"
           },
           "_links": {
               "webui": "/pages/viewpage.action?pageId=PAGE_ID",
               "edit": "/pages/resumedraft.action?draftId=PAGE_ID&draftShareId=799fd068-5053-4889-9120-c1a3c970fdbd",
               "tinyui": "/x/T4AB",
               "self": "http://192.0.2.45:8090/rest/api/content/PAGE_ID"
           },
           "_expandable": {
               "container": "/rest/api/space/SIEM",
               "metadata": "",
               "operations": "",
               "children": "/rest/api/content/PAGE_ID/child",
               "restrictions": "/rest/api/content/PAGE_ID/restriction/byOperation",
               "history": "/rest/api/content/PAGE_ID/history",
               "ancestors": "",
               "body": "",
               "version": "",
               "descendants": "/rest/api/content/PAGE_ID/descendant",
               "space": "/rest/api/space/SIEM"
           }
       }
   ],
   "start": 0,
   "limit": 1,
   "size": 1,
   "_links": {
       "self": "http://192.0.2.45:8090/rest/api/content/PAGE_ID/child/page",
       "base": "http://192.0.2.45:8090",
       "context": ""
   }
}
案例墙
结果类型 值/说明 类型(实体/常规)
输出消息* 操作不应失败,也不应停止 playbook 执行:

如果数据可用 (is_success = true):
输出“Successfully found child pages for the provided Atlassian Confluence Server page id: <page_id>”。

如果数据不可用 (is_success=false)
输出“No child pages were found for the provided Atlassian Confluence Server page id <page_id>”

操作应失败并停止 playbook 执行:

  • 如果为“要返回的记录数上限”提供了无效值:
执行操作“{action name}”时出错。原因:“为‘要返回的最大记录数’提供的值无效:<提供的值>。应提供正数”。

  • 如果发生严重错误,例如凭据错误、无法连接到服务器等:
“执行操作‘{action name}’时出错。Reason: {0}''.format(error.Stacktrace)
  • 如果未提供用户名 + 密码和 PAT:
print "Failed to connect to Atlassian Confluence Server, expecting either username and password, or personal access token to connect with!"
常规

获取页面评论

获取 Atlassian Confluence Server 页面中的评论。

参数

参数名称 类型 默认值 为必填项 说明
页面 ID 字符串 不适用 正确 指定要返回的页面 ID。
展开 CSV body.storage False 指定 expand 参数,以返回有关页面的其他信息。此参数接受多个值,以逗号分隔列表的形式提供。
默认情况下,系统会使用 body.storage 提取网页内容。
要返回的记录数上限 整数 10 正确 指定要返回的子页面数量上限。

运行时间

该操作未在实体上运行。

操作结果

脚本结果
脚本结果名称 值选项 示例
is_success True/False is_success:False

如果操作成功运行(返回评论,服务器响应为 200 OK),则 is_success 应设置为 True。

JSON 结果
{
   "results": [
       {
           "id": "ID",
           "type": "comment",
           "status": "current",
           "title": "Re: 111",
           "body": {
               "storage": {
                   "value": "<p>comment1</p>",
                   "representation": "storage",
                   "_expandable": {
                       "content": "/rest/api/content/ID"
                   }
               },
               "_expandable": {
                   "editor": "",
                   "view": "",
                   "export_view": "",
                   "styled_view": "",
                   "anonymous_export_view": ""
               }
           },
           "extensions": {
               "location": "footer",
               "_expandable": {
                   "resolution": ""
               }
           },
           "_links": {
               "webui": "/display/SIEM/111?focusedCommentId=98387#comment-ID",
               "self": "http://203.0.113.1:8090/rest/api/content/ID"
           },
           "_expandable": {
               "container": "/rest/api/content/ID",
               "metadata": "",
               "operations": "",
               "children": "/rest/api/content/ID/child",
               "restrictions": "/rest/api/content/ID/restriction/byOperation",
               "history": "/rest/api/content/ID/history",
               "ancestors": "",
               "version": "",
               "descendants": "/rest/api/content/ID/descendant",
               "space": "/rest/api/space/SIEM"
           }
       },
       ...
   ],
   "start": 0,
   "limit": 10,
   "size": 2,
   "_links": {
       "self": "http://203.0.113.1:8090/rest/api/content/ID/child/comment?expand=body.storage",
       "base": "http://203.0.113.1:8090",
       "context": ""
   }
}
案例墙
结果类型 值/说明 类型(实体/常规)
输出消息* 操作不应失败,也不应停止 playbook 执行:

  • 如果数据可用(is_success = true):
print "Successfully fetched page comments for the provided Atlassian Confluence Server page id: <page_id>".

  • 如果数据不可用 (is_success=false)
print "No page comments were found for the provided Atlassian Confluence Server page id <page_id>"

操作应失败并停止 playbook 执行:

  • 如果为“要返回的记录数上限”提供了无效值:
执行操作“{action name}”时出错。原因:“为‘要返回的最大记录数’提供的值无效:<提供的值>。应提供正数”。

  • 如果发生严重错误,例如凭据错误、无法连接到服务器等:
“执行操作‘{action name}’时出错。原因:{0}''.format(error.Stacktrace)

  • 如果未提供用户名 + 密码和 PAT:
print "Failed to connect to Atlassian Confluence Server, expecting either username and password, or personal access token to connect with!"
常规

需要更多帮助?获得社区成员和 Google SecOps 专业人士的解答。