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

Vault PKI shouldn't sort OUs #6596

Closed
white-glider opened this issue Apr 16, 2019 · 1 comment · Fixed by #6673
Closed

Vault PKI shouldn't sort OUs #6596

white-glider opened this issue Apr 16, 2019 · 1 comment · Fixed by #6673
Assignees

Comments

@white-glider
Copy link

Describe the bug
Vault PKI alphabetically sorts all OUs when multiple ones are present in a requested CSR.

To Reproduce
Steps to reproduce the behavior:

  1. Enable the pki engine: vault secrets enable pki
  2. Generate the CSR for an intermediate CA: vault write -field=csr pki/intermediate/generate/internal country="US" organization="Hashicorp" ou="C,A,B" common_name="My CA" key_type="rsa" key_bits=4096 add_basic_constraints=true > My_CA.csr
  3. Show the subject of the generated CSR: openssl req -in My_CA.csr -noout -subject
  4. See that the three OUs will be ordered like OU = A + OU = B + OU = C

Expected behavior
Because the RDNs impose a hierarchy, the OUs should follow the order that was defined in the request, i.e. they should be ordered (in this example) like OU = C + OU = A + OU = B.

You can further inspect the CSR and verify that the OUs were actually ordered by running openssl asn1parse -i -in My_CA.csr.

Environment:

  • Vault Server Version: 1.1.1
  • Vault CLI Version: 1.1.1
  • Server Operating System/Architecture: GNU/Linux x86_64 (Ubuntu Server 18.04.2 LTS)

Vault server configuration file(s):

storage "file" {
  path = "/opt/vault/storage"
}
listener "tcp" {
  address = "127.0.0.1:8200"
  tls_disable = true
}
api_addr = "http://127.0.0.1:8200"
pid_file = "/opt/vault/vault.pid"
ui = true
raw_storage_endpoint = true

Additional context
https://en.wikipedia.org/wiki/Directory_information_tree
https://tools.ietf.org/html/rfc5280#section-4.1.2.6

@mgritter
Copy link
Contributor

mgritter commented May 6, 2019

The OUs should probably be a sequence of RDNs, not a single set, but this should really be fixed in the x509 package. The committed change preserves the order, and I verified that the set is converted into a sequence by x509 when it is parsed.

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

Successfully merging a pull request may close this issue.

2 participants