Skip to content

Commit

Permalink
Certificate revocation fix (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
gunph1ld authored and dguido committed Nov 12, 2017
1 parent b64f682 commit f18c1a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion roles/vpn/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
service: name=netfilter-persistent state=restarted

- name: rereadcrls
shell: ipsec rereadcrls
shell: ipsec rereadcrls; ipsec purgecrls
24 changes: 19 additions & 5 deletions roles/vpn/tasks/openssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,35 @@
-passin pass:"{{ easyrsa_CA_password }}"
-revoke certs/{{ item }}.crt
-out crl/{{ item }}.crt
register: gencrl
args:
chdir: configs/{{ IP_subject_alt_name }}/pki/
creates: crl/{{ item }}.crt
executable: bash
when: item not in users
with_items: "{{ valid_certs.stdout_lines }}"

- name: Genereate new CRL file
shell: >
{{ openssl_bin }} ca -gencrl
-config <(cat openssl.cnf <(printf "[basic_exts]\nsubjectAltName=DNS:{{ IP_subject_alt_name }}"))
-passin pass:"{{ easyrsa_CA_password }}"
-out crl/algo.root.pem
when:
- gencrl is defined
- gencrl.changed
args:
chdir: configs/{{ IP_subject_alt_name }}/pki/
executable: bash
delegate_to: localhost
become: no

- name: Copy the revoked certificates to the vpn server
- name: Copy the CRL to the vpn server
copy:
src: configs/{{ IP_subject_alt_name }}/pki/crl/{{ item }}.crt
dest: "{{ config_prefix|default('/') }}etc/ipsec.d/crls/{{ item }}.crt"
when: item not in users
with_items: "{{ valid_certs.stdout_lines }}"
src: configs/{{ IP_subject_alt_name }}/pki/crl/algo.root.pem
dest: "{{ config_prefix|default('/') }}etc/ipsec.d/crls/algo.root.pem"
when:
- gencrl is defined
- gencrl.changed
notify:
- rereadcrls

0 comments on commit f18c1a0

Please sign in to comment.