【问题标题】:Apache Tomcat/7.0.35 SSL Certificate InstallApache Tomcat/7.0.35 SSL 证书安装
【发布时间】:2016-12-24 03:02:57
【问题描述】:

我的任务是在 Apache Tomcat 服务器(版本 7.0.35)上安装 SSL 证书。这不是我以前有过的经验,所以希望得到一点指导!我在网上找到的注释似乎只涵盖新安装。

查看server.xml 文件,我可以看到那里有现有的 SSL 证书以及密钥库配置。

server.xml 中已经存在一些 SSL 证书时,谁能告诉我生成和添加新 SSL 证书的过程是什么?例如,我需要删除现有实例还是可以只添加一个新实例,是否需要对密钥库文件进行进一步更改?

【问题讨论】:

    标签: java apache tomcat ssl encryption


    【解决方案1】:
    Go to bin folder in server
    Run the command 
    keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
    
    then
    
    keytool -list -keystore keystore.jks
    
    
    In conf\server.xml edit it as
    
    //...
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
            This connector uses the JSSE configuration, when using APR, the
            connector should be using the OpenSSL style configuration
            described in the APR documentation -->
    
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
                  maxThreads="150" scheme="https" secure="true"
                  clientAuth="false" sslProtocol="TLS"
               keystoreFile="my key store file path"
               keystorePass="password" />
     //...
    

    keystorePass="password" 是您通过“keytool”命令分配给密钥库的密码。

    然后点击网址https://localhost:8443/

    【讨论】:

    • 感谢您的回复 Abhijit,我将如何添加已以 .pfx 格式提供的证书。这可能吗?
    • 是的,它可能,这对你有用,那么请给我打勾......只需使用扩展名作为 .pfx 而不是 .jks
    • 感谢您解释 Abhijit。
    【解决方案2】:
    1. 将 SSL 证书添加到密钥库 $openssl pkcs12 -export -out biosit.pfx -inkey biosit.ebsafrica.com.key -in biosit.ebsafrica.com.cer
    2. 确认证书已成功添加到密钥库 $keytool -list -keystoreEquitybio.pfx -v
    3. 将 keystoreFile 路径添加到 server.xml 并指定 keystorePass
    4. 在 web.xml 中取消注释
    5. 重启tomcat
    6. 将您的浏览器网址从 http 更改为 https
    7. 您现在安全了

    参考:https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/

    【讨论】:

      猜你喜欢
      • 2017-03-05
      • 1970-01-01
      • 2014-06-26
      • 1970-01-01
      • 2015-09-30
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      • 2016-08-30
      相关资源
      最近更新 更多