Automatically generating openssl certificates

From Coder's Log

Jump to: navigation, search

To generate an openssl certificate as part of script the easiest thing to do is to use echo to supply the necessary parameters

echo -e '\n\n\n\n\n\n' | openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /tmp/vnctunnel.pem -out /tmp/vnctunnel.pem > /dev/null 2>&1 

will generate a certificate with default values, to change them you can use something like

echo -e '$1\n$2\n$3\n$4\n$5\n$6\n' | openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /tmp/vnctunnel.pem -out /tmp/vnctunnel.pem > /dev/null 2>&1 
<pre>

Where $[1-6] represent the prompts by openssl when creating certificates
Personal tools