dakshshah96 / local-cert-generator

🚀 A set of scripts to quickly generate a HTTPS certificate for your local development environment.
968 stars 237 forks source link

Error when running createSelfSigned.sh #2

Closed Asuza closed 6 years ago

Asuza commented 6 years ago

Thanks for the guide and repo!

When running sh createSelfSigned.sh, I get the following error:

createSelfSigned.sh: 2: createSelfSigned.sh: Syntax error: "(" unexpected

After tweaking the script to remove the parens and redirect, it works, and looks like this:

#!/usr/bin/env bash
openssl req -new -sha256 -nodes -out server.csr -newkey rsa:2048 -keyout server.key -config server.csr.cnf
openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 500 -sha256 -extfile v3.ext

My openssl version is 1.0.2g, running on Ubuntu Linux 17.10.

kishoretulsiani commented 6 years ago

I also got the same issue, workaround is to run first command with no -config option and enter all the required details on the screen

`

!/usr/bin/env bash

openssl req -new -sha256 -nodes -out server.csr -newkey rsa:2048 -keyout server.key openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 500 -sha256 -extfile v3.ext `

adoussot commented 6 years ago

it's because sh is an old shell, which doesn't seems to support Process Substitution, <() . You can do either:

dakshshah96 commented 6 years ago

@Asuza @kishoretulsiani This should be fixed in #3 😄

Thanks @adoussot 🎉