本节提供有关如何使用简单证书注册协议 (SCEP) 配置 OpenXPKI CA 2.5.x 版本的说明。
注意:
使用 PuTTY 或另一个客户端连接机器。
从客户端,运行
命令以转到根用户。输入根密码。
在 nano /etc/apt/sources.list 中,更改安装更新的源。
更新文件。例如:
# # deb cdrom:[Debian GNU/Linux 8.11.1 _Jessie_ - Official amd64 CD Binary-1 20190211-02:10]/ jessie local main # deb cdrom:[Debian GNU/Linux 8.11.1 _Jessie_ - Official amd64 CD Binary-1 20190211-02:10]/ jessie local main deb http://security.debian.org/ jessie/updates main deb-src http://security.debian.org/ jessie/updates main # jessie-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/jessie-updates main deb-src http://ftp.debian.org/debian/jessie-updates main deb http://ftp.us.debian.org/debian/jessie main
保存文件。
运行以下命令:
使用
更新服务器中的 CA 证书列表。使用
安装 en_US.utf8 locale 。选择 en_US.UTF-8 UTF-8 区域设置,然后使其成为系统的默认区域设置。
检查您已经使用
生成的区域设置。C C.UTF-8 en_IN en_IN.utf8 en_US.utf8 POSIX
使用
复制 OpenXPKI 软件包的指纹。对于此实例,复制 /home 中的密钥。键入
作为值。运行以下命令:
使用
命令添加软件包。使用
,然后使用 ,将存储库添加到源列表 (jessie) 中。使用
安装 MySQL 和 Perl MySQL 绑定。使用
安装 apache2.2-common。在 nano /etc/apt/sources.list 中,安装 fastcgi 模块以加速用户界面。
在文件中添加
行,然后保存。运行以下命令:
使用
启用 fastcgi 模块。使用
安装 OpenXPKI 内核软件包。使用
重新启动 Apache 服务器。使用
检查安装是否成功。创建空数据库,然后使用
分配数据库用户。注意:
CREATE DATABASE openxpki CHARSET utf8; CREATE USER 'openxpki'@'localhost' IDENTIFIED BY 'openxpki'; GRANT ALL ON openxpki.* TO 'openxpki'@'localhost'; flush privileges;
如果 MySQL 服务没有运行,则运行
来启动服务。键入
以退出 MySQL。将使用的凭证存储在 /etc/openxpki/config.d/system/database.yaml 中。
debug: 0 type: MySQL name: openxpki host: localhost port: 3306 user: openxpki passwd: openxpki
保存文件。
对于空数据库架构,请从提供的架构文件运行
。输入数据库的密码。
使用
解压缩安装证书的示例脚本。使用
运行脚本。使用
确认设置。=== 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
使用
检查安装是否成功。Starting OpenXPKI... OpenXPKI Server is running and accepting requests. DONE.
执行以下操作以访问 OpenXPKI 服务器:
从 Web 浏览器,键入
。以 操作员 身份登录。默认密码是
。创建一个证书请求,然后进行测试。
要手动配置 OpenXPKI CA,请创建以下内容:
根 CA 证书。如需更多信息,请参阅 创建根 CA 证书 。
CA 签名者证书,由根 CA 签名。如需更多信息,请参阅 创建签名者证书 。
数据保管库证书,自签名。如需更多信息,请参阅 创建保管库证书 。
SCEP 证书,由签名者证书签名。
注意:
对于此实例,我们使用 /etc/certs/openxpki_ca-one/ 目录生成证书。但是,您可以使用任何目录。
运行以下命令:
# 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:http://FQDN of the server/CertEnroll/MYOPENXPKI.crl authorityInfoAccess = caIssuers;URI:http://FQDN of the server/CertEnroll/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:stlopenxpki.lexmark.com crlDistributionPoints = URI:http://FQDN of the server/CertEnroll/MYOPENXPKI_ISSUINGCA.crl authorityInfoAccess = caIssuers;URI:http://FQDN of the server/CertEnroll/MYOPENXPKI_ISSUINGCA.crt
使用您的设置信息更改 IP 地址和 CA 证书名称。
保存该文件。
将密钥文件复制到 /etc/openxpki/ca/ca-one/ 。
cp /etc/certs/openxpki_ca-one/ca-signer-1.key /etc/openxpki/ca/ca-one/ cp /etc/certs/openxpki_ca-one/vault-1.key /etc/openxpki/ca/ca-one/ cp /etc/certs/openxpki_ca-one/scep-1.key /etc/openxpki/ca/ca-one/
创建符号链接。
ln -s /etc/openxpki/ca/ca-one/ca-signer-1.key /etc/openxpki/ca/ca-one/ca-signer-1.pem ln -s /etc/openxpki/ca/ca-one/scep-1.key /etc/openxpki/ca/ca-one/scep-1.pem ln -s /etc/openxpki/ca/ca-one/vault-1.key /etc/openxpki/ca/ca-one/vault-1.pem
使用适当的令牌将根证书、签名者证书、保管库证书和 SCEP 证书导入数据库中。
运行以下命令:
使用
检查导入是否成功。=== 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
使用
停止 OpenXPKI 服务。在 nano /etc/openxpki/config.d/realm/ca-one/publishing.yaml 中,将
部分更新为以下内容:class: Connector::Builtin::File::Path LOCATION: /var/www/openxpki/CertEnroll/ file: "[% ARGS.0 %].crl" content: "[% pem %]"
在 nano /etc/openxpki/config.d/realm/ca-one/profile/default.yaml 中,更新以下内容:
部分
critical: 0 uri: - http://FQDN of the server/CertEnroll/[% ISSUER.CN.0 %].crl - ldap://localhost/[% ISSUER.DN %]
部分
critical: 0 ca_issuers: http://FQDN of the server/CertEnroll/MYOPENXPKI.crt ocsp: http://ocsp.openxpki.org/
根据您的 CA 服务器更改 IP 地址和 CA 证书名称。
在 nano /etc/openxpki/config.d/realm/ca-one/crl/default.yaml 中,执行以下操作:
如果需要,请更新
和 。将
添加到以下部分:extensions: authority_info_access: critical: 0 # ca_issuers and ocsp can be scalar or list ca_issuers: http://FQDN of the server/CertEnroll/MYOPENXPKI.crt #ocsp: http://ocsp.openxpki.org/
根据您的 CA 服务器更改 IP 地址和 CA 证书名称。
使用
启动 OpenXPKI 服务。使用
停止 Apache 服务。在 /var/www/openxpki/ 目录中为 crl 创建 CertEnroll 目录。
将 openxpki 设置为此目录的所有者,然后配置权限以允许 Apache 读取和执行,并且其他服务为只读。
chown openxpki /var/www/openxpki/CertEnroll
chmod 755 /var/www/openxpki/CertEnroll
使用
添加对 Apache alias.conf 文件的引用。在
部分之后,添加以下内容:Alias /CertEnroll/ "/var/www/openxpki/CertEnroll/" <Directory "/var/www/openxpki/CertEnroll"> Options FollowSymlinks AllowOverride None Require all granted </Directory>
使用 nano /etc/apache2/apache2.conf 在 apache2.conf 文件中添加引用。
在
部分中添加以下内容:<Directory /var/www/openxpki/CertEnroll> Options FollowSymlinks AllowOverride None Allow from all </Directory>
使用
启动 Apache 服务。使用
停止 OpenXPKI 服务。使用
安装 openca-tools 软件包。使用
启动 OpenXPKI 服务。使用任何客户端(如带有 SSCEP 的 certnanny)测试服务。
对于自动证书请求,我们使用 OpenXPKI 的“签名者代表”证书特性。
使用
停止 OpenXPKI 服务。在 nano /etc/openxpki/config.d/realm/ca-one/scep/generic.yaml 中,从
部分,为签名者证书的主题名称添加规则。rule1: # Full DN subject: CN=Markvision_.*
注意:
保存文件。
使用
启动 OpenXPKI 服务。使用
停止 OpenXPKI 服务。在 nano /etc/openxpki/config.d/realm/ca-one/scep/generic.yaml 中,更新
部分: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
注意:
保存文件。
使用
启动 OpenXPKI 服务。在 OpenXPKI 中,您可以在同一系统中配置多个 PKI 结构。以下主题说明如何为名为 ca-two 的 MVE 创建另一个领域。
将 /etc/openxpki/config.d/realm/ca-one 示例目录树复制到领域目录内的新目录 ( cp -avr /etc/openxpki/config.d/realm/ca-one /etc/openxpki/config.d/realm/ca-two ) 中。
在 /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 ca-one: label: Verbose name of this realm baseurl: https://pki.example.com/openxpki/ #ca-two: # 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 ca-one: label: CA-ONE baseurl: https://pki.example.com/openxpki/ ca-two: label: CA-TWO baseurl: https://pki.example.com/openxpki/
保存文件。
以下说明显示如何生成签名者证书、保管库证书和 SCEP 证书。根 CA 签署签名者证书,然后签名者证书签署 SCEP 证书。保管库证书是自签名的。
生成,然后签署证书。如需更多信息,请参阅 手动配置 OpenXPKI CA 。
将密钥文件复制到 /etc/openxpki/ca/ca-two/ 。
cp /etc/certs/openxpki_ca-two/ca-signer-1.key /etc/openxpki/ca/ca-two/ cp /etc/certs/openxpki_ca-two/vault-1.key /etc/openxpki/ca/ca-two/ cp /etc/certs/openxpki_ca-two/scep-1.key /etc/openxpki/ca/ca-two/
创建符号链接。另外,创建根 CA 证书的符号链接。
ln -s /etc/openxpki/ca/ca-one/ca-root-1.crt /etc/openxpki/ca/ca-two/ca-root-1.crt ln -s /etc/openxpki/ca/ca-two/ca-signer-1.key /etc/openxpki/ca/ca-two/ca-signer-1.pem ln -s /etc/openxpki/ca/ca-two/scep-1.key /etc/openxpki/ca/ca-two/scep-1.pem ln -s /etc/openxpki/ca/ca-two/vault-1.key /etc/openxpki/ca/ca-two/vault-1.pem
使用
的适当令牌将签名者证书、保管库证书和 SCEP 证书导入数据库中。openxpkiadm certificate import --file /etc/certs/openxpki_ca-two/ca-signer-1.crt --realm ca-two -issuer /etc/openxpki/ca/ca-two/ca-one-1.crt --token certsign openxpkiadm certificate import --file /etc/certs/openxpki_ca-two/scep-1.crt --realm ca-two --token scep openxpkiadm certificate import --file /etc/certs/openxpki_ca-two/vault-1.crt --realm ca-two --token datasafe
使用
检查导入是否成功。=== 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
在此实例中,
和 的根 CA 信息相同。如果您在证书创建期间更改了证书密钥密码,请更新 nano /etc/openxpki/config.d/realm/ca-two/crypto.yaml 。
生成此领域的 CRL。如需更多信息,请参阅 生成 CRL 信息 。
发布此领域的 CRL。如需更多信息,请参阅 配置 CRL 可访问性 。
使用
重新启动 OpenXPKI 服务。Stopping OpenXPKI Stopping gracefully, 3 (sub)processes remaining... DONE. Starting OpenXPKI... OpenXPKI Server is running and accepting requests. DONE.
执行以下操作以访问 OpenXPKI 服务器:
从 Web 浏览器,键入
。以 操作员 身份登录。默认密码是
。默认的领域 SCEP 端点是 http://<ipaddress>/scep/scep 。如果您有多个领域,则为每一个领域配置唯一的 SCEP 端点(不同的配置文件)。在下面的说明中,我们使用两个 PKI 领域,
和 。复制 cp /etc/openxpki/scep/default.conf /etc/openxpki/scep/ca-one.conf 中的默认配置文件。
在 nano /etc/openxpki/scep/ca-one.conf 中,将领域值更改为
。在 cp /etc/openxpki/scep/default.conf /etc/openxpki/scep/ca-two.conf 中创建另一个配置文件。
在 nano /etc/openxpki/scep/ca-two.conf 中,将领域值更改为
。使用
重新启动 OpenXPKI 服务。SCEP 端点是以下内容:
- http://ipaddress/scep/ca-one
- http://ipaddress/scep/ca-two
如果您要区分不同 PKI 领域的登录凭证和默认证书模板,您可能需要高级配置。
默认情况下,在 OpenXPKI 中一次只能激活一个具有相同主题名称的证书。但是,当强制执行多个命名证书时,必须同时存在具有相同主题名称的多个活动证书。
在 /etc/openxpki/config.d/realm/REALM NAME/scep/generic.yaml 中,从
部分,将 的值从 更改为 。注意:
使用
重新启动 OpenXPKI 服务。默认情况下,Apache 侦听端口号 80。为 OpenXPKI CA 设置默认端口号以避免冲突。
在 /etc/apache2/ports.conf 中,添加或修改端口。例如:
。在 /etc/apache2/sites-enabled/000-default.conf 中,添加或修改
部分以映射新端口。例如: 。使用
重新启动 Apache 服务器。要检查状态,请运行
。OpenXPKI SCEP URL 现在是 http://ipaddress:8080/scep/ca-one ,并且 Web URL 是 http://ip address:8080/openxpki 。默认情况下,OpenXPKI 接收请求而不检查质询密码。证书请求不会被拒绝,并且 CA 和 CA 管理员决定是否批准或拒绝请求。为避免潜在的安全隐患,请禁用此特性,以便立即拒绝所有包含无效密码的证书请求。在 MVE 中,仅当生成注册代理证书时才需要质询密码。
在 etc/openxpki/config.d/realm/REALM NAME/scep/generic.yaml 中,从
部分,将 的值从 更改为 。注意:
使用
重新启动 OpenXPKI 服务。在 /etc/openxpki/config.d/realm/REALM NAME/profile/I18N_OPENXPKI_PROFILE_TLS_SERVER.yaml 中,从
部分,将 的值更改为 。注意:
使用
重新启动 OpenXPKI 服务。默认情况下,OpenXPKI 仅读取请求证书的主题的 CN。其余信息,如国家、地区和 DC,都是硬编码的。例如,如果证书主题是
、 、 、 、 、 ,则在通过 SCEP 签署证书之后,主题被更改为 、 、 。在 /etc/openxpki/config.d/realm/REALM NAME/profile/I18N_OPENXPKI_PROFILE_TLS_SERVER.yaml 中,从
部分,将 的值更改为以下内容:CN=[% CN.0 %][% IF OU %][% FOREACH entry = OU %],OU=[% entry %][% END %][% END %][% IF O %][% FOREACH entry = O %],O=[% entry %][% END %][% END %][% IF L %],L=[% L.0 %][% END %][% IF ST %],ST=[% ST.0 %][% END %][% IF C %],C=[% C.0 %][% END %][% IF DC %][% FOREACH entry = DC %],DC=[% entry %][% END %][% END %][% IF EMAIL %][% FOREACH entry = EMAIL %],EMAIL=[% entry %][% END %][% END %]
保存文件。
在 /etc/openxpki/config.d/realm/REALM NAME/profile/template 目录中创建一个名为 l.yaml 的文件。
添加以下内容:
id: L label: L description: I18N_OPENXPKI_UI_PROFILE_L_DESC preset: L type: freetext width: 60 placeholder: Kolkata
保存文件。
在 /etc/openxpki/config.d/realm/REALM NAME/profile/template 目录中创建一个名为 st.yaml 的文件。
添加以下内容:
id: ST label: ST description: I18N_OPENXPKI_UI_PROFILE_ST_DESC preset: ST type: freetext width: 60 placeholder: WB
保存文件。
使用
重新启动 OpenXPKI 服务。访问 OpenXPKI 服务器。
从 Web 浏览器,键入
。以 操作员 身份登录。默认密码是
。单击 工作流搜索 > 立即搜索 。
单击要吊销的证书,然后单击证书链接。
从操作部分,单击 吊销请求 。
键入适当的值,然后单击 继续 > 提交请求 。
在下一页上,批准请求。证书吊销等待下一次 CRL 发布。
从 PKI 操作部分,单击 发布证书吊销列表 (CRL) 。
单击 强制创建吊销列表 > 继续 。
从 PKI 操作部分,单击 发布 CA/CRL 。
单击 工作流搜索 > 立即搜索 。
单击具有 certificate_revocation_request_v2 类型的已吊销证书。
单击 强制唤醒 。
在新的 CRL 中,可以找到已吊销证书的序列号和吊销原因。