手动获取服务器注册先决条件

您可以获取注册服务器和手动设置安全性监视所需的先决条件。 启用使用计量功能所需的信息包括 WebSphere Automation 中的使用计量URL、API密钥和使用计量证书。

准备工作

要在 WebSphere Automation 中利用使用情况测量服务注册应用程序服务器,必须在每个应用程序服务器中配置使用情况测量功能。 使用情况测量功能在以下 WebSphere® Application Server 修订包和 Liberty 版本中可用。 如果应用程序服务器位于较旧的修订包或版本上,那么无法向 WebSphere Automation注册这些修订包或版本。
  • WebSphere Application Server (所有版本) 8.5.5.15 和更高版本
  • WebSphere Application Server (所有版本) 9.0.0.9 和更高版本
  • Liberty (所有版本) 18.0.0.3 和更高版本
重要信息: 使用情况测量功能是 WebSphere Application ServerWebSphere Application Server Liberty 的受支持稳定组件,用于 WebSphere Automation。 它先前与 IBM Cloud Private 中现在已移除的测量服务一起使用。 功能部件的稳定化将取代 WebSphere Application ServerWebSphere Application Server Liberty的文档中对其不推荐使用的任何提及。

关于本任务

要在每个应用程序服务器中配置使用率测量功能,必须获取以下使用率测量项。 在 注册服务器 对话框中提供了这些项的示例代码片段。 要查看,请从 " 服务器管理 " 页面单击 注册服务器 。 生成示例代码的副本,并根据需要针对您的环境进行调整。 有关注册 WebSphere Application ServerWebSphere Application Server Liberty 服务器的指示信息详细说明了如何使用这些项。
URL
使用计量URL 为 WebSphere Automation 。 此服务向 WebSphere Automation 注册 WebSphere Application Server 服务器和 Liberty 服务器,以便您可以跟踪安全漏洞。
API 密钥
用于在注册过程中认证 WebSphere Application Server 服务器和 Liberty 服务器的令牌。
使用情况计量证书
包含公用密钥的证书。 此密钥允许向 WebSphere Automation 注册的应用程序服务器与测量服务进行 SSL 握手。

您在 WebSphere Automation 注册使用计量服务时,为所有应用服务器URL、API密钥和使用计量证书都是相同的。 应用程序服务器可以是 WebSphere Application Server 服务器或 Liberty 服务器。 因此,如果您先前已获取 URL、API 密钥和证书,并且目前仍然具有这些信息,那么无需再次获取它们。

使用以下任一方法来获取 WebSphere Application Server 服务器和 Liberty 服务器的 URL 和 API 密钥。 另外,请使用任一方法来获取 Liberty 服务器的使用情况测量证书。

要获取 WebSphere Application Server 服务器的使用情况测量证书,请使用特定于 WebSphere Application Server 的命令。

Draft comment: jantley@us.ibm.com
See also https://github.ibm.com/websphere/automation-doc/issues/794

