IBM WebSphere Liberty 使用 IHS 服务器证书问题

IBM WebSphere Liberty working with IHS Server Problems with Certificate(s)

我有一个 liberty 服务器和一个 IHS 服务器(都在不同的主机上)。这是在 rhel7.

我遵循了一些指南,我发现这些指南介绍了密钥库的设置和证书的共享,但仍然 运行 遇到问题。作为参考,我尝试了详细的方法https://jazz.net/wiki/bin/view/Deployment/CreateIHSPLUGINFORLIBERTYPROFILE and https://www.ibm.com/support/knowledgecenter/en/SSEQTJ_9.0.5/com.ibm.websphere.ihs.doc/ihs/tihs_install_config_liberty.html

快速总结我过去的尝试...在 liberty 服务器上,我将以下内容添加到我的 server.xml 以添加插件包含(使内容更易于阅读):

<include location="${server.config.dir}/plugin-join-include.xml" />

和插件-加入-include.xml:

        <featureManager>
                <feature>ssl-1.0</feature>
        </featureManager>

        <keyStore id="libertyKey" password="xxxx"
              location="${server.config.dir}/resources/security/libkey.jks"/>

        <pluginConfiguration webserverPort="10500" webserverSecurePort="10447"
                pluginInstallRoot="/opt/IBM/wasadmin/Plugins"
                sslKeyRingLocation="/opt/IBM/wasadmin/Plugins/config/webserver1/plugin-key.kdb"
                sslStashFileLocation="/opt/IBM/wasadmin/Plugins/config/webserver1/plugin-key.sth"
                sslCertlabel="libertyKey"/>

在我的 IHS 服务器上,插件根目录的路径如上文 /opt/IBM/wasadmin/Plugins 处的文件所示,插件-key.kdb 和插件-key.sth 位于上面列出的位置。

我重新启动了 liberty 服务器,它在 logs/state 目录中生成了插件-cfg.xml:

<?xml version="1.0" encoding="UTF-8"?><!--HTTP server plugin config file for app generated on 2020.03.04 at 12:32:02 UTC-->
<Config ASDisableNagle="false" AcceptAllContent="false" AppServerPortPreference="HostHeader" ChunkedResponse="false" ConfigHash="1077723051" FIPSEnable="false" IISDisableNagle="false" IISPluginPriority="High" IgnoreDNSFailures="false" RefreshInterval="60" ResponseChunkSize="64" SSLConsolidate="false" TrustedProxyEnable="false" VHostMatchingCompat="false">
   <Log LogLevel="Error" Name="/opt/IBM/wasadmin/Plugins/logs/webserver1/http_plugin.log"/>
   <Property Name="ESIEnable" Value="true"/>
   <Property Name="ESIMaxCacheSize" Value="1024"/>
   <Property Name="ESIInvalidationMonitor" Value="false"/>
   <Property Name="ESIEnableToPassCookies" Value="false"/>
   <Property Name="PluginInstallRoot" Value="/opt/IBM/wasadmin/Plugins"/>
<!-- Configuration generated using httpEndpointRef=defaultHttpEndpoint-->
<!-- The default_host contained only aliases for endpoint defaultHttpEndpoint.
         The generated VirtualHostGroup will contain only configured web server ports:
                webserverPort=10500
                webserverSecurePort=10447 -->
   <VirtualHostGroup Name="default_host">
      <VirtualHost Name="*:10500"/>
      <VirtualHost Name="*:10447"/>
   </VirtualHostGroup>
   <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="affms_default_node_Cluster" PostBufferSize="0" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60" ServerIOTimeoutRetry="-1">
      <Server CloneID="412b3187-16c4-41b0-86e8-1e327c1c6b1b" ConnectTimeout="5" ExtendedHandshake="false" LoadBalanceWeight="20" MaxConnections="-1" Name="default_node_affms" ServerIOTimeout="900" WaitForContinue="false">
         <Transport Hostname="libertyhost" Port="10500" Protocol="http"/>
         <Transport Hostname="libertyhost" Port="10447" Protocol="https">
            <Property Name="keyring" Value="/opt/IBM/wasadmin/Plugins/config/webserver1/plugin-key.kdb"/>
            <Property Name="stashfile" Value="/opt/IBM/wasadmin/Plugins/config/webserver1/plugin-key.sth"/>
            <Property Name="certLabel" Value="libertyKey"/>
         </Transport>
      </Server>
      <PrimaryServers>
         <Server Name="default_node_app"/>
      </PrimaryServers>
   </ServerCluster>
   <UriGroup Name="default_host_app_default_node_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/app/ui/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/adminCenter/*"/>
   </UriGroup>
   <Route ServerCluster="app_default_node_Cluster" UriGroup="default_host_app_default_node_Cluster_URIs" VirtualHostGroup="default_host"/>

我将插件-cfg.xml 复制到位于 /opt/IBM/wasadmin/Plugins/config/webserver1/plugin-cfg.xml

的 IHS 服务器

插件仅适用于 IHS 和应用服务器之间的 SSL 部分给我带来问题。

在 IHS 服务器上,我创建了带有存储插件的插件-key.kdb 密钥库-key.sth 并导入了我从自由服务器 /opt/IBM/wlp/usr/servers/app/resources/security/key.p12 中提取的默认个人证书证书并将其复制到 IHS 服务器并将默认的自由证书添加到插件-key.kdb 密钥库。

最下面的httpd.conf是:

LoadModule was_ap22_module /opt/IBM/wasadmin/Plugins/bin/64bits/mod_was_ap22_http.so
WebSpherePluginConfig /opt/IBM/wasadmin/Plugins/config/webserver1/plugin-cfg.xml

我反弹 apachectl 并转到 url 端口 8443 https://hostname:8443/app/ui 上的应用程序并收到“500 内部服务器错误”。

http_plugin.log 插件日志显示:

[04/Mar/2020:18:23:48.31652] 00002f26 3cff9700 - ERROR: lib_stream: openStream: Failed in r_gsk_secure_soc_init: GSK_ERROR_BAD_CERT(gsk rc = 414) PARTNER CERTIFICATE DN=CN=hostname,OU=app,O=ibm,C=us, Serial=xxxxxxxxxxx
[04/Mar/2020:18:23:48.31655] 00002f26 3cff9700 - ERROR: Ensure correct certificate is marked as default certificate in plugin-key.kdb.                           Consult documentation regarding Administering application security and Securing communications for more information.
[04/Mar/2020:18:23:48.31657] 00002f26 3cff9700 - ERROR: Last validation error [575010]: GSKVAL_ERROR_NO_CHAIN_BUILT
[04/Mar/2020:18:23:48.31658] 00002f26 3cff9700 - ERROR: Subject [[Class=]GSKVALMethod::PKIX[Issuer=]OU=memberRoot,O=xxxx-xxx-xxx-xxx-xxxxxxxx,DC=com.ibm.ws.collective[#=]082d6a83e5ec[Subject=]CN=hostname,OU=app,O=ibm,C=us] failed certificate validation
[04/Mar/2020:18:23:48.31659] 00002f26 3cff9700 - ERROR: X509 Certificate validation log: [[Class=]GSKVALMethod::PKIX[Time=]2020:3:4:18:23:48.316[buildChain=][Error=]GSKVAL_ERR_NO_CHAIN_BUILT[Info=]OU=memberRoot,O=xxx-xxx-xxx-xxx-xxx,DC=com.ibm.ws.collective[Cert=][Issuer=]OU=memberRoot,O=xxx-xxx-xxx-xxx-xxxx,DC=com.ibm.ws.collective[#=]082d6a83e5ec[Subject=]CN=hostname,OU=app,O=ibm,C=us[=Cert][=buildChain]^M
]
[04/Mar/2020:18:23:48.31664] 00002f26 3cff9700 - ERROR: ws_common: websphereGetStream: Could not open stream
[04/Mar/2020:18:23:48.31667] 00002f26 3cff9700 - ERROR: ws_common: websphereExecute: Failed to create the stream
[04/Mar/2020:18:23:48.31668] 00002f26 3cff9700 - ERROR: ws_common: websphereHandleRequest: Failed to execute the transaction to 'default_node_app' on host 'hostname:10447'; will try another one
[04/Mar/2020:18:23:48.31669] 00002f26 3cff9700 - ERROR: ws_common: websphereWriteRequestReadResponse: Failed to find an app server to handle this request
[04/Mar/2020:18:23:48.31670] 00002f26 3cff9700 - ERROR: ESI: getResponse: failed to get response: rc = 2
[04/Mar/2020:18:23:48.31671] 00002f26 3cff9700 - ERROR: [xxx.xx.xx.17://app/ui/] ws_common: websphereHandleRequest: Failed to handle request rc=2

谢谢!

你说 "imported" 我假设这意味着 "add" 在 ikeyman/gskcmd/gskcapicmd 中的操作?这些工具中的两个动词具有不同的含义。

我怀疑您添加了颁发的证书 (CN=hostname...) 而不是颁发证书的 CA (memberroot)。 WAS 插件消息中的调试信息暗示它无法将证书追踪到受信任的根目录(而不是在它有权访问的根目录中发现一些 X509 错误)。

但是,也可能是您使用 cn=memberroot 导入了 "wrong" 证书。 WebSphere 并不总是添加必要的 Subject Key Identifier/Authority Key Identifier 来确定,因此请仔细检查。

好的,我终于成功了。似乎有一个使用 DefaultKeyStore id 的集体设置以某种方式导致与我的 Liberty 插件密钥库发生冲突。

我最终重新创建了所有内容(插件-key.kdb 密钥库和我命名为 LibertyKeystore.jks 的自由插件密钥库)。我丢弃了集体的东西(无论如何此时不需要)并制作了一个名为 plugin-join-include.xml:

的包含
<?xml version="1.0" encoding="UTF-8" ?>
<server description="IHS plugin join include file">

        <featureManager>
                <feature>ssl-1.0</feature>
        </featureManager>

        <keyStore id="defaultKeyStore" password="password"
                location="${server.config.dir}/resources/security/LibertyKeystore.jks" />

        <pluginConfiguration webserverPort="80" webserverSecurePort="8443"
                pluginInstallRoot="/opt/IBM/wasadmin/Plugins"
                sslKeyRingLocation="/opt/IBM/wasadmin/Plugins/config/webserver1/plugin-key.kdb"
                sslStashFileLocation="/opt/IBM/wasadmin/Plugins/config/webserver1/plugin-key.sth"
                sslCertlabel="LibertyKeystore"/>

</server>

我在 liberty 服务器 LibertyKeystore.jks 和 IHS 插件-key.kdb 密钥库之间交换了密钥,并将新生成的插件推送到 IHS 服务器并反弹了所有内容,一切似乎都正常运行。

我现在在 /opt/IBM/wasadmin/HTTPServer/logs 错误日志流中注意到:

[Wed Mar 04 21:32:28 2020] [error] [client xxx.xx.xx.17:65261] [7ff5a0000910] [19831] SSL0279E: SSL Handshake Failed due to fatal alert from client. Client sent fatal alert [level 2 (fatal), description 46 (certificate_unknown)]  [xxx.xx.xx.17:65261 -> xxx.xx.xx.87:8443] [21:32:28.000934048] 0ms

访问日志显示 200。目前可能是非插件 "issue"。