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

Implement support for x509 extra extensions #76

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AbdulRahmanAlHamali
Copy link

This PR provides the ability to add arbitrary extensions to certificates and certificate requests, by providing their OID, whether they are critical or not, and their value.

The value of the extension is serialized into Abstract Syntax Notation One (ASN.1)

The PR only implements a few of the possible types for value, but makes it very easy to add more types upon demand.

Please let me know what you think, looking forward to the review.

Regards,

Type: schema.TypeInt,
Description: "Fill this field if the extension value should be encoded as an ASN.1 INTEGER",
Optional: true,
ForceNew: true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the ConflictsWith attribute to make sure that only one is set:

ConflictsWith: []string{"boolean_value", "printable_string_value", "utf8_string_value"},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Didn't know about this

Optional: true,
ForceNew: true,
},
"type": {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have all the ConflictsValue set right, you no longer need this since only one of the values above will be set. The GetOk method should give you the result and ok (whether or not the value has been set by the user)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work unfortunately. ConflictsWith does not work on nested resources:
hashicorp/terraform-plugin-sdk#71

And I can't call GetOk on a nested resource, because it is returned to me as a map instead of as ResourceData

@@ -43,7 +45,25 @@ func TestCertRequest(t *testing.T) {
uris = [
"spiffe://example-trust-domain/workload",
"spiffe://example-trust-domain/workload2",
]
]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting seems weird here

@hashicorp-cla
Copy link

hashicorp-cla commented Nov 22, 2020

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


AbdulRahman AlHamali seems not to be a GitHub user.
You need a GitHub account to be able to sign the CLA. If you already have a GitHub account, please add the email address used for this commit to your account.

Have you signed the CLA already but the status is still pending? Recheck it.

@Karthikeyanraman94
Copy link

HI Team, can we have this merged, we literally need this feature for one of our client certificate

@Karthikeyanraman94
Copy link

@julienduchesne : Could you please help this feature go live... We actually require OID feature for few of our client certs.. And this will be more helpfull

Base automatically changed from master to main February 1, 2021 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants