From 4485aa56a8bc5e37a1ecc7caaab10eeb354c76ab Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Sun, 9 Jun 2024 14:39:45 +0200 Subject: op-mode: T6424: ipsec: honor certificate CN and CA chain during profile generation In e6fe6e50a5c ("op-mode: ipsec: T6407: fix profile generation") we fixed support for multiple CAs when dealing with the generation of Apple IOS profiles. This commit extends support to properly include the common name of the server certificate issuer and all it's paren't CAs. A list of parent CAs is automatically generated from the "PKI" subsystem content and embedded into the resulting profile. (cherry picked from commit d65f43589612c30dfaa5ce30aca5b8b48bf73211) --- data/templates/ipsec/ios_profile.j2 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'data') diff --git a/data/templates/ipsec/ios_profile.j2 b/data/templates/ipsec/ios_profile.j2 index a9ae1c7a9..935acbf8e 100644 --- a/data/templates/ipsec/ios_profile.j2 +++ b/data/templates/ipsec/ios_profile.j2 @@ -48,10 +48,10 @@ ServerCertificateIssuerCommonName - {{ ca_cn }} + {{ ca_common_name }} ServerCertificateCommonName - {{ cert_cn }} + {{ cert_common_name }} AuthenticationMethod Certificate @@ -83,24 +83,22 @@ -{% if certs is vyos_defined %} +{% if ca_certificates is vyos_defined %} -{% for cert in certs %} - +{% for ca in ca_certificates %} + PayloadIdentifier - org.{{ cert.ca_cn | lower | replace(' ', '.') | replace('_', '.') }} + org.{{ ca.ca_name | lower | replace(' ', '.') | replace('_', '.') }} PayloadUUID - {{ cert.ca_cn | generate_uuid4 }} + {{ ca.ca_name | get_uuid }} PayloadType com.apple.security.root PayloadVersion 1 PayloadContent - - {{ cert.ca_cert }} - + {{ ca.ca_chain }} {% endfor %} {% endif %} -- cgit v1.2.3