I've been trying to use the OpenSSL line from this older thread to create a CSR with subject alternative name: Provide subjectAltName to openssl directly on command line
If I run the line from that thread directly, with hard-coded values, it works, but, I want to use that line inside a shell script with parameters for the name of the key file (and the output CSR) and for the subject name string.
So, I have a shell script that looks like this:
openssl req -new -sha256 -key $1.key -subj $2 -reqexts SAN -config <(cat /etc/pki/tls/openssl.cnf <(printf '[SAN]\nsubjectAltName=DNS:www.google.com,DNS:www.example.com')) -out $1.csr
However, when I run that shell script like this:
createServerRequestWithSAN.sh google '/C=US/O=My Company/CN=example123.com'
I get an error:
./11A-createServerRequestWithSAN.sh: line 14: syntax error near unexpected token `('
./11A-createServerRequestWithSAN.sh: line 14: `openssl req -new -sha256 -key $1.key -subj $2 -reqexts SAN -config <(cat /etc/pki/tls/openssl.cnf <(printf '[SAN]\nsubjectAltName=DNS:www.google.com,DNS:www.example.com')) -out $1.csr'
Can anyone tell me what the problem is and how to fix it?