过程

  1. 获取使用URL。
    您可以使用 Red Hat OpenShift CLI 客户机或管理控制台。
    • 通过 Red Hat OpenShift CLI 客户机获取 URL。
      • 使用 oc 命令获取 URL,并将其保存到 url.txt 文件。

        name_space 变量设置为安装了 WebSphere Automation 的名称空间。

        对于 UNIX 操作系统,请运行以下命令。

        oc get route cpd -n name_space -o jsonpath=https://{.spec.host}/websphereauto/meteringapi > url.txt && cat url.txt

        对于 Windows 操作系统,请运行以下命令。

        oc get route cpd -n name_space -o jsonpath=https://{.spec.host}/websphereauto/meteringapi > url.txt && type url.txt

        url.txt 文件将保存到运行该命令的同一目录中。 但是,您可以选择另一文件名和目录。 在某些情况下,您可以手动指定已保存的 URL,以便可以为应用程序服务器配置使用率测量服务。

    • Red Hat OpenShift 管理控制台获取 URL。
      1. Red Hat OpenShift 管理控制台上,单击安装的操作符
      2. 项目菜单中,选择安装 WebSphere Automation 实例的名称空间。
      3. 选择 WebSphere Automation 运算符。
      4. 选择“WebSphereSecure 实例”选项卡。
      5. 选择实例。
      6. IBM 自动化 UI 字段复制主机名,并将 https://hostname/websphereauto/meteringapi URL 中的 hostname 变量替换为该变量。
      7. 将 URL 保存至文件(例如,url.txt 文件)。

        选择文件名和目录。 在某些情况下,您可以手动指定 URL,以便您可以使用 WebSphere Automation 中的使用情况测量服务来配置应用程序服务器。

  2. 获取 API 密钥。
    您可以使用 Red Hat OpenShift CLI 客户机或管理控制台。
    • 使用 Red Hat OpenShift CLI 客户机获取 API 密钥。
      1. name_space 变量设置为安装了 WebSphere Automation 的名称空间。 在下一个命令中使用最终获得的实例名称来获取 API 密钥。

        对于 UNIX 操作系统,请运行以下命令。

        oc get WebSphereSecure -n name_space -o jsonpath='{.items[?(@.kind=="WebSphereSecure")].metadata.name}'

        对于 Windows 操作系统,请运行以下命令。

        oc get WebSphereSecure -n name_space -o jsonpath={.items[?(@.kind=='WebSphereSecure')].metadata.name}
      2. 使用 oc 命令获取 API 密钥,并将其保存到 api-key.txt 文件。

        instance_name 变量替换为从前一个命令获得的实例名称。 该变量位于下列命令中的两个位置。

        对于 UNIX 操作系统,请运行以下命令。

        oc -n name_space get secret instance_name-metering-apis-encrypted-tokens -o jsonpath='{.data.'instance_name'-metering-apis-sa}' | base64 -d > api-key.txt && cat api-key.txt

        对于 Windows 操作系统,请运行以下命令。

        oc -n name_space get secret instance_name-metering-apis-encrypted-tokens -o jsonpath={.data.instance_name-metering-apis-sa} > temp.txt && type temp.txt

        对于 Windows 操作系统,请使用 Base64 解码来对 API 密钥进行解码。

        certutil -decode temp.txt api-key.txt && type api-key.txt

        api-key.txt 文件将保存到运行该命令的同一目录中。 但是,您可以选择另一文件名和目录。 在某些情况下,您可以手动指定已保存的 API 密钥,以便可以为应用程序服务器配置使用率测量服务。

    • Red Hat OpenShift 管理控制台获取 API 密钥。
      1. 在管理控制 Red Hat OpenShift 台上,单击工作负载 > 机密
      2. 在项目菜单中选择安装 WebSphere Automation 实例的命名空间。
      3. 请搜索 metering-apis-encrypted-tokens 字段,然后单击该私钥。
      4. 单击显示值并复制 API 键。
      5. 将 API 密钥保存至文件(例如,api-key.txt 文件)。

        选择文件名和目录。 在某些情况下,您可以手动指定 API 密钥,以便您可以使用 WebSphere Automation 中的使用情况测量服务来配置应用程序服务器。

        注: 以纯文本格式存储 API 密钥并不是安全问题。 该密钥仅允许访问使用率测量 API ,并且仅用于注册服务器。 使用情况测量 API 不会将任何信息返回给调用者。
  3. 获取使用率测量证书。
    您可以使用 Red Hat OpenShift CLI 客户机或管理控制台。
    注: 使用率测量证书的有效期为 90 天。 证书到期时,必须将其替换。
    • 使用 Red Hat OpenShift CLI 客户机获取使用情况测量证书。
      • 运行下列其中一个 oc 命令以获取使用率测量证书。

        将使用情况测量证书保存至 metering_certificate_file.pem 文件。

        name_space 变量设置为安装了 WebSphere Automation 的名称空间。

        对于操作系统 UNIX ,当配置自定义证书时,请运行以下命令:

        oc get secret wsa-external-tls-secret -n name_space -o jsonpath='{.data.cert\.crt}' | base64 -d > metering_certificate_file.pem && cat metering_certificate_file.pem

        否则,对于使用缺省证书时的 UNIX 操作系统,请运行以下命令:

        oc get secret wsa-default-external-tls-secret -n name_space -o jsonpath='{.data.cert\.crt}' | base64 -d > metering_certificate_file.pem && cat metering_certificate_file.pem

        对于操作系统 Windows ,当配置自定义证书时,请运行以下命令:

        oc get secret wsa-external-tls-secret -n name_space -o jsonpath='{.data.cert\.crt}' | base64 -d > cert.txt

        否则,对于使用缺省证书时的 Windows 操作系统,请运行以下命令:

        oc get secret wsa-default-external-tls-secret -n name_space -o jsonpath='{.data.cert\.crt}' | base64 -d > cert.txt

        对于 Windows 操作系统,请使用 Base64 解码来对证书进行解码。

        certutil -decode cert.txt usagemeteringcert.pem && type usagemeteringcert.pem

        usagemeteringcert.pem 文件将保存到运行该命令的同一目录中。 您可以选择文件名和目录。 在某些情况下,您可以手动指定已保存的使用率测量证书,以便可以为应用程序服务器配置使用率测量服务。

    • Red Hat OpenShift 管理控制台获取使用情况测量证书。
      1. 在控制 Red Hat OpenShift 台上,单击工作负载 > 机密
      2. 选择创建 WebSphere Automation 实例的项目。
      3. 搜索external-tls-secret秘密(如果配置了自定义证书)或wsa-default-external-tls-secret(如果配置了默认证书),然后单击它。
      4. 单击 显示值,然后复制证书。
      5. 将证书内容保存到文件中,如 metering_certificate_file.pem 文件。 选择文件名和该文件的目录。 在某些情况下,您可以手动指定已保存的使用率测量证书,以便可以为应用程序服务器配置使用率测量服务。

下一步操作

通过 WebSphere Automation 注册 WebSphere Application Server 服务器。

Liberty 服务器注册到 WebSphere Automation.