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

other_certificates is not pulling all certs in file #149

Closed
krobertson71 opened this issue Nov 29, 2020 · 3 comments · Fixed by #166
Closed

other_certificates is not pulling all certs in file #149

krobertson71 opened this issue Nov 29, 2020 · 3 comments · Fixed by #166

Comments

@krobertson71
Copy link

Here is my ansible cfg

  • name: Generate PFX file
    become: yes
    become_user: "{{ app_user }}"
    community.crypto.openssl_pkcs12:
    action: export
    path: "{{ sslpath }}/{{ fqdn_v }}/{{ fqdn_v }}.pfx"
    friendly_name: "{{ fqdn_v }}"
    privatekey_path: "{{ sslpath }}/{{ fqdn_v }}/{{ fqdn_v }}.key"
    certificate_path: "{{ sslpath }}/{{ fqdn_v }}/{{ fqdn_v }}.crt"
    other_certificates: "{{ sslpath }}/{{ fqdn_v}}/{{ InCommon_crt }}"
    passphrase: "{{ pfx_pass }}"
    state: present
    mode: "0644"

the "InCommon_crt" contains the whole chain, but when it goes and reads the .crt it only pulls the first certificate entry it finds:

There are 3 sets of certs in the InCommon.crt file.

All being and end with:

-----BEGIN CERTIFICATE-----

-----END CERTIFICATE-----

@krobertson71
Copy link
Author

I did manage a workaround by breaking the chain cert into 3 different certs and was able to load them all with "other_certificates". Would like for the module to pull all 3 certs from the original file if possible.

@felixfontein
Copy link
Contributor

If someone is interested in implementing this, here's some code which could be used: https://github.com/ansible-collections/community.crypto/blob/main/plugins/modules/certificate_complete_chain.py#L192-L218 It probably makes sense to refactor this to have a function which splits a string into a list of strings, each containing one certificate.

@felixfontein
Copy link
Contributor

resolved_by_pr #166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants