forked from debops/ansible-pki
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request debops#19 from drybjed/ca-certificates-management
Support for /etc/ca-certificate.conf management
- Loading branch information
Showing
6 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Changelog | ||
========= | ||
|
||
v0.1.0 | ||
------ | ||
|
||
*Unreleased* | ||
|
||
- Add support for managing the list of active Root CA Certificates in | ||
``/etc/ca-certificates.conf``. Current set of active Root CA Certificates is | ||
preserved. [drybjed] | ||
|
||
- Blacklist CNNIC Root CA following the `Google decision to remove CNNIC`_ from | ||
their Root CA store. [drybjed] | ||
|
||
.. _Google decision to remove CNNIC: http://googleonlinesecurity.blogspot.com/2015/03/maintaining-digital-certificate-security.html | ||
|
||
- Add Changelog. [drybjed] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
|
||
- name: Set default trust policy for new certificates | ||
debconf: | ||
name: 'ca-certificates' | ||
question: 'ca-certificates/trust_new_crts' | ||
vtype: 'select' | ||
value: '{{ pki_system_ca_certificates_trust_new }}' | ||
|
||
- name: Get list of known certificates | ||
shell: grep -E -e '^[^#].*$' /etc/ca-certificates.conf | sed -e 's/^!//' | ||
register: pki_register_ca_certificates_known | ||
changed_when: False | ||
|
||
- name: Get list of untrusted certificates | ||
shell: grep -E -e '^!+' /etc/ca-certificates.conf | sed -e 's/^!//' | ||
register: pki_register_ca_certificates_untrusted | ||
changed_when: False | ||
|
||
- name: Get list of trusted certificates | ||
shell: grep -E -e '^[^#!].*$' /etc/ca-certificates.conf | sed -e 's/^!//' | ||
register: pki_register_ca_certificates_trusted | ||
changed_when: False | ||
|
||
- name: Get list of blacklisted certificates | ||
shell: grep -E -e '{{ pki_system_ca_certificates_blacklist | join("' -e '") }}' /etc/ca-certificates.conf | sed -e 's/^!//' | ||
register: pki_register_ca_certificates_blacklist | ||
changed_when: False | ||
when: pki_system_ca_certificates_blacklist is defined and pki_system_ca_certificates_blacklist | ||
|
||
- name: Get list of whitelisted certificates | ||
shell: grep -E -e '{{ pki_system_ca_certificates_whitelist | join("' -e '") }}' /etc/ca-certificates.conf | sed -e 's/^!//' | ||
register: pki_register_ca_certificates_whitelist | ||
changed_when: False | ||
when: pki_system_ca_certificates_whitelist is defined and pki_system_ca_certificates_whitelist | ||
|
||
- name: Configure system CA certificates | ||
template: | ||
src: 'etc/ca-certificates.conf.j2' | ||
dest: '/etc/ca-certificates.conf' | ||
owner: 'root' | ||
group: 'root' | ||
mode: '0644' | ||
notify: [ 'Reconfigure ca-certificates' ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This file is managed remotely, some changes might be overwritten | ||
# | ||
# This file lists certificates that you wish to use or to ignore to be | ||
# installed in /etc/ssl/certs. | ||
# update-ca-certificates(8) will update /etc/ssl/certs by reading this file. | ||
# | ||
# This is autogenerated by dpkg-reconfigure ca-certificates. | ||
# Certificates should be installed under /usr/share/ca-certificates | ||
# and files with extension '.crt' is recognized as available certs. | ||
# | ||
# line begins with # is comment. | ||
# line begins with ! is certificate filename to be deselected. | ||
# | ||
{% for rootca in pki_register_ca_certificates_known.stdout_lines|d([]) %} | ||
{% if rootca in (pki_register_ca_certificates_blacklist.stdout_lines|d([]) | intersect(pki_register_ca_certificates_whitelist.stdout_lines|d([]))) %} | ||
!{{ rootca }} | ||
{% else %} | ||
{% if rootca in (pki_register_ca_certificates_blacklist.stdout_lines|d([]) | difference(pki_register_ca_certificates_whitelist.stdout_lines|d([]))) %} | ||
!{{ rootca }} | ||
{% elif rootca in pki_register_ca_certificates_whitelist.stdout_lines|d([]) %} | ||
{{ rootca }} | ||
{% elif rootca in pki_register_ca_certificates_untrusted.stdout_lines|d([]) %} | ||
!{{ rootca }} | ||
{% elif rootca in pki_register_ca_certificates_trusted.stdout_lines|d([]) %} | ||
{{ rootca }} | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} |