如何在Denodo中为嵌入式tomcat启用HTTPS?

时间:2014-10-08 15:00:17

标签: tomcat https data-virtualization denodo

我想使用自签名证书为我所有传入的Denodo网络请求启用https。我该怎么做?

(Denodo安装了嵌入式JRE和Tomcat)

(我发布此问题并包含答案,希望其他人认为它有用)

1 个答案:

答案 0 :(得分:1)

使用自签名证书启用HTTPS包含几个步骤:

  1. 创建密钥对并将其添加到密钥库
  2. 从密钥库中的密钥对中提取证书
  3. 将证书添加到嵌入式JRE cacerts文件
  4. 配置Denodo Tomcat以使用密钥库和默认的cacerts文件
  5. 注意:如果你想使用你自己的信任库(而不是内置的cacerts),你可以这样做,你的步骤会略有不同,但总的想法是一样的。

    注意2:如果你想使用签名证书,那么相同的规则适用...你的步骤会略有不同但总体思路是一样的......(而不是将您的证书导入cacerts文件,您需要生成证书签名请求并获得签名)。

    步骤1:创建密钥对并将其添加到新密钥库

    在您的denodo服务器上运行以下命令:

    $ /lclapps/denodo/jre/bin/keytool -genkey -alias nvdrdenodo2 -keyalg RSA -keystore 
    
    ~/command_line.keystore`enter code here`
    Enter keystore password:
    Re-enter new password:
    What is your first and last name?
      [Unknown]:  first_last
    What is the name of your organizational unit?
      [Unknown]:  Technology
    What is the name of your organization?
      [Unknown]:  My OU
    What is the name of your City or Locality?
      [Unknown]:  San Francisco
    What is the name of your State or Province?
      [Unknown]:  CA
    What is the two-letter country code for this unit?
      [Unknown]:  US
    Is CN=first_last, OU=Technology, O=My OU, L=San Francisco, ST=CA, C=US correct?
      [no]:  yes
    Enter key password for <nvdrdenodo2>
            (RETURN if same as keystore password):
    

    必须确保密钥对密码与密钥库密码相同。记住密码: - )

    步骤2:将您的密钥提取为PEM格式的证书

    运行以下命令,并确保包含您在步骤1中使用的密码。

    /lclapps/denodo/jre/bin/keytool -exportcert -alias nvdrdenodo2 -keystore ~/command_line.keystore -storepass MyPassword -rfc -file ~/nvdrdenodo2.cer
    

    步骤3:将.cer文件导入嵌入式JRE的cacerts文件

    /lclapps/denodo/jre/bin/keytool -import -alias nvdrdenodo2 -keystore /lclapps/denodo/jre/lib/security/cacerts -file ~/nvdrdenodo2.cer
    Enter keystore password:
    Owner: CN=first_last, OU=Technology, O=My OU, L=San Francisco, ST=CA, C=US
    Issuer: CN=first_last, OU=Technology, O=My OU, L=San Francisco, ST=CA, C=US
    Serial number: 54341d2a
    Valid from: Tue Oct 07 11:04:42 MDT 2014 until: Mon Jan 05 10:04:42 MST 2015
    Certificate fingerprints:
             MD5:  3A:9F:37:16:3F:17:9B:BF:3A:95:CE:2C:ED:8A:FF:22
             SHA1: 6A:9E:75:68:7A:33:2C:F9:E3:11:01:CC:2E:7B:00:4C:B8:D2:E6:AF
             Signature algorithm name: SHA1withRSA
             Version: 3
    Trust this certificate? [no]:  yes
    Certificate was added to keystore
    Certificate stored in file </home/user_account/nvdrdenodo2.cer>
    

    第4步:更新$ DENODO_HOME / resources / apache-tomcat / conf / tomcat.properties文件

    我们现在配置tomcat以利用我们的密钥库并将信任库行注释掉,因为默认情况下它将使用嵌入式JRE cacerts文件。

    vi /lclapps/denodo/resources/apache-tomcat/conf/tomcat.properties
    
    com.denodo.tomcat.home=/lclapps/denodo-5.0/resources/apache-tomcat
    com.denodo.tomcat.http.port=9090
    com.denodo.tomcat.shutdown.port=9099
    com.denodo.tomcat.jmx.port=9098
    com.denodo.tomcat.engine.name=DenodoPlatform-5.0
    com.denodo.tomcat.export.dirname=export
    com.denodo.tomcat.http.log=true
    com.denodo.tomcat.https.enable=true
    com.denodo.tomcat.https.port=9443
    com.denodo.security.ssl.enabled=true
    com.denodo.security.ssl.keyStore=/home/user_account/command_line.keystore
    com.denodo.security.ssl.keyStorePassword=password
    #com.denodo.security.ssl.trustStore=
    #com.denodo.security.ssl.trustStorePassword=
    java.env.DENODO_OPTS_START=-Xmx2056m -XX\:MaxPermSize\=256m
    

    重新启动并测试

    重新启动Denodo,转到https://yourserver:9443/denodo-restfulws/admin,查看它是否有效(或转到已发布的网络服务的任何网址)。您应该收到证书错误:

    Cert error

    添加例外,您现在通过HTTPS使用自己的证书访问Denodo Tomcat!