Skip to content

Commit

Permalink
Get openssl version, if > v3, use the -legacy option for pkcs12 relat…
Browse files Browse the repository at this point in the history
…ed openssl tasks to fix macos/ios install issues (trailofbits#14558)

original solution from https://github.com/omgagg/algo
  • Loading branch information
ExtremeModerate committed Jul 8, 2023
1 parent 1c80cd2 commit 86c315f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions roles/strongswan/tasks/openssl.yml
Expand Up @@ -155,10 +155,27 @@
format: OpenSSH
with_items: "{{ users }}"

- name: Gather the package facts
ansible.builtin.package_facts:
manager: auto

- name: Get OpenSSL version
shell: |
set -o pipefail
{{ openssl_bin }} version |
cut -f 2 -d ' '
register: ssl_version
run_once: true

- name: Set OpenSSL version fact
set_fact:
openssl_version: "{{ ssl_version.stdout }}"

- name: Build the client's p12
shell: >
umask 077;
{{ openssl_bin }} pkcs12
{{ (openssl_version is version('3', '>=')) | ternary('-legacy', '') }}
-in certs/{{ item }}.crt
-inkey private/{{ item }}.key
-export
Expand All @@ -175,6 +192,7 @@
shell: >
umask 077;
{{ openssl_bin }} pkcs12
{{ (openssl_version is version('3', '>=')) | ternary('-legacy', '') }}
-in certs/{{ item }}.crt
-inkey private/{{ item }}.key
-export
Expand Down

0 comments on commit 86c315f

Please sign in to comment.