默认情况下,如果在 HTTP 配置文件中启用了客户端证书验证,则虚拟服务使用的 PKI 配置文件必须至少包含一个 CRL。该 CRL 是由对客户端证书进行签名的 CA 颁发的。本节介绍了如何生成和配置 CRL。

生成 CRL

可以使用以下 OpenSSL 命令,通过前面步骤中创建的密钥和证书生成 CRL。

[client-cert-auth-demo] $ openssl ca -gencrl -keyfile CA.key -cert CA.pem -out crl.pem
Using configuration from /etc/pki/tls/openssl.cnf
/etc/pki/CA/index.txt: No such file or directory
unable to open '/etc/pki/CA/index.txt'
139687578113952:error:02001002:system library:fopen:No such file or
directory:bss_file.c:398:fopen('/etc/pki/CA/index.txt','r')
139687578113952:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:400:

此命令可能会出现一些错误。根据需要,采取相应的措施。例如,以下命令创建一个文件。

/etc/pki/CA/index.txt file and the file /etc/pki/CA/crlnumber with the content 01:
[client-cert-auth-demo] $ touch /etc/pki/CA/index.txt
[client-cert-auth-demo] $ echo 01 > /etc/pki/CA/crlnumber

重新生成 CRL

在纠正错误(如果有)后,重新运行 openssl ca -gencrl -keyfile CA.key -cert CA.pem -out crl.pem 命令以再次生成 CRL。

[client-cert-auth-demo] $ openssl ca -gencrl -keyfile CA.key -cert CA.pem -out crl.pem
Using configuration from /etc/pki/tls/openssl.cnf