From patchwork Thu May 28 17:58:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 3143 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 49XwSK6qgnz43xJ for ; Thu, 28 May 2020 17:59:13 +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 49XwSG51zmz38K; Thu, 28 May 2020 17:59:10 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 49XwSG3q72z2yjB; Thu, 28 May 2020 17:59:10 +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 49XwSB0hnrz2ywK 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 49XwS95tgXz2L5; Thu, 28 May 2020 17:59:05 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1590688745; 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=SPeYk9K66jDdQWcCYnjcoTjXH8bmWk2CRiXSanvKFko=; b=n/5r7ENfiPngw/cxKfC6ufjlBBIaDmjR7I+ctnhCv//A5rR0C2vrXrXcTUZqc0viZb6nHq h16jEO41i4DfG2BQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1590688745; 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=SPeYk9K66jDdQWcCYnjcoTjXH8bmWk2CRiXSanvKFko=; b=fd7Q1WJ8sH1o9KYB/+6jvuR4oQjvXI+dCf7kYVKRnZUeHtZdlzjzsixg3uJ/iabCwLQgGb I/K64EnCkW2YkY6FSQqi2Dpl/bz/BC4fwsSwe1chAvqp76J3ENU66Dn8YFX4c3CLObgJWU k9MGpUelxqhQYk30kl+sQ+juP5IOB3XgxW80r1OxlcB/IS20npfD/uBuhv3oyKnlwO9e2c C7HU8pUNxEEGjTJbkYt2ZKufaCI/vb5s699REj4YpkAFYOo41yQpNw6NR1dAqRLTCtNgwr zgQihRNlmSB8hVlriz5mermlZY6eeMFCASU1scKHiJt3In4u1dJDV4rGpNeedw== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 08/16] IPsec: Apple: Add desired cipher suites to profiles Date: Thu, 28 May 2020 17:58:42 +0000 Message-Id: <20200528175850.12638-9-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 | 110 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi index 816136c92..7011454fa 100644 --- a/html/cgi-bin/vpnmain.cgi +++ b/html/cgi-bin/vpnmain.cgi @@ -126,6 +126,35 @@ $cgiparams{'INTERFACE_ADDRESS'} = ""; $cgiparams{'INTERFACE_MTU'} = 1500; &Header::getcgihash(\%cgiparams, {'wantfile' => 1, 'filevar' => 'FH'}); +my %APPLE_CIPHERS = ( + "aes256gcm128" => "AES-256-GCM", + "aes128gcm128" => "AES-128-GCM", + "aes256" => "AES-256", + "aes128" => "AES-128", + "3des" => "3DES", +); + +my %APPLE_INTEGRITIES = ( + "sha2_512" => "SHA2-512", + "sha2_384" => "SHA2-384", + "sha2_256" => "SHA2-256", + "sha1" => "SHA1-160", +); + +my %APPLE_DH_GROUPS = ( + "768" => 1, + "1024" => 2, + "1536" => 5, + "2048" => 14, + "3072" => 15, + "4096" => 16, + "6144" => 17, + "8192" => 18, + "e256" => 19, + "e384" => 20, + "e521" => 21, +); + ### ### Useful functions ### @@ -1264,6 +1293,87 @@ END print " \n"; } + # IKE Cipher Suite + print " IKESecurityAssociationParameters\n"; + print " \n"; + + # Encryption + foreach my $cipher (split(/\|/,$confighash{$key}[18])) { + # Skip all unsupported ciphers + next unless (exists $APPLE_CIPHERS{$cipher}); + + print " EncryptionAlgorithm\n"; + print " $APPLE_CIPHERS{$cipher}\n"; + last; + } + + # Integrity + foreach my $integrity (split(/\|/,$confighash{$key}[19])) { + # Skip all unsupported algorithms + next unless (exists $APPLE_INTEGRITIES{$integrity}); + + print " IntegrityAlgorithm\n"; + print " $APPLE_INTEGRITIES{$integrity}\n"; + last; + } + + # Diffie Hellman Groups + foreach my $group (split(/\|/,$confighash{$key}[20])) { + # Skip all unsupported algorithms + next unless (exists $APPLE_DH_GROUPS{$group}); + + print " DiffieHellmanGroup\n"; + print " $APPLE_DH_GROUPS{$group}\n"; + last; + } + + # Lifetime + my $lifetime = $confighash{$key}[16] * 60; + print " LifeTimeInMinutes\n"; + print " $lifetime\n"; + print " \n"; + + # ESP Cipher Suite + print " ChildSecurityAssociationParameters\n"; + print " \n"; + + # Encryption + foreach my $cipher (split(/\|/,$confighash{$key}[21])) { + # Skip all unsupported ciphers + next unless (exists $APPLE_CIPHERS{$cipher}); + + print " EncryptionAlgorithm\n"; + print " $APPLE_CIPHERS{$cipher}\n"; + last; + } + + # Integrity + foreach my $integrity (split(/\|/,$confighash{$key}[22])) { + # Skip all unsupported algorithms + next unless (exists $APPLE_INTEGRITIES{$integrity}); + + print " IntegrityAlgorithm\n"; + print " $APPLE_INTEGRITIES{$integrity}\n"; + last; + } + + # Diffie Hellman Groups + foreach my $group (split(/\|/,$confighash{$key}[23])) { + # Skip all unsupported algorithms + next unless (exists $APPLE_DH_GROUPS{$group}); + + print " DiffieHellmanGroup\n"; + print " $APPLE_DH_GROUPS{$group}\n"; + last; + } + + # Lifetime + my $lifetime = $confighash{$key}[17] * 60; + print " LifeTimeInMinutes\n"; + print " $lifetime\n"; + print " \n"; + + # Left ID if ($confighash{$key}[9]) { print " LocalIdentifier\n";