cloudflare / cloudflare/cfssl

the CA cert's SAN extensions not include DNSName.

Open
#1,276 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
9.5k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I use cfssl to sign a intermedia-ca. the intermediate-ca.json has **"hosts"** config:
```json
{
"CN": "Custom Widgets Intermediate CA",
"hosts": [
"host1.custom-widgets.com",
"localhost",
"192.168.1.3"
],
"key": {
"algo": "rsa",
"size": 2048
},
"names": [
{
"C": "GB",
"L": "London",
"O": "Custom Widgets",
"OU": "Custom Widgets Intermediate CA",
"ST": "England"
}
],
"ca": {
"expiry": "42720h"
}
}
```
The signed intermedia-ca cert only include the ip address "192.168.1.3", But the dnsname ""host1.custom-widgets.com" and "localhost" not include。

I used the ca-config.json:
```json
{
"signing": {
"default": {
"expiry": "8760h"
},
"profiles": {
"intermediate_ca": {
"usages": [
"signing",
"digital signature",
"key encipherment",
"cert sign",
"crl sign",
"server auth",
"client auth"
],
"expiry": "8760h",
"ca_constraint": {
"is_ca": true,
"max_path_len": 0,
"max_path_len_zero": true
}
}
}
}
}
```

I use these command
```shell
cfssl gencert -initca intermediate-ca.json | cfssljson -bare intermediate_ca
cfssl sign -ca ca.pem -ca-key ca-key.pem -config ca-config.json -profile intermediate_ca intermediate_ca.csr | cfssljson -bare intermediate_ca
```
I found the function **FillTemplate** in the source **signer/signer.go** has these code
```go
if template.IsCA {
template.MaxPathLen = profile.CAConstraint.MaxPathLen
if template.MaxPathLen == 0 {
template.MaxPathLenZero = profile.CAConstraint.MaxPathLenZero
}
template.DNSNames = nil
template.EmailAddresses = nil
template.URIs = nil
}
```
the DNSNames set to nil.
so is this a mistake or am I missing something? Thank you!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.