ITPub博客

首页 > 数据库 > > 管理Web证书-生成证书

管理Web证书-生成证书

作者:GaussDB_数据库 时间:2020-02-17 12:08:02 0 删除 编辑

前提条件

已安装Java。

操作步骤

执行以下步骤创建证书:

 说明:

DMCoreWebKeystore文件的名称应与下列步骤中保持一致。

  1. 打开DMServer证书文件夹。
    cd $DM_HOME/cert
  2. 创建证书文件夹。
  3. mkdir DMcert
    打开创建的证书文件夹。
  4. cd $DM_HOME/cert/DMcert
    执行以下命令创建一个keystore文件,包含待签名的秘钥对/证书:
  5. keytool -genkey -alias <alias name> -keyalg RSA -keystore "<keystore file name>" -dname "CN=client.com,OU=Client Company,O=Client,L=CLientLocation,ST=Client State,C=Client Country Short Code"
    例如:
    keytool -genkey -alias DMCoreWebKeystoreCRT -keyalg RSA -keystore "./DMCoreWebKeystore" -dname "CN=DMServer, OU=GAUSSTOOLS, O=HUAWEI, L=BLR, ST=KN, C=IN"

  6. 执行以下命令创建CSR文件:

    keytool -certreq -keyalg RSA -alias <alias name> -file <csr file name> -keystore <keystore file name>
    例如:
    keytool -certreq -keyalg RSA -alias DMCoreWebKeystoreCRT -file ./DMCoreWebKeystore.csr -keystore "./DMCoreWebKeystore"

  7. 创建一个扩展文件(DMCoreWebKeystore.ext),例如:

    subjectKeyIdentifier=hash
    authorityKeyIdentifier=keyid:always,issuer:always
    # This is what PKIX recommends but some broken software chokes on critical
    # extensions.
    basicConstraints = critical,CA:true
    # So we do this instead.
    basicConstraints = CA:true
    keyUsage = critical,cRLSign,keyCertSign,digitalSignature,keyAgreement,keyEncipherment
    crlDistributionPoints=URI:http://my.com/my.arl,URI:http://oth.com/my.arl
    subjectAltName=IP:10.xx.xx.xxx,DNS:dmserver
     说明:
    • subjectAltName是IP的替代名。
    • DNS值可以按实际需要修改。
    • IP是DMServer的IP地址。
    • 确保上面的数据内容正确,包括换行符,如下所示:
      subjectKeyIdentifier=hash
      authorityKeyIdentifier=keyid:always,issuer:always
      # This is what PKIX recommends but some broken software chokes on critical
      # extensions.
      basicConstraints = critical,CA:true
      # So we do this instead.
      basicConstraints = CA:true
      keyUsage = critical,cRLSign,keyCertSign,digitalSignature,keyAgreement,ketEncipherment
      subjectAltName=DNS:dmserver

  8. 上传CSR(DMCoreWebKeystore.csr)和扩展文件(DMCoreWebKeystore.ext)到CA网站,以便与DMServer信息一起进行签名。

     说明:
    • CA通过上述提供的CSR和扩展文件生成证书。
    • 关于如何生成自签名证书,请参见常见问题中的步骤15。

  9. 下载CA提供的根证书(rootCertificate.crt)、中间证书(CA1.crt)和服务器/域证书(DMCoreWebKeystore.crt)。

    例如:

    root    (issued by = issued to)   rootCertificate.crt
    |
    +---CA1 (issued by root = issued CA1) CA1.crt
    |
    +----DMServerCertificate (issued by CA1 = issued machine-name (com) or IPaddress (10.x.x.x) )
    (DMCoreWebKeystore.crt) where your web page access is https://com:9190/APW/
    https://10.x.x.x:9190/APW/
     说明:
    • 在上述示例中,只提供了一个中间证书(CA1)。如果有多个中间证书(CA1,CA2 ...),需下载所有中间证书。
    • 如果使用常见问题中的步骤15中的步骤创建了自签名证书,则系统还提供GaussToolsCA.pem和DMCoreWebKeystore.crt文件。GaussToolsCA.pem是根证书。

  10. 执行以下命令导入CA签发的根证书:

    keytool -import -alias <alias name> -keystore "<keystore file name>" -trustcacerts -file <root certificate>
    例如:
    keytool -import -alias GaussToolsCA -keystore "./
    DMCoreWebKeystore" -trustcacerts -file ./rootCertificate.crt

  11. 执行以下命令导入CA签发的中间证书:

    keytool -import -alias GaussToolsInternediateCA1 -keystore "<keystore file>" -trustcacerts -file <intermediate certificate>
    例如:
    keytool -import -alias GaussToolsInternediateCA1 -keystore "./DMCoreWebKeystore" -trustcacerts -file ./CA1.crt
     说明:

    如果有多个中间证书,执行上述命令逐个导入证书。

  12. 执行以下命令导入CA签发的服务器/域证书:

    keytool -import -alias DMCoreWebKeystoreCRT -keystore "<keystore file>" -trustcacerts -file <server/domain certificate>
    例如:
    keytool -import -alias DMCoreWebKeystoreCRT -keystore "./DMCoreWebKeystore" -trustcacerts -file ./DMCoreWebKeystore.crt

    有关证书安装的详细信息,请参见更新/替换证书。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69959250/viewspace-3120395/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2020-01-06

  • 博文量
    2907
  • 访问量
    19305