1

I am generating a root certificate with a bash script.

I have a rootCA_openssl.cnf file with the configuration data:

rootCA_openssl.cnf

[ req ]
distinguished_name = req_distinguished_name
req_extensions = v3_req

[ req_distinguished_name ]
countryName = NO
countryName_default = NO
stateOrProvinceName = Stavanger
stateOrProvinceName_default = Stavanger
organizationName = Stavanger Info
organizationName_default = Stavanger Info
commonName = 88.5.44.3
commonName_default = 88.5.44.3

[ v3_req ]
basicConstraints = CA:true
keyUsage = critical, keyCertSign

Generate RSA

openssl genrsa -aes256 -out rootCA.key --passout pass:password 2048

Create a CSR (Certificate Signing Request) file for root CA certificate

When I try to generate a CSR file Ubuntu promps me with the configuration.

openssl req -new -key rootCA.key -out rootCA.csr -config rootCA_openssl.cnf --passin pass:password

This is what Ubuntu asks me for:

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
NO [NO]:

I am going to run the command in a bash script, so I cannot press enter on the keyboard for the questions.

How can I run openssl req without beeing asked for this?

1
  • Why is your common name an IP address? It's usually the name of your root CA, such as "Stavanger Root CA", or if you plan multiple CAs, "Stavanger Root CA1". Technically, an IP address works, but it's not common practice. Commented Jun 25 at 11:47

1 Answer 1

0

You need to add prompt = no to your [ req ] section.

From the man page:

prompt
If set to the value no this disables prompting of certificate fields and just takes values from the config file directly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .