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

Additional Required Attributes openssl_csr #450

Open
smatterchew opened this issue May 4, 2022 · 2 comments
Open

Additional Required Attributes openssl_csr #450

smatterchew opened this issue May 4, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@smatterchew
Copy link

SUMMARY

I need to be able to apply required attributes to the CSR to support NDES. The cert issuer is AD CS with the NDES application.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

openssl_csr

ADDITIONAL INFORMATION

The current process uses the template module to create an openssl config file:

[req]
default_bits={{ certreq_bits }}
prompt=no
default_md={{ certreq_md }}
req_extensions=req_ext
distinguished_name=dn
string_mask=nombstr
utf8=no
attributes=req_attributes

[ req_attributes ]
challengePassword={{ certreq_challenge_password }}

[ dn ]
C={{ certreq_dn_country }}
ST={{ certreq_dn_state }}
L={{ certreq_dn_location }}
O={{ certreq_dn_org }}
OU={{ certreq_dn_ou }}
CN={{ certreq_dn_cn }}

[ req_ext ]
subjectAltName=@alt_names

[ alt_names ]
{% for san in certreq_san_list %}
DNS.{{ loop.index }}={{ san }}
{% endfor %}

From research, trial, and error, the pieces I need to be able to add to the CSR from the above example are:

string_mask=nombstr
utf8=no
attributes=req_attributes

[ req_attributes ]
challengePassword={{ certreq_challenge_password }}

The next logical step is to generate the CSR.

- name: "Generate the CSR"
  become: true
  become_user: root
  command: |-
    openssl req -new -{{ certreq_md }} 
    -nodes -out {{ certreq_csr }} 
    -newkey rsa:{{ certreq_bits }} 
    -keyout {{ certreq_key }} 
    -config {{ certreq_config }}

At this point I can use sscep to submit the CSR to the NDES app on AD CS.

Using v2.2.4 of the community.crypto collection.

[ansible@ansibledev ~]$ ansible-galaxy collection list | grep community.crypto
community.crypto                    2.2.4

Thank you for your consideration.

@felixfontein felixfontein added the enhancement New feature or request label May 5, 2022
@felixfontein
Copy link
Contributor

Related to #401.

@8ar10der
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants