我想为我的网站创建一个证书文件。
过去,我使用非交互式脚本来执行此操作,并且效果很好。
现在,我想再次使用这个脚本,但它停在这一行:
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
出现这个错误:
./scripts/generate-ssl-certificat.sh:第 16 行:keyUsage:找不到命令
我已经在我的 Ubuntu 18 系统中安装了这些软件包:
- sudo apt-get install openssl ssl-cert
- sudo apt-get install ca-certificates -y
我需要什么样的包来执行 keyUsage ?
这是自动创建的证书脚本,它使用
mkdir ~/certs
cd ~/certs
### Certificat Authority
openssl genrsa -des3 -out myCA.key 2048 # generate Certificat Authority key
openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem # generate root certificat
### Certificat webSite
openssl genrsa -out compty-tmp.key 2048
openssl req -new -key compty-tmp.key -out compty-tmp.csr
### create compty-tmp.ext
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = compty-tmp
### create the certificate: using our CSR, the CA private key, the CA certificate, and the config file:
openssl x509 -req -in compty-tmp.csr -CA myCA.pem -CAkey myCA.key \
-CAcreateserial -out compty-tmp.crt -days 825 -sha256 -extfile compty-tmp.ext