Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot sign csr get panic error #318

Closed
symgryph opened this issue Dec 3, 2020 · 5 comments
Closed

Cannot sign csr get panic error #318

symgryph opened this issue Dec 3, 2020 · 5 comments

Comments

@symgryph
Copy link

symgryph commented Dec 3, 2020

I generated a csr on an appliance I use, and when I use the following:

mkcert -csr my.test.csr

I get:


goroutine 1 [running]:
main.(*mkcert).fileNames(0xc000155f00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x121fc40, 0xc000066300, 0xc00042c000, 0x46b)
	/private/tmp/mkcert-20201126-82459-i1bflq/mkcert-1.4.3/src/github.com/FiloSottile/mkcert/cert.go:177 +0x3cc
main.(*mkcert).makeCertFromCSR(0xc000155f00)
	/private/tmp/mkcert-20201126-82459-i1bflq/mkcert-1.4.3/src/github.com/FiloSottile/mkcert/cert.go:266 +0x7c8
main.(*mkcert).Run(0xc000155f00, 0xc0000121d0, 0x0, 0x0)
	/private/tmp/mkcert-20201126-82459-i1bflq/mkcert-1.4.3/src/github.com/FiloSottile/mkcert/main.go:203 +0x64a
main.main()
	/private/tmp/mkcert-20201126-82459-i1bflq/mkcert-1.4.3/src/github.com/FiloSottile/mkcert/main.go:145 +0x851
@Vaka82
Copy link

Vaka82 commented Dec 7, 2020

Same issue - Any suggestions..?

@Vaka82
Copy link

Vaka82 commented Dec 8, 2020

It's panicking @ the below code as hosts slice is empty -

image

Adding this before that fileNames call seem to fix this issue for me.

if len(hosts) == 0 {
hosts = []string{csr.Subject.CommonName}
}

certFile, _, _ := m.fileNames(hosts)

@gergelyzs
Copy link

gergelyzs commented Feb 24, 2021

i have found the same issue. I believe it is because the CSR has no SAN. If you can modify your CSR, it's easy enough to circumvent. I seem to remember that having no SAN is deprecated, so this is not entirely unexpected. For me, the CSR is coming from an old iDRAC, so no way I can change it.

Fix works because it reads the CN. @Vaka82 care to make a PR?

@adippel
Copy link

adippel commented Nov 4, 2021

+1 encountered this just recently. dont know if using CN is the right way since using CN for domain names is not the right way. At least replacing the meaningless panic is a must.

@FiloSottile
Copy link
Owner

Fixed, thank you for the report. The feature to use the CN if there were no SANs was already there, but then it was trying to print the hosts from the CSR instead of the generated certificate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants