openssl:'policy'配置中的无效类型

tse*_*ega 2 ssl certificate self-signed

我想为我的本地开发服务器提供自签名SSL证书.我按照https://help.ubuntu.com/community/OpenSSL上的指南进行操作,并在最后一步通过发出以下命令发出签署证书的命令:

openssl ca -in tempreq.pem -out server_crt.pem
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:(最后一行)

Using configuration from /home/user_name/.ssl/caconfig.cnf
Enter pass phrase for /home/user_name/.ssl/private/cakey.pem:
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
commonName            :PRINTABLE:'localhost'
stateOrProvinceName   :PRINTABLE:'AA'
countryName           :PRINTABLE:'ET'
emailAddress          :IA5STRING:'user@example.com'
organizationName      :PRINTABLE:'Example Inc'
organizationalUnitName:PRINTABLE:'Development'
localhost:invalid type in 'policy' configuration
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能解决它?只是作为一个背景,我没有我的服务器的域名,所以我只使用localhost作为commanName.那是问题吗?

谢谢你的帮助.

小智 6

  1. 将策略从/etc/ssl/openssl.cnf复制到您的配置文件

  2. 从头开始重建所有文件

  3. 政策部分如下:

    policy          = policy_match

    # For the CA policy
    [ policy_match ]
    countryName             = match
    stateOrProvinceName     = match
    organizationName        = match
    organizationalUnitName  = optional
    commonName              = supplied
    emailAddress            = optional

    # For the 'anything' policy
    # At this point in time, you must list all acceptable 'object'
    # types.
    [ policy_anything ]
    countryName             = optional
    stateOrProvinceName     = optional
    localityName            = optional
    organizationName        = optional
    organizationalUnitName  = optional
    commonName              = supplied
    emailAddress            = optional