Search code examples
gitbashopensslmingw-w64

Cannot generate a new CSR in git bash


I'm trying to generate SSL on Get Https For Free

And I'm following stepts on git bash(git version 2.9.3.windows.2, mingw64) but stucked on a step 2, Certificate Signing Request.

I typed command following

openssl req -new -sha256 -key domain.key -subj "/" -reqexts SAN -config <(cat /d/Git/usr/ssl/openssl.cnf  <(printf "[SAN]\nsubjectAltName=DNS:dev.xn--p89al22awxc7t2ajoa.com,DNS:dev.stocktalk.kr"))

However, an error is annoying me.

This is error. What is the problem and how can I generate successfully?

error on line -1 of /proc/3028/fd/63
7656:error:02001003:system library:fopen:No such process:bss_file.c:175:fopen('/proc/3028/fd/63','rb')
7656:error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:178:
7656:error:0E078072:configuration file routines:DEF_LOAD:no such file:conf_def.c:195:

Solution

  • If the fancy stdin redirection for openssh config does not work, try as a workaround to:

    • copy /d/Git/usr/ssl/openssl.cnf somewhere else
    • edit it (or apply your sed's) on that new file
    • use the file directly in your openssh command:

       openssl req -new -sha256 -key domain.key -subj "/" -reqexts SAN -config new_edited_file
      

    Regarding the error Error Loading request exception section SAN, the OP Minkyu Kim reports in the comments following "Multi-Domain SSL Setup with “Subject Alternative Names”", adding:

    subjectAltName = @alt_names
    
    [ alt_names ]
    DNS.1 = www.example.com
    DNS.2 = example.com