Is there a way to create SSL cert requests by specifying all the required parameters on the initial command? I am writing a CLI-based web server control panel and I would like to avoid the use of expect when executing
openssl if possible.
This is a typical way to create a cert request:
$ openssl req -new -newkey rsa:2048 -nodes -sha256 -keyout foobar.com.key -out foobar.com.csr Generating a 2048 bit RSA private key .................................................+++ ........................................+++ writing new private key to 'foobar.com.key' ----- 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. ----- Country Name (2 letter code) [AU]:US State or Province Name (full name) [Some-State]:New Sweden Locality Name (eg, city) :Stockholm Organization Name (eg, company) [Internet Widgits Pty Ltd]:Scandanavian Ventures, Inc. Organizational Unit Name (eg, section) : Common Name (e.g. server FQDN or YOUR name) :foobar.com Email Address :firstname.lastname@example.org Please enter the following 'extra' attributes to be sent with your certificate request A challenge password : An optional company name :FooBar
I am hoping to see something like this: (unworking example)
$ openssl req -new -newkey rsa:2048 -nodes -sha256 -keyout foobar.com.key -out foobar.com.csr \ -Country US \ -State "New Sweden" \ -Locality Stockholm \ -Organization "Scandanavian Ventures, Inc." \ -CommonName foobar.com \ -EmailAddress email@example.com \ -Company FooBar
The fine man page had nothing to say on the matter, nor was I able to find anything via Google. Must SSL cert request generation be an interactive process, or is there some way to specify all the parameters in a single command?
This is on a Debian-derived Linux distro running
opensslflags documented? ב) What did you google for to find that? Thank you!
-subjparameter is documented (not in much detail) at openssl.org/docs/apps/req.html.