Switch de comando Openssl para automação de assinatura de certificado

1

Eu sei que ao trabalhar com o openssl você pode ignorar o entrada interativa por:

  • -passin pass: whatever
  • -passout pass: whatever
  • -subj "/ C = pa / ST = pa / L = pa / O = pa / UO = pa / CN = pa"

No entanto, ao assinar um certificado, goste de:

openssl ca -config intermediate/openssl.cnf \
        -passin pass:whatever \
        -extensions usr_cert -days 375 -notext -md sha256 \
        -in intermediate/csr/www.example.com.csr.pem \
        -out intermediate/certs/www.example.com.cert.pem

Eu preciso digitar "y" duas vezes:

            ....
            X509v3 Authority Key Identifier: 
                keyid:96:7B:52:E6:FC:53:53:F0:F3:D1:B3:EB:FB:5C:95:4D:73:BD:B8:5D

            X509v3 Key Usage: critical
                Digital Signature, Non Repudiation, Key Encipherment
            X509v3 Extended Key Usage: 
                TLS Web Client Authentication, E-mail Protection

Certificate is to be certified until Jul 12 14:00:14 2017 GMT (375 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated

Existe um switch de linha de comando openssl que automatiza isso ?

    
por Konrad Eisele 02.07.2016 / 21:22

1 resposta

1

De man ca :

   -batch
       this sets the batch mode. In this mode no questions will be asked
       and all certificates will be certified automatically.

Como um aparte, man openssl tem a dizer sobre o uso de pass: para o argumento de frase secreta:

   pass:password
             the actual password is password. Since the password is
             visible to utilities (like 'ps' under Unix) this form should
             only be used where security is not important.
    
por 03.07.2016 / 10:39