如何使用cli覆盖openssl配置文件中的参数?

如何使用cli覆盖openssl配置文件中的参数?,openssl,Openssl,我正在使用freeradius进行EAP-TLS身份验证 我运行此命令生成密钥: openssl-req-new-out-client.csr-keyout-client.key-config./client.cnf 我想为不同的用户生成几个密钥/证书: emailAddress和commonName在[客户端] 在[req] 问题:是否有openssl命令的参数覆盖配置文件 如果没有其他解决方案,我想使用sed /etc/freeradius/3.0/certs#cat client.cn

我正在使用freeradius进行EAP-TLS身份验证

我运行此命令生成密钥:
openssl-req-new-out-client.csr-keyout-client.key-config./client.cnf

我想为不同的用户生成几个密钥/证书:

  • emailAddress
    commonName
    [客户端]
  • [req]
问题:是否有
openssl
命令的参数覆盖配置文件

如果没有其他解决方案,我想使用
sed

/etc/freeradius/3.0/certs#cat client.cnf

[ ca ]
default_ca      = CA_default

[ CA_default ]
dir         = ./
certs           = $dir
crl_dir         = $dir/crl
database        = $dir/index.txt
new_certs_dir       = $dir
certificate     = $dir/ca.pem
serial          = $dir/serial
crl         = $dir/crl.pem
private_key     = $dir/ca.key
RANDFILE        = $dir/.rand
name_opt        = ca_default
cert_opt        = ca_default
default_days        = 365
default_crl_days    = 30
default_md      = sha256
preserve        = no
policy          = policy_match

[ policy_match ]
countryName     = match
stateOrProvinceName = match
organizationName    = match
organizationalUnitName  = optional
commonName      = supplied
emailAddress        = optional

[ policy_anything ]
countryName     = optional
stateOrProvinceName = optional
localityName        = optional
organizationName    = optional
organizationalUnitName  = optional
commonName      = supplied
emailAddress        = optional

[ req ]
prompt          = no
distinguished_name  = client
default_bits        = 4096
input_password      = clientpassword
output_password     = clientpassword

[client]
countryName     = JP
stateOrProvinceName = Tokyo
localityName        = Company building
organizationName    = Company name
emailAddress        = testuser@company.com
commonName      = testuser@company.com

我在配置文件中找到了以下两个替代变量的选项:

  • 可以使用命令行选项覆盖
    openssl.cnf
    中的大多数定义,如下所示。然而,我不确定这是否适用于你提到的变量
  • 运行OpenSSL CLI时,环境映射到名为ENV的部分。通过使用
    $ENV::name
    格式,可以在任何其他部分中替换环境变量。此信息来自于
  • 关于第二种方法,从
    SAN
    环境变量中读取
    [server\u requext]
    部分中的
    subjectAltName
    变量