easy-ca icon indicating copy to clipboard operation
easy-ca copied to clipboard

when creating a root CA, get SAN error on key creation

Open kernelsmith opened this issue 7 years ago • 7 comments

when running create-root-ca -d $ROOT_CA_DIR, on a default Raspbian distro, from current HEAD (97d849664ada49a668589cbc99e14d5818c86a66), I get a config file error during RSA key generation. I don't have the full text of the error, but it's essentially a STR_COPY:variable has no value:conf_def:584:line 91 and line 91 of ca.conf is subjectAltName = $ENV::SAN. If I export an env var SAN="DNS.1=blah" etc, the key creation, and thus create-root-ca, succeeds.

I don't know if I missed something from the README, but if I have not, something should be added to it, or a default value etc provided so an initial run doesn't fail, or if it fails, it fails with some guidance to the user.

kernelsmith avatar May 15 '17 20:05 kernelsmith

Yep that's definitely a bug. Creating a root CA should at least work with the default values.

bubbapizza avatar Jun 15 '17 12:06 bubbapizza

The issue is caused by newer versions of OpenSSL which enforce subjectAltName in all certificates. I worked around by adding something like this in bin/create-root-ca:

...
40 source ${HOME}/bin/defaults.conf
41 export SAN=$CA_DOMAIN # set SAN to make new OpenSSL happy
...

Certainly some thought needs to be spent on a sane default for this.

hakt0r avatar Sep 21 '17 19:09 hakt0r

@redredgroovy any chance of getting this or something similar merged?

kernelsmith avatar Oct 26 '17 17:10 kernelsmith

@redredgroovy anything? @hakt0r any chance you could create a pull request to this repo from your fork? It looks like the pull request you created on Sep 21, 2017 is against your own fork

kernelsmith avatar Jan 11 '18 00:01 kernelsmith

So I tried @hakt0r 's fix, made a presumptive PR (sorry about that) and it still isn't working. I'm looking forward to a solution though, I really need this to work right now ;-) Thanks.

rdammkoehler avatar Apr 12 '18 22:04 rdammkoehler

OK, now I have a PR that works, https://github.com/redredgroovy/easy-ca/pull/3 . Sorry again @hakt0r but I gotta get it working.

rdammkoehler avatar Apr 12 '18 23:04 rdammkoehler

I can confirm that #3 works for me

KrzysztofHajdamowicz avatar Oct 26 '18 12:10 KrzysztofHajdamowicz