WSO2 IS:更改 HTTPS 证书

WSO2 IS: Change HTTPS certificate

我是 WSO2 配置方面的新手,也是 HTTPS 证书工作原理方面的新手,所以请多多包涵。

我正在尝试更改 WSO2 中 HTTPS 连接的证书。没有任何配置 WSO2 returns 具有 DN CN = localhost,O = WSO2,L = Mountain View,ST = CA,C = US 的证书。我正在尝试按照 this blog article.

中的说明使用我自己的证书更改此设置

我已经在密钥库中导入了我的证书,并按照文章中的描述更改了配置。一个显着的区别是我找不到 ${carbon.home}/repository/conf/mgt-transports.xml.

执行此操作后,连接到 IS 服务器管理服务会导致返回 "localhost" 证书,而不是导入的证书。

repository/conf/carbon.xml

中的 KeyStore 和 RegistryKeyStore 条目
   <KeyStore>                                                              
        <!-- Keystore file location-->                                      
        <Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location>
        <!-- Keystore type (JKS/PKCS12 etc.)-->                             
        <Type>JKS</Type>                                                    
        <!-- Keystore password-->                                           
        <Password>wso2carbon</Password>                                     
        <!-- Private Key alias-->                                           
        <KeyAlias>testcert</KeyAlias>                                       
        <!-- Private Key password-->                                        
        <KeyPassword>wso2carbon</KeyPassword>                               
    </KeyStore>                                                             

     <!--                                                                   
        Encrypt Decrypt Store will be used for encrypting and decrypting       
    -->                                                                     
    <RegistryKeyStore>                                                      
        <!-- Keystore file location-->                                      
        <Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location>
        <!-- Keystore type (JKS/PKCS12 etc.)-->                             
        <Type>JKS</Type>                                                    
        <!-- Keystore password-->                                           
        <Password>wso2carbon</Password>                                     
        <!-- Private Key alias-->                                           
        <KeyAlias>testcert</KeyAlias>                                       
        <!-- Private Key password-->                                        
        <KeyPassword>wso2carbon</KeyPassword>                               
    </RegistryKeyStore>

第 1 步:使用私钥和 public 密钥(密钥对)创建新的密钥库。 在 /repository/resources/security/ 目录中。默认密钥库(wso2carbon.jks)和信任库(客户端-truststore.jks)将存储在这里。

• 使用 java 密钥工具(包含在标准 jdk 中)创建包含密钥对的密钥库,并将其保存为 jks 文件。密钥库包含此服务器的密钥对(public 和私钥)。

• Keystore/Key-Pair 应具有以下 properties/attributes :

KeystoreType = JKS,
KeyPairAlgorithm = RSA,
Size = 2048 bits
SignatureAlgorithm = SHA-256 WITH RSA
Password    (Must be exactly the same as the keystore password)
Name(Subject):  The CN(Common Name) of the key-pair should be the server’s hostname upon which the IS will be deployed (if you intend to use it as the key manager for api manager)
Extensions:
Key usage : Digital Signature , Key Encipherment , Data Encipherment , on Repudian
Subject Alternate name : IP address = IP address of this server

第 2 步:将第 1 步中创建的密钥库中的证书链导入到信任库中。

创建具有相同属性的新信任库

• 将证书从密钥库(第 1 步)导出到信任库

第3步:如下更改配置文件,反映刚刚创建的新密钥库和信任库。

更改以下文件中的适当值(在 /repository/conf/ 中):

File                            Line number/s
identity.xml                    180
carbon.xml                      310
                                326
                                343
axis2/axis2_pt.xml              272
                                280
                                396
                                404
axis2/axis2.xml                 272
                                280
                                396
                                404
axis2/axis2_nhttp.xml           278
                                286
                                405
                                413
security/secret-conf.properties 21
                                30
sec.policy                      1

或多或少,只需在文件中搜索 "jks"

删除旧的密钥库

第四步:重启