通过 EST 使用 OpenXPKI 证书颁发机构管理证书

本节将帮助用户使用 EST 协议配置 OpenXPKI CA 3.x.x 版本。

注意:

配置 OpenXPKI CA

安装 OpenXPKI CA

  1. 使用 PuTTY 或其他客户端来连接机器。

  2. 从客户端,运行 sudo su - 命令以转到 root 用户。

  3. 输入 root 用户密码。

  4. nano /etc/apt/sources.list 中,更改用于安装更新的来源。

  5. 更新该文件。例如:

    # # deb cdrom:[Debian GNU/Linux testing _Buster_ - Official Snapshot amd64 DVD Binary-1 20190527-04:04]/ buster contrib main # deb cdrom:[Debian GNU/Linux testing _Buster_ - Official Snapshot amd64 DVD Binary-1 20190527-04:04]/ buster contrib main deb http://security.debian.org/debian-security buster/updates main contrib deb-src http://security.debian.org/debian-security buster/updates main contrib # buster-updates, previously known as 'volatile' # A network mirror was not selected during install.The following entries # are provided as examples, but you should amend them as appropriate # for your mirror of choice.# deb http://ftp.debian.org/debian/ buster-updates main deb-src http://ftp.debian.org/debian/ buster-updates main deb http://ftp.us.debian.org/debian/ buster main
  6. 保存该文件。

  7. 运行以下命令:

    • apt-get update

    • apt-get upgrade

  8. 更新服务器中的 CA 证书列表,使用 apt-get install ca-certificates 命令。

  9. 安装 en_US.utf8 locale ,使用 dpkg-reconfigure locales 命令。

  10. 选择 en_US.UTF-8 UTF-8 locale,然后将其设为系统的默认 locale。

    注意:  使用 Tab 键和空格键来选择和导览菜单。
  11. 检查您使用 locale -a 生成的 locale。

    示例输出
    C C.UTF-8 en_IN en_IN.utf8 en_US.utf8 POSIX
  12. 复制 OpenXPKI 软件包的指纹,使用 nano /home/Release.key 命令。在此例中,复制 /home 中的键。

  13. 键入 55D89776 006F632B E0196E3E D2495509 BAFDDC74 22FEAAD2 F055074E 0FE3A724 作为值。

  14. 运行以下命令:

    gpg --print-md sha256 /home/Release.key

  15. 使用 wget https://packages.openxpki.org/v3/debian/Release.key -O - | apt-key add - 命令添加软件包。

  16. 使用 echo " deb http://packages.openxpki.org/v3/debian/ buster release" > /etc/apt/sources.list.d/openxpki.list apt update 命令将存储库添加到来源列表 (buster) 中。

  17. 使用 apt install mariadb-server libdbd-mariadb-perl 命令安装 MySQL 和 Perl MySQL 绑定。

  18. 使用 apt install apache2 命令安装 apache2.2-common。

  19. nano /etc/apt/sources.list 中,安装 fastcgi 模块来加速用户界面。

    注意:  建议使用 mod_fcgid
  20. 在该文件中添加 deb http://http.us.debian.org/debian/ buster main 行,然后保存该文件。

  21. 运行以下命令:

    apt-get update

    apt install libapache2-mod-fcgid

  22. 使用 a2enmod fcgid 命令启用 fastcgi 模块。

  23. 使用 apt install libopenxpki-perl openxpki-cgi-session-driver openxpki-i18n 命令安装 OpenXPKI 核心软件包。

  24. 重新启动 Apache 服务器,使用 service apache2 restart 命令。

  25. 使用 openxpkiadm version 命令检查是否安装成功。

    注意:  如果安装成功,则系统会显示所安装的 OpenXPKI 版本。例如, Version (core): 3.18.2
  26. 创建空数据库,然后使用 mariadb -u root -p 命令分配数据库用户。

    注意:

    • 必须在客户端中键入此命令。否则,您无法输入密码。
    • 键入 MySQL 的密码。在此例中, root 是 MySQL 用户。
    • openxpki 是安装 OpenXPKI 的用户。
    CREATE DATABASE openxpki CHARSET utf8; CREATE USER 'openxpki'@'localhost' IDENTIFIED BY 'openxpki'; GRANT ALL ON openxpki.* TO 'openxpki'@'localhost'; flush privileges;

    如果 MySQL 服务没有运行,则运行 /etc/init.d/mysql start 来启动该服务。

  27. 键入 quit 以退出 MySQL。

  28. 将所使用的凭证存储在 /etc/openxpki/config.d/system/database.yaml 中。

    示例文件内容
    main: debug: 0 type: MariaDB name: openxpki host: localhost port: 3306 user: openxpki passwd: openxpki
    注意:  更改 user passwd 以匹配 MariaDB 用户名和密码。
  29. 保存该文件。

  30. 对于空数据库模式,请从提供的模式文件中运行 zcat /usr/share/doc/libopenxpki-perl/examples/schema-mariadb.sql.gz | \ mysql -u root --password --database openxpki

  31. 键入数据库的密码。

使用默认脚本配置 OpenXPKI CA

注意:  默认脚本仅配置默认领域 ca-one 。未配置 CDP 和 CRL。
  1. 使用 bash /usr/share/doc/libopenxpki-perl/examples/sampleconfig.sh 命令运行该脚本。

  2. 使用 openxpkiadm alias --realm democa 命令确认设置。

    示例输出
    === functional token === scep (scep): Alias : scep-1 Identifier: YsBNZ7JYTbx89F_-Z4jn_RPFFWo NotBefore : 2015-01-30 20:44:40 NotAfter : 2016-01-30 20:44:40 vault (datasafe): Alias : vault-1 Identifier: lZILS1l6Km5aIGS6pA7P7azAJic NotBefore : 2015-01-30 20:44:40 NotAfter : 2016-01-30 20:44:40 ca-signer (certsign): Alias : ca-signer-1 Identifier: Sw_IY7AdoGUp28F_cFEdhbtI9pE NotBefore : 2015-01-30 20:44:40 NotAfter : 2018-01-29 20:44:40 === root ca === current root ca: Alias : root-1 Identifier: fVrqJAlpotPaisOAsnxa9cglXCc NotBefore : 2015-01-30 20:44:39 NotAfter : 2020-01-30 20:44:39 upcoming root ca: not set
  3. 使用 openxpkictl start 命令检查是否安装成功。

    示例输出
    Starting OpenXPKI... OpenXPKI Server is running and accepting requests. DONE.
  4. 执行以下操作以访问 OpenXPKI 服务器:

    1. 从 Web 浏览器,键入 http://ipaddress/openxpki/

    2. userdb.yaml 文件中添加用户名及其对应的密码。要添加用户名和密码,请执行以下操作:

      • 查看 /home/pkiadm ,然后查看 nano userdb.yaml

      • 粘贴以下内容:

        estRA: digest:"{ssha256}somePassword” role: RA Operator
        注意:  在此例中,estRA 指的是用户名。要生成密码,请键入 openxpkiadm hashpwd 。当出现用于询问密码和 ssha256 加密密码的消息时,将其复制并粘贴到任何用户的摘要中。
      注意:  “操作员”登录中可用的角色为“RA 操作员”、“CA 操作员”和“用户”。
  5. 输入用户名和密码。

  6. 创建一个证书请求,然后进行测试。

手动配置 OpenXPKI CA

概述

注意:  在开始之前,请确保您具备有关创建 OpenSSL 证书的基本知识。

要手动配置 OpenXPKI CA,请创建以下内容:

  1. 根 CA 证书。如需更多信息,请参阅 创建根 CA 证书

  2. CA 签名者证书(由根 CA 签名的证书)。如需更多信息,请参阅 创建签名者证书

  3. 保管库证书(自签名证书)。如需更多信息,请参阅 创建保管库证书

  4. Web 证书(通过签名者证书签名的证书)。如需更多信息,请参阅 设置 Web 服务器

注意:

对于 3.10 或更高版本,您可以使用“openxpkiadm alias”命令直接管理密钥:

在此例中,我们使用 /etc/certs/openxpki_democa/ 目录来生成证书。但您可以使用任何目录。

创建 OpenSSL 配置文件

OpenSSL 配置文件包含用于生成和签署证书请求的 X.509 扩展。

  1. 运行以下命令:

    nano /etc/certs/openxpki_democa/openssl.conf

    注意:  如果您的服务器可以使用完全合格域名 (FQDN) 进行访问,则使用服务器的 DNS 而不是其 IP 地址。
    示例文件
    # x509_extensions = v3_ca_extensions # x509_extensions = v3_issuing_extensions # x509_extensions = v3_datavault_extensions # x509_extensions = v3_scep_extensions # x509_extensions = v3_web_extensions # x509_extensions = v3_ca_reqexts # not for root self-signed, only for issuing ## x509_extensions = v3_datavault_reqexts # not required self-signed # x509_extensions = v3_scep_reqexts # x509_extensions = v3_web_reqexts [ req ] default_bits = 4096 distinguished_name = req_distinguished_name [ req_distinguished_name ] domainComponent = Domain Component commonName = Common Name [ v3_ca_reqexts ] subjectKeyIdentifier = hash keyUsage = digitalSignature, keyCertSign, cRLSign [ v3_datavault_reqexts ] subjectKeyIdentifier = hash keyUsage = keyEncipherment extendedKeyUsage = emailProtection [ v3_scep_reqexts ] subjectKeyIdentifier = hash [ v3_web_reqexts ] subjectKeyIdentifier = hash keyUsage = critical, digitalSignature, keyEncipherment extendedKeyUsage = serverAuth, clientAuth [ v3_ca_extensions ] subjectKeyIdentifier = hash keyUsage = digitalSignature, keyCertSign, cRLSign basicConstraints = critical,CA:TRUE authorityKeyIdentifier = keyid:always,issuer [ v3_issuing_extensions ] subjectKeyIdentifier = hash keyUsage = digitalSignature, keyCertSign, cRLSign basicConstraints = critical,CA:TRUE authorityKeyIdentifier = keyid:always,issuer:always crlDistributionPoints = URI:https://FQDN of your system/openxpki/CertEnroll/MYOPENXPKI.crl authorityInfoAccess = caIssuers;URI:https://FQDN of your system/download/MYOPENXPKI.crt [ v3_datavault_extensions ] subjectKeyIdentifier = hash keyUsage = keyEncipherment extendedKeyUsage = emailProtection basicConstraints = CA:FALSE authorityKeyIdentifier = keyid:always,issuer [ v3_scep_extensions ] subjectKeyIdentifier = hash basicConstraints = CA:FALSE authorityKeyIdentifier = keyid,issuer [ v3_web_extensions ] subjectKeyIdentifier = hash keyUsage = critical, digitalSignature, keyEncipherment extendedKeyUsage = serverAuth, clientAuth basicConstraints = critical,CA:FALSE subjectAltName = DNS:FQDN of est server crlDistributionPoints = URI:https://FQDN of your system/openxpki/CertEnroll/MYOPENXPKI_ISSUINGCA.cr authorityInfoAccess = caIssuers;URI:https://FQDN of your system/download/MYOPENXPKI_ISSUINGCA.crt
  2. 将 IP 地址和 CA 证书名称替换为您的设置信息。

  3. 保存该文件。

为证书密钥创建密码文件

  1. 运行以下命令:

    nano /etc/certs/openxpki_democa/pd.pass

  2. 键入您的密码。

  3. 保存该文件。

创建根 CA 证书

您可以创建自签名的根 CA 证书,也可以生成证书请求并让根 CA 对其进行签名。

注意:  将密钥长度、签名算法和证书名称替换为适当的值。
  1. 运行以下命令:

    openssl genrsa -out /etc/certs/openxpki_democa/ca-root-1.key -passout file:/etc/certs/openxpki_democa/pd.pass 4096

  2. 使用 openssl req -new -key /etc/certs/openxpki_democa/ca-root-1.key -out /etc/certs/openxpki_democa/ca-root-1.csr 命令将请求中的主题替换为您的 CA 信息。

  3. 使用 openssl req -config /etc/certs/openxpki_democa/openssl.conf -extensions v3_ca_extensions - x509 -days 3560 -in /etc/certs/openxpki_democa/ca-root-1.csr -key /etc/certs/openxpki_democa/ca-root-1.key -out /etc/certs/openxpki_democa/ca-root-1.crt - sha256 命令获取由根 CA 签名的证书。

  4. 请转到用于保存 ca-root-1.crt /etc/certs/openxpki_democa/

  5. 运行以下命令:

    openxpkiadm certificate import --file ca-root-1.crt

创建签名者证书

注意:  将密钥长度、签名算法和证书名称替换为适当的值。
  1. 运行以下命令:

    openssl genrsa -out /etc/certs/openxpki_democa/ca-signer-1.key -passout file:/etc/certs/openxpki_democa/pd.pass 4096

  2. 使用 openssl req -config /etc/certs/openxpki_democa/openssl.conf -reqexts v3_ca_reqexts -new -key /etc/certs/openxpki_democa/ca-signer-1.key -subj /DC=COM/DC=LEXMARK/DC=DEV/DC=CA-ONE/CN=MYOPENXPKI_ISSUINGCA -out / etc/certs/openxpki_democa/ca-signer-1.csr 命令将请求中的主题替换为您的 CA 信息。

  3. 使用 openssl x509 -req -extfile /etc/certs/openxpki_democa/openssl.conf -extensions v3_issuing_extensions -days 3650 -in /etc/certs/openxpki_democa/ca-signer-1.csr -CA /etc/certs/openxpki_democa/ca-root-1.crt -CAkey /etc/certs/openxpki_democa/ca-root-1.key -CAcreateserial -out /etc/certs/openxpki_democa/ca-signer-1.crt -sha256 命令获取由根 CA 签名的证书。

  4. 运行以下命令:

    openxpkiadm alias --realm democa --token certsign --file ca-signer-1.crt --key ca-signer-1.key

创建保管库证书

注意:

  1. 运行以下命令:

    openssl req -new -x509 -keyout vault.key -out vault.crt -days 1100 -config /etc/certs/openxpki_democa/openssl.conf

  2. 使用 openxpkiadm certificate import --file vault.crt 命令将请求中的主题更改为您的 CA 信息。

  3. 运行以下命令:

    openxpkiadm alias --realm democa --token datasafe --file vault.crt --key vault.key

    注意:  提供必要的值,但保留 /CN=DataVault 作为主题。

创建 Web 证书

  1. 运行以下命令:

    openssl genrsa -out /etc/certs/openxpki_democa/web-1.key -passout file:/etc/certs/openxpki_democa/pd.pass 4096

  2. 使用 openssl req -config /etc/certs/openxpki_democa/openssl.conf -reqexts v3_web_reqexts -new -key /etc/certs/openxpki_democa/web-1.key -subj /DC=COM/DC=LEXMARK/DC=DEV/DC=CA-ONE/CN=FQDN of your system -out /etc/certs/openxpki_democa/web-1.csr 命令将请求中的主题替换为您的 CA 信息。

  3. 运行以下命令:

    openssl x509 -req -extfile /etc/certs/openxpki_democa/openssl.conf -extensions v3_web_extensions -days 900 -in /etc/certs/openxpki_democa/web-1.csr -CA /etc/certs/openxpki_democa/ca-signer-1.crt -CAkey /etc/certs/openxpki_democa/ca-signer-1.key -CAcreateserial -out /etc/certs/openxpki_democa/web-1.crt -sha256

设置 Web 服务器

  1. 运行以下命令:

    a2enmod ssl rewrite headers

    a2ensite openxpki

    a2dissite 000-default default-ssl

    mkdir -m755 -p /etc/openxpki/tls/chain

    cp /etc/certs/openxpki_democa/ca-root-1.crt /etc/openxpki/tls/chain/

    cp /etc/certs/openxpki_democa/ca-signer-1.crt /etc/openxpki/tls/chain/

    c_rehash /etc/openxpki/tls/chain/

    mkdir -m755 -p /etc/openxpki/tls/endentity

    mkdir -m700 -p /etc/openxpki/tls/private

    cp /etc/certs/openxpki_democa/web-1.crt /etc/openxpki/tls/endentity/openxpki.crt

    cat /etc/certs/openxpki_democa/ca-signer-1.crt >> /etc/openxpki/tls/endentity/openxpki.crt

    openssl rsa -in /etc/certs/openxpki_democa/web-1.key -passin file:/etc/certs/openxpki_democa/pd.pass -out /etc/openxpki/tls/private/openxpki.pem

    chmod 400 /etc/openxpki/tls/private/openxpki.pem

  2. 使用 apache2 restart 命令重新启动 Apache 服务。

  3. 运行以下命令来检查是否成功导入文件:

    openxpkiadm alias --realm democa

    示例输出
    === functional token === ca-signer (certsign): Alias : ca-signer-2 Identifier: XjC6MPbsnyfLZkI9Poi9vm4Z5rk NotBefore : 2022-04-06 10:03:01 NotAfter : 2032-04-03 10:03:01 vault (datasafe): Alias : vault-2 Identifier: G8ekluAsskGVC0N-jZhB2n9kvdM NotBefore : 2022-04-06 09:53:57 NotAfter : 2025-04-10 09:53:57 scep (scep): not set ratoken (cmcra): not set === root ca === current root ca: Alias : root-2 Identifier: prTHU5vCfcJuCnQWyb5wUknvXQM NotBefore : 2022-04-06 09:40:27 NotAfter : 2032-01-04 09:40:27

使证书密钥密码可用于 OpenXPKI

  1. 更改 nano /etc/openxpki/config.d/system/crypto.yaml 文件中的值。

  2. 取消注释 secret: default 下的“cache: daemon”:

    secret: default: label: Global Secret group export: 0 method: literal value: root cache: daemon

启动 OpenXPKI

  1. 运行 openxpkictl start 命令。

    示例输出
    Starting OpenXPKI...OpenXPKI Server is running and accepting requests.DONE.
  2. 访问 OpenXPKI 服务器:

    1. 从 Web 浏览器,键入 http://ipaddress/openxpki/

    2. userdb.yaml 文件中添加用户名及其对应的密码:

      • 查看 /home/pkiadm ,然后查看 nano userdb.yaml

      • 粘贴以下内容:

        estRA: digest:"{ssha256}somePassword” role: RA Operator
        注意:  在这里,estRA 指的是用户名。
      • 要生成密码,请键入 openxpkiadm hashpwd 。此时会出现一条显示密码和 ssha256 加密密码的消息。

      • 复制密码,然后将其粘贴到任何用户的摘要中。

      注意:  “操作员”登录有两个预配置的可用角色:RA 操作员、CA 操作员和用户。
  3. 键入您的用户名和密码。

  4. 创建一个证书请求,然后进行测试。

生成 CRL 信息

注意:  如果您的服务器可以使用 FQDN 进行访问,则使用服务器的 DNS 而不是其 IP 地址。
  1. 使用 openxpkictl stop 命令停止 OpenXPKI 服务。

  2. nano /etc/openxpki/config.d/realm/democa/publishing.yaml 中,将 connectors: cdp 部分更新为以下内容:

    class: Connector::Builtin::File::Path LOCATION: /var/www/openxpki/CertEnroll/ file: "[% ARGS.0 %].crl" content: "[% pem %]"
    1. nano /etc/openxpki/config.d/realm/democa/profile/default.yaml 中,更新以下内容:

      • crl_distribution_points: 部分

        critical: 0 uri: - https://FQDN of the est/openxkpi/CenrtEnroll/[% ISSUER.CN.0 %].crl - ldap://localhost/[% ISSUER.DN %]
      • authority_info_access: 部分

        critical: 0 ca_issuers: http://FQDN of the est/download/MYOPENXPKI.crt ocsp: http://ocsp.openxpki.org/

      根据您的 CA 服务器更改 IP 地址和 CA 证书名称。

      注意:  authority_info_access (AIA) 路径保存在 Download 文件夹中,但您可以根据自己的喜好来设置此位置。
    2. nano /etc/openxpki/config.d/realm/democa/crl/default.yaml 中,执行以下操作:

      • 如有必要,请更新 nextupdate renewal

      • ca_issuers 添加到以下部分:

        extensions: authority_info_access: critical: 0 # ca_issuers and ocsp can be scalar or list ca_issuers: https://FQDN of the est/download/MYOPENXPKI.crt #ocsp: http://ocsp.openxpki.org/

        根据您的 CA 服务器更改 IP 地址和 CA 证书名称。

  3. 使用 openxpkictl start 命令启动 OpenXPKI 服务。

发布 CRL 信息

在创建 CRL 之后,您必须发布它们以供所有人访问。

  1. 使用 service apache2 stop 命令停止 Apache 服务。

  2. /var/www/openxpki/ 目录中的 CRL 创建 CertEnroll 目录。

  3. openxpki 设置为该目录的所有者,然后配置相应的权限以允许 Apache 读取和执行内容并允许其他服务只读取内容。

    chown openxpki /var/www/openxpki/CertEnroll

    chmod 755 /var/www/openxpki/CertEnroll

  4. 使用 nano /etc/apache2/mods-enabled/alias.conf 命令在 Apache alias.conf 文件中添加一个引用。

  5. <Directory "/usr/share/apache2/icons"> 部分后面,添加以下内容:

    Alias /CertEnroll/ "/var/www/openxpki/CertEnroll/" <Directory "/var/www/openxpki/CertEnroll"> Options FollowSymlinks AllowOverride None Require all granted </Directory>
  6. 使用 nano /etc/apache2/apache2.conf 命令在 apache2.conf 文件中添加一个引用。

  7. Apache2 HTTPD server 部分中添加以下内容:

    <Directory /var/www/openxpki/CertEnroll> Options FollowSymlinks AllowOverride None Allow from all </Directory>
  8. 使用 service apache2 start 命令启动 Apache 服务。

在 OpenXPKI CA 中启用证书请求的自动批准

  1. 使用 openxpkictl stop 命令停止 OpenXPKI 服务。

  2. /etc/openxpki/config.d/realm/democa/est/default.yaml 中,更新 eligible: 部分:

    旧内容
    eligible: initial: value@: connector:scep.generic.connector.initial args: '[% context.cert_subject_parts.CN.0 %]' expect: - Build - New
    新内容
    eligible: initial: value: 1 # value@: connector:scep.generic.connector.initial # args: '[% context.cert_subject_parts.CN.0 %]' # expect: # - Build # - New

    注意:

    • 检查脚本文件中的空格和缩进。
    • 要手动批准证书,请注释掉 value: 1 ,然后取消注释之前注释掉的其他行。
  3. 保存该文件。

  4. 使用 openxpkictl start 命令启动 OpenXPKI 服务。

更改详细信息以启用 CA 证书下载

  1. 运行以下命令:

    nano /usr/lib/cgi-bin/est.fcgi

  2. my $mime = "application/pkcs7-mime; smime-type=certs-only"; 替换为 my $mime = "application/pkcs7-mime";

  3. 使用 openxpkictl 命令启动 OpenXPKI 服务。

创建第二个领域

在 OpenXPKI 中,您可以在同一系统中配置多个 PKI 结构。以下主题说明如何为名为 democa-two 的 MVE 创建另一个领域。

复制和设置目录

  1. /etc/openxpki/config.d/realm 中的第二个领域创建名为 democa2 的目录。

  2. /etc/openxpki/config.d/realm/ca-one 示例目录树复制到 realm 目录内的新目录 ( cp -r /etc/openxpki/config.d/realm.tpl/*/etc/openxpki/config.d/realm/democa2 ) 中。

  3. /etc/openxpki/config.d/system/realms.yaml 中,更新以下部分:

    旧内容
    # This is the list of realms in this PKI # You only need to enable the realms which are visible on the server democa: label: Verbose name of this realm baseurl: https://pki.example.com/openxpki/ #democa2: # label: Verbose name of this realm # baseurl: https://pki.acme.org/openxpki/
    新内容
    # This is the list of realms in this PKI # You only need to enable the realms which are visible on the server democa: label: Example.org Demo CA baseurl: https://pki.example.com/openxpki/ democa2: label: Example.org Demo CA2 baseurl: https://pki.example.com/openxpki/
  4. 保存该文件。

为多个领域配置 EST 端点

您可以使用由 URI 的权限部分和可选标签(例如,www.example.com:80 和 arbitraryLabel1)组成的元组来配置 EST 端点。在以下说明中,我们使用以下两个 PKI 领域: democa democa2

  1. 将默认配置文件复制到 cp /etc/openxpki/est/default.conf /etc/openxpki/est/democa.conf 中。

    注意:  将该文件命名为 democa.conf
  2. nano /etc/openxpki/est/democa.conf 中,将领域值更改为 realm=democa

    注意:  根据您的需要,您可能需要取消注释 simpleenroll simplereenroll csrattrs cacerts 部分的相应行。保持注释掉环境部分。对 default.conf 执行同样的操作。
  3. cp /etc/openxpki/est/default.conf /etc/openxpki/est/democa2.conf 中创建另一个配置文件。

    注意:  将该文件命名为 democa2.conf
  4. nano /etc/openxpki/est/democa2.conf 中,将领域值更改为 realm=democa2

    注意:  根据您的需要,您可能需要取消注释 simpleenroll simplereenroll csrattrs cacerts 部分的相应行。保持注释掉环境部分。
  5. default.yaml 文件复制到以下位置:

    • cp /etc/openxpki/config.d/realm/democa/est/default.yaml

    • /etc/openxpki/config.d/realm/democa/est/democa.yaml

    注意:  将该文件命名为 democa.yaml
  6. default.yaml 文件复制到以下位置:

    • cp /etc/openxpki/config.d/realm/democa2/est/default.yaml

    • /etc/openxpki/config.d/realm/democa2/est/democa2.yaml

    注意:  将该文件命名为 democa2.yaml
  7. 使用 openxpkictl restart 命令重新启动 OpenXPKI 服务。

选择以下 URL 以通过 Web 浏览器打开与领域对应的 EST 服务器:

如果您想区分不同 PKI 领域的登录凭证和默认证书模板,则可能需要高级配置。

创建签名者证书

以下说明介绍了如何在第二个领域中生成签名者证书。您可以使用与第一个领域中相同的根证书和保管库证书。

  1. nano /etc/certs/openxpki_democa2/openssl.conf 中创建一个 OpenSSL 配置文件。

    注意:  更改证书常用名,以便用户可以轻松区分不同领域的不同证书。将在 /etc/certs/openxpki_democa2/ 目录中创建证书文件。
  2. 转到第一个领域的保管库证书目录,然后从第一个领域中导入证书。

  3. 运行以下代码:

    openxpkiadm alias --realm democa2 --token datasafe --file vault.crt

为证书密钥创建密码文件

  1. 运行以下命令:

    nano /etc/certs/openxpki_democa2/pd.pass

  2. 键入您的密码。

  3. 创建签名者证书。如需更多信息,请参阅 创建签名者证书

  4. 使用 openxpkiadm alias --realm democa2 命令检查是否导入成功。

    注意:  如果您在创建证书期间更改了证书的密钥密码,请更新 nano /etc/openxpki/config.d/realm/democa2/crypto.yaml
  5. 为第二个领域生成 CRL。如需更多信息,请参阅 生成 CRL 信息

    注意:  确保根据领域使用了正确的 CA 证书名称。
  6. 发布此领域的 CRL。如需更多信息,请参阅 发布 CRL 信息

  7. 使用 openxpkictl restart 命令重新启动 OpenXPKI 服务。

    示例输出
    Stopping OpenXPKI Stopping gracefully, 3 (sub)processes remaining... DONE.Starting OpenXPKI...OpenXPKI Server is running and accepting requests.DONE.

允许同时存在具有相同主题的多个活动证书

默认情况下,在 OpenXPKI 中一次只能激活一个具有相同主题名称的证书。但是,当强制执行多个命名证书时,必须同时存在具有相同主题名称的多个活动证书。

  1. /etc/openxpki/config.d/realm/REALM NAME/est/< REALM NAME >.yaml policy 部分中,将 max_active_certs 的值从 1 更改为 0

    注意:

    • REALM NAME 是领域的名称。例如, ca-one
    • 检查脚本文件中的空格和缩进。
  2. 使用 openxpkictl restart 命令重新启动 OpenXPKI 服务。

为 OpenXPKI CA 设置默认端口号

默认情况下,Apache 在端口号 443 上侦听 https。为 OpenXPKI CA 设置默认端口号以避免发生冲突。

  1. /etc/apache2/ports.conf 中,将 443 端口修改为任何其他端口。例如:

    旧内容
    Listen 80 <IfModule ssl_module> Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule>
    新内容
    Listen 80 <IfModule ssl_module> Listen 9443 </IfModule> <IfModule mod_gnutls.c> Listen 9443 </IfModule>
  2. /etc/apache2/sites-available/openxpki.conf 中,添加或修改 VirtualHost 部分以映射新端口。例如, <VirtualHost *:443> 更改为 <VirtualHost *:9443>

  3. /etc/apache2/sites-available/default-ssl.conf 中,添加或修改 VirtualHost_default 部分以映射新端口。例如,将 <VirtualHost *:443> 更改为 <VirtualHost *:9443>

  4. 使用 systemctl restart apache2 命令重新启动 Apache 服务器。

    注意:  如果要求提供 SSL/TLS 密码,请在 EST 服务器中添加 TLS Web 服务器证书时键入密码。
  5. tinddopenxpkiweb01.dhcp.dev.lexmark.com:9443 (RSA): 中,输入 SSL/TLS 密钥的密码。

要检查状态,请运行 netstat -tlpn| grep apache 。OpenXPKI SCEP URL 现在为 https://ipaddress ,而 Web URL 为 FQDN:9443/openxpki

启用基本身份验证

  1. 运行以下命令:

    apt -y install apache2-utils

  2. 创建一个有权访问服务器的用户帐户。输入以下详细信息:

    htpasswd -c /etc/apache2/.htpasswd <username> New password: Re-type new password: Adding password for user <username>
  3. 转到以下目录: cd /etc/apache2/sites-enabled/

  4. nano openxpki.conf 中,将以下行添加到 <VirtualHost *: 443 block> 中:

    #HTTPS BASIC AUTH FOR LABELS Location /.well-known/est/*/simpleenroll AuthType Basic AuthName "estrealm" AuthUserFile /etc/apache2/.htpasswd require valid-user </Location> #HTTPS BASIC AUTH FOR NO LABEL <Location /.well-known/est/simpleenroll> AuthType Basic AuthName "estrealm" AuthUserFile /etc/apache2/.htpasswd require valid-user </Location>
  5. ErrorDocument 401 %{unescape:%00} 添加到同一虚拟主机块中的 SSLEngine 之前。

    示例
    ServerAlias * DocumentRoot /var/www/ ErrorDocument 401 %{unescape:%00} SSLEngine On
  6. 使用 service apache2 restart 命令重新启动 apache2 服务。

    注意:  需要使用上述用户名和密码来进行基本身份验证。

启用客户端证书身份验证

  1. 转到以下目录: cd /etc/apache2/sites-enabled/

  2. 对于 nano openxpki.conf 中的必需主机,添加 SSLVerifyClient require

    例如,如果您使用端口 443,请将 VirtualHost 部分修改为:

    <VirtualHost *:443> SSLVerifyClient require </VirtualHost>
  3. 移除 SSLVerifyClient optional_no_ca 命令。

  4. 保存该文件,然后键入 quit 以退出 MySQL。

  5. 转到以下目录: cd /etc/openxpki/config.d/realm/democa/est

  6. 打开 default.yaml democa.yaml

    注意:  如果标签不同,则更改 YAML 文件。
  7. 运行以下命令:

    vi default.yaml

  8. authorized_signer 部分中,添加以下内容:

    authorized_signer: rule2: subject: CN=,.

    例如,如果您的客户端证书主题名称为 test123 ,请将以下内容添加到 authorized_signer 部分中:

    authorized_signer: rule1: # Full DN subject: CN=.+:pkiclient,. rule2: subject: CN=test123,.*
  9. 保存该文件,然后键入 quit 以退出 MySQL。

  10. 使用 openxpkictl restart 命令重新启动 OpenXPKI 服务。

  11. 使用 service apache2 restart 命令重新启动 Apache 服务。

导致系统无法获取 CRL 的 SAN 不匹配错误的原因是什么?

启用 CRL 信息时可能会出现 SAN 不匹配错误。此错误表明 IP 或主机名与 Web 证书中的 SAN 值不匹配。为避免出现此错误,请在 CRL 路径中使用 FQDN,而不是使用 IP。您还可以在 SAN 字段中配置 Web 证书并使用系统的 FQDN。

ca-signer-1 和 vault-1 令牌为何会脱机?

如果系统状态页面显示您的 ca-signer-1 和 vault-1 令牌处于脱机状态,请执行以下操作:

  1. /etc/openxpki/config.d/realm/realm name/crypto.yaml 中,更改对应的密钥值。

  2. 重新启动 OpenXPKI 服务。