This Ansible role, microsoft_adcs_cert, is designed to make it easy for a Linux machine to acquire a certificate signed from a Microsoft Active Directory Certificate Services CA server.
- Ansible v2.9 or above
- requests_kerberos,krbcontext python package should be installed and available in ansible control machine. Use below command if the package is not avaialble.
pip install requests_kerberos krbcontext - CA server should be reachable from Ansible controller and 'https' webservices should be enabled and available.
- Valid Kerberos ticket TGT must be already avaliable in the controller machine by running the kinit command.
- Navigate to your ansible project's root directory.
- Clone the role using below command
git clone https://github.com/nareshhkumar512/microsoft_adcs_cert.git - Include in main play.
- hosts: localhost
gather_facts: no
connection: local
roles:
- microsoft_adcs_certRefer examples/msadcs_request_cert.yml documentation section. for more information
The role downloads the signed pem/der formatted SSL certificate file along with chains in a p7b format.
| Variable Name | Usage |
|---|---|
| ca_server | Include Fully Qualified domain name or IP address of the Microsoft Active Directory Certificate server. |
| ca_admin_user | Admin user with permission to generate certificate using template mentioned in ca_template_name variable - format user@MYDOMAIN.COM |
| credential_cachepath | Full path to credential cache file for the ca_admin_user |
| ca_template_name | Name of the certificate template to be used to sign the CSR |
| san_names | List of Subject alternative names |
| csr_file_path | Full path to the CSR file in local machine |
| cert_encoding_type | Specify certificate encoding type, current supported formats are pem or der |
- Tested only against Windows Server 2012 R2 Datacenter 64 bit Edition.
- Supply username in user@MYDOMAIN.COM format .
- Compatible with both py v2.7 and py v3.6+
- SSL Certificate file will be downloaded in the same directory as input CSR file.
- If the
cert_encoding_typeoption is set topementire certificate chain bundle will be downloaded as a.p7bfile - If the
cert_encoding_typeoption is set toderonly the leaf certificate will be downloaded as a.crtfile - Use OpenSSL command
openssl pkcs7 -print_certs -in certificate.p7b -out certificate.certo convert Convert PEM formatted P7B to PEM Certificate.
- Fundamental curl statements https://stackoverflow.com/questions/31283476/submitting-base64-csr-to-a-microsoft-ca-via-curl/39722983#39722983
- Designer Brands Inc.
-
Nate Britton (https://www.linkedin.com/in/nsbritton)
Happy to take any feedback or pull requests from others. DM me in Linkedin for questions.