My question is quite similar to another one here but not quite the same. I have a sequence of commands to create an ssl key/crt ect. And I want to be able to create an automated, default one. These are the commands (they came from this page):
openssl genrsa -des3 -out server.key 2048
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
If each one only took one argument then it would be fine and I would do something like
openssl genrsa -des3 -out server.key 2048 <<< arg1
But one of them needs as many as 10 inputs which it asks for sequentially.
I tried something like this but it didn't work
openssl genrsa -des3 -out server.key 2048 << foo
arg1
arg2
foo
EDIT: This approach is actually working I think but not for the arguments that are supposed to be passwords. Does anyone have a workaround for that?
Could it make a difference that some of the arguments are passwords?
What is the simplest way to go about this?
man openssl
or go to their website and read the documentation for more info. Otherwise, this looks like a job forexpect
. Read up on that tool as well. – rubynorails Nov 27 '15 at 2:25