Score:0

How to create create certificate using OpenSSL from powershell without user prompt for passphrase?

id flag

I'm setting up a development VDI, and need to automate creations of some certificates for accessing https://{foo}.local (127.0.0.1) websites duing dev and testing.

I'm only allowed to use OpenSSL and powershell and it must be unnattended, need to run this to automate setting up a developer VDI, so cannot have any user prompts.

I found lots of code with the following type of example but cant find a way to pass in the passphrase to use;

this is what I have so far...

openssl 
   req -x509 -newkey rsa:4096 -keyout 
   openssl.key -out openssl.crt -subj /CN=website.name 
   -days 300

this would then be followed by creating the actual certificate

openssl pck12 -export .... etc

As mentioned, I need to be able to provide a passphrase so that the above runs without any user intervention. The above code runs as expected, just ...kicks up the prompt for passphrase.

i've tried various -passin {xyz} even -password pass:mysecret et al settings, to no avail.

Any ideas? Txs, A

Score:1
in flag

Add the parameter -nodes to your openssl command.

openssl 
   req -x509 -newkey rsa:4096 -nodes -keyout 
   openssl.key -out openssl.crt -subj /CN=website.name 
   -days 300

This will skip the encryption of the private key. You will not be prompted for a passphrase.

id flag
such a simple solution, exactly what I needed, thank you.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.