【问题标题】:client-certificate authentication on jetty (karaf)码头(karaf)上的客户端证书身份验证
【发布时间】:2015-06-18 07:17:42
【问题描述】:

我需要使用码头服务器上的证书进行客户端身份验证。

我已经在 Tomcat 上使用:

<Connector
           protocol="org.apache.coyote.http11.Http11Protocol"
           port="8443" maxThreads="200"
           minSpareThreads="5" 
           enableLookups="true" disableUploadTimeout="true"
           acceptCount="100"
           scheme="https" secure="true" SSLEnabled="true"
           keystoreFile="D:\certificates\certs\server.jks" keystoreType="JKS" keystorePass="password"
           truststoreFile="D:\certificates\certs\trust_store.jks" truststoreType="JKS" truststorePass="password"
           clientAuth="true"
           sslProtocol="TLS"/>

但我想在 karaf 上做,所以我知道我可以通过在 jetty.xml 上添加以下内容来做到这一点:

<Call name="addConnector">
 <Arg>
   <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
     <Arg>
       <New class="org.eclipse.jetty.http.ssl.SslContextFactory">
         <Set name="KeyStore">./etc/keystores/server.jks</Set>
         <Set name="KeyStorePassword">password</Set>
         <Set name="KeyManagerPassword">password</Set>
         <Set name="TrustStore">./etc/keystores/trust_store.jks</Set>
         <Set name="TrustStorePassword">password</Set>
       </New>
     </Arg>
     <Set name="port">8443</Set>
     <Set name="maxIdleTime">30000</Set>
   </New>
 </Arg>

并关注 org.ops4j.pax.web.xml :

org.osgi.service.http.port=8181
org.osgi.service.http.port.secure=8443
org.osgi.service.http.secure.enabled=true
org.ops4j.pax.web.ssl.keystore=./etc/keystores/keystore.jks
org.ops4j.pax.web.ssl.password=password
org.ops4j.pax.web.ssl.keypassword=password
#org.ops4j.pax.web.ssl.clientauthwanted=false
org.ops4j.pax.web.ssl.clientauthneeded=true

但它不适用于 karaf,它不要求客户证书。它仅适用于使用 server-cert-authentication 的 https。

我错过了什么?

【问题讨论】:

    标签: java authentication ssl jetty apache-karaf


    【解决方案1】:

    需要进行 2 处更改:

    1. 将 org.ops4j.pax.web.xml 文件重命名为 org.ops4j.pax.web.cfg
    2. 在 org.ops4j.pax.web.cfg 中添加了org.ops4j.pax.web.config.file=./etc/jetty.xml

    【讨论】:

    • 是否需要 org.ops4j.pax.web.ssl.clientauthneeded=true 从客户端请求证书? (2 路 SSL)谢谢
    猜你喜欢
    • 2011-04-09
    • 2013-10-07
    • 1970-01-01
    • 2022-06-23
    • 2018-02-12
    • 2012-09-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    相关资源
    最近更新 更多