-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Custom extended key usage for PKI #4667
Changes from 1 commit
218bf7b
f981461
bfc8700
ac2f7ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,6 +166,12 @@ To remove all key usages from being set, set | |
this value to an empty list.`, | ||
}, | ||
|
||
"ext_key_usage_oids": &framework.FieldSchema{ | ||
Type: framework.TypeCommaStringSlice, | ||
Default: []string{}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't set an empty default here -- it's done automatically! |
||
Description: `A comma-separated string or list of extended key usage oids.`, | ||
}, | ||
|
||
"use_csr_common_name": &framework.FieldSchema{ | ||
Type: framework.TypeBool, | ||
Default: true, | ||
|
@@ -451,6 +457,7 @@ func (b *backend) pathRoleCreate(ctx context.Context, req *logical.Request, data | |
UseCSRCommonName: data.Get("use_csr_common_name").(bool), | ||
UseCSRSANs: data.Get("use_csr_sans").(bool), | ||
KeyUsage: data.Get("key_usage").([]string), | ||
ExtKeyUsageOIDs: data.Get("ext_key_usage_oids").([]string), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a check on the values similar to the PolicyIdentifiers check below? That way we'll know there won't be an error when generating a cert, instead of silently ignoring it. |
||
OU: data.Get("ou").([]string), | ||
Organization: data.Get("organization").([]string), | ||
Country: data.Get("country").([]string), | ||
|
@@ -588,6 +595,7 @@ type roleEntry struct { | |
RequireCN bool `json:"require_cn" mapstructure:"require_cn"` | ||
AllowedOtherSANs []string `json:"allowed_other_sans" mapstructure:"allowed_other_sans"` | ||
PolicyIdentifiers []string `json:"policy_identifiers" mapstructure:"policy_identifiers"` | ||
ExtKeyUsageOIDs []string `json:"ext_key_usage_oids" mapstructure:"ext_key_usage_oids"` | ||
BasicConstraintsValidForNonCA bool `json:"basic_constraints_valid_for_non_ca" mapstructure:"basic_constraints_valid_for_non_ca"` | ||
|
||
// Used internally for signing intermediates | ||
|
@@ -616,6 +624,7 @@ func (r *roleEntry) ToResponseData() map[string]interface{} { | |
"key_type": r.KeyType, | ||
"key_bits": r.KeyBits, | ||
"key_usage": r.KeyUsage, | ||
"ext_key_usage_oids": r.ExtKeyUsageOIDs, | ||
"ou": r.OU, | ||
"organization": r.Organization, | ||
"country": r.Country, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,10 @@ export default DS.Model.extend({ | |
defaultValue: 'DigitalSignature,KeyAgreement,KeyEncipherment', | ||
editType: 'stringArray', | ||
}), | ||
extKeyUsageOIDs: attr({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ext_key_usage_oids will get "camelized" to |
||
label: 'Custom extended key usage OIDs', | ||
editType: 'stringArray', | ||
}), | ||
requireCn: attr('boolean', { | ||
label: 'Require common name', | ||
defaultValue: true, | ||
|
@@ -223,7 +227,7 @@ export default DS.Model.extend({ | |
'allowedDomains', | ||
], | ||
}, | ||
{ 'Extended Key Usage': ['serverFlag', 'clientFlag', 'codeSigningFlag', 'emailProtectionFlag'] }, | ||
{ 'Extended Key Usage': ['serverFlag', 'clientFlag', 'codeSigningFlag', 'emailProtectionFlag', 'extKeyUsageOIDs'] }, | ||
{ | ||
Advanced: ['generateLease', 'noStore', 'basicConstraintsValidForNonCA', 'policyIdentifiers'], | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be in
signCertificate
too