-
How can I add extra names (DN names other than Common Name) to the generated certificate? I have heared
, the subject is empty in the certificate instead. Note that |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You may not need a template for this. Using the default template, try creating a CSR with subject names you need, and use If that doesn't work for you, please share the CSR PEM and we'll take a look. |
Beta Was this translation helpful? Give feedback.
-
Hi @bagasme, there are different ways you can do this:
{
"...": "...",
"authority": {
"template": {
"country": "US",
"organization": "Smallstep",
"organizationalUnit": "Smallstep Eng",
"locality": "San Francisco",
"province": "California",
"streetAddress": "1 The Street St",
"postalCode": "12345"
},
"...": "..."
}
}
{
"subject": {{ toJson .Insecure.CR.Subject }},
"sans": {{ toJson .SANs }},
{{- if typeIs "*rsa.PublicKey" .Insecure.CR.PublicKey }}
"keyUsage": ["keyEncipherment", "digitalSignature"],
{{- else }}
"keyUsage": ["digitalSignature"],
{{- end }}
"extKeyUsage": ["serverAuth", "clientAuth"]
}
{
"subject": {
"country": "US",
"organization": "Smallstep",
"organizationalUnit": "Smallstep Eng.",
"locality": "San Francisco",
"province": "California",
"streetAddress": "123 A St",
"postalCode": "94102",
"serialNumber": "123456789",
"commonName": {{ .Subject.CommonName | toJson }},
"extraNames": [
{"type": "1.2.840.113549.1.9.1", "value": "[email protected]"}
]
},
"sans": {{ toJson .SANs }},
{{- if typeIs "*rsa.PublicKey" .Insecure.CR.PublicKey }}
"keyUsage": ["keyEncipherment", "digitalSignature"],
{{- else }}
"keyUsage": ["digitalSignature"],
{{- end }}
"extKeyUsage": ["serverAuth", "clientAuth"]
}
a) From a flag
b) By Specific template data in your provisioner: {
"type": "ACME",
"name": "acme",
"options": {
"x509": {
"templateFile": "templates/certs/x509/subject.tpl",
"templateData": {
"country": "US",
"organization": "test",
"organizationalUnit": "lab",
"province": "California",
"locality": "Redwood City"
}
}
} and a template setting things like
c) You can also mix those with some logic:
My recommendation is to use 1 so you don't need specific templates per provisioner and all your certificates have the same DNs, except for the common name. |
Beta Was this translation helpful? Give feedback.
Hi @bagasme, there are different ways you can do this:
authority
object a new template object like this: