From patchwork Thu May 28 17:58:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 3149 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 49XwSS5lTDz43xD for ; Thu, 28 May 2020 17:59:20 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 49XwSK3fx4z3Gg; Thu, 28 May 2020 17:59:13 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 49XwSK2Ft1z2yvq; Thu, 28 May 2020 17:59:13 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 49XwSB4RzRz2ycL for ; Thu, 28 May 2020 17:59:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 49XwSB3nwHz286; Thu, 28 May 2020 17:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1590688746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MiTRfFQnqy1dvgp+TIIAb/liSbKWxcHo0yPzD+2SnJU=; b=V0PVCiodnQjLnoXXkAM25V3FqZekce6XRKhGcOzr+NptqIb/YnB2SMdjze+eRQMDDU5vzg xFp82HGYxSs+FFeeddh+Iv2OqrOzyAch1uRA9nCL+ZX8VeJzJhazolPLXF4qJ/DP06Y9ku 0HCJ+FBtYECFgOybqdx5vMzH7h9QjAXtHr4U06X2wsFJdy27hExGal73hWJQoLXXlLIqSP CQO8mnr4ZvYWkFDOSuHOSzfzWFskhYaDT6bgxhn6IOSPTRpL9AUvPzTg6tK881m0GkFB/X wwLlSRN6+TMEg7ZyPp++vFFEkKfwyW8jsMNkaxxaB0JhYCRNLWCpJw+dqFtRsA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1590688746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MiTRfFQnqy1dvgp+TIIAb/liSbKWxcHo0yPzD+2SnJU=; b=SN/mrVBCqNdKS2OLoWWNpLkcs/ElKiS594ZTYfCEzJaeMXucCSOu4Z20ppMDqgLaNOEuQE CkSWKcy3Vpa5kbAA== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 16/16] IPsec: Add CA certificate in Apple profile Date: Thu, 28 May 2020 17:58:50 +0000 Message-Id: <20200528175850.12638-17-michael.tremer@ipfire.org> In-Reply-To: <20200528175850.12638-1-michael.tremer@ipfire.org> References: <20200528175850.12638-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Michael Tremer --- html/cgi-bin/vpnmain.cgi | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi index bcbe6227e..fa97ed531 100644 --- a/html/cgi-bin/vpnmain.cgi +++ b/html/cgi-bin/vpnmain.cgi @@ -1246,13 +1246,23 @@ END my $uuid1 = $uuid->create_str(); my $uuid2 = $uuid->create_str(); + my $ca = ""; + my $ca_uuid = $uuid->create_str(); + my $cert = ""; my $cert_uuid = $uuid->create_str(); - # Read and encode certificate + # Read and encode the CA & certificate if ($confighash{$key}[4] eq "cert") { + my $ca_path = "${General::swroot}/ca/cacert.pem"; my $cert_path = "${General::swroot}/certs/$confighash{$key}[1].p12"; + # Read the CA and encode it into Base64 + open(CA, "<${ca_path}"); + local($/) = undef; # slurp + $ca = MIME::Base64::encode_base64(); + close(CA); + # Read certificate and encode it into Base64 open(CERT, "<${cert_path}"); local($/) = undef; # slurp @@ -1465,6 +1475,25 @@ END print " \n"; print " \n"; + + print " \n"; + print " PayloadIdentifier\n"; + print " org.example.ca\n"; + print " PayloadUUID\n"; + print " ${ca_uuid}\n"; + print " PayloadType\n"; + print " com.apple.security.root\n"; + print " PayloadVersion\n"; + print " 1\n"; + print " PayloadContent\n"; + print " \n"; + + foreach (split /\n/,${ca}) { + print " $_\n"; + } + + print " \n"; + print " \n"; } print " \n";