Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4990265pxv; Tue, 27 Jul 2021 23:50:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFyP2uPU9auYc70nPkiDtd4K60iEdnnTLd7e8+gJC0fTkwSRHaCuYtbYh1idh5UVqtDGj+ X-Received: by 2002:a17:907:2d28:: with SMTP id gs40mr2683419ejc.193.1627455033155; Tue, 27 Jul 2021 23:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627455033; cv=none; d=google.com; s=arc-20160816; b=nlwE2rldnLg9VS5+gd66lrJeC2WeoDMD3wVio1evI5BvLRi6s4leFe7bp39L7lEah0 K1B6quC6eIQQrGpkftkp2LmiqMqkXuLYtgjTPCIq23uTRCSd+mAJnW4Y7xGbEMVN1BNA M4SwuBaQsM6veQLd6rBhlotpvEsXYRbgYdeA0sqmXifLxrqZOSc+YrbHdGSn5uEDF3lV TJ/tPkV+s04AYInW3UsJXmKDM/+onACBtjEv8QdgzWhk15CIQRGBi1pEwgyhxf5Pf5D7 lIujNfdL+3o3qFc/i9i6OM4Sc/wlq8evvuoz2Y5ENOVbbsMsXgiwhYAXT+dNPKSiU2G1 Iv4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=4QAhzd/W0r8TJvQ/tpkZasgmlrwwDur43nPhrGFrRIA=; b=nqQOPRCAfr44opM4KIh8Y8nxVtcwMprEIJV4hhkZrF1+A1bqFiXlXn4d10LxzeLe7a cePKcwDqhvgae7B1qGOqgawcxxb5mmEpmt5w5Kgn1NBPqdmdYCa5yeTrKZSNrASkD12X zmaarfFaxcLJKk9AscsBGh/VNNk5d/64DM144/zzChwmX3MCmr7ehKKathjjuB5QYgrY sV5+/iLM9yo23CQjMd6B3xWXZqLhIPuk5MBVNydtFopBVl21wIJQ0cblmoINHsEQdnbx vAg+8YSIVl+V+ReDLPMQFuBr75q1PXYjboTIy3FVqEGLeh9TdskC0zD+Fk5YBHgQKEmE w02g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pyzMPjnp; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si5089160ejn.556.2021.07.27.23.50.03; Tue, 27 Jul 2021 23:50:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pyzMPjnp; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234122AbhG1GuC (ORCPT + 99 others); Wed, 28 Jul 2021 02:50:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234930AbhG1GuA (ORCPT ); Wed, 28 Jul 2021 02:50:00 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1177C061757; Tue, 27 Jul 2021 23:49:17 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id b9so1126508wrx.12; Tue, 27 Jul 2021 23:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4QAhzd/W0r8TJvQ/tpkZasgmlrwwDur43nPhrGFrRIA=; b=pyzMPjnpqh3TLRmWRVavu271u1CyT3f5MOJE+UznBFg6IY1mrVCqsx+lG6YhkOzobg 0aLRr9cMLbK675LA3c3mke+hrsbK6nUE1VQzyjBZiQw/j/UooMA2AtjR8M0riPgwkZBG aaAsY5TbuSLFjCJ1Bsx+g7Yrm8ag2ffq42OnNN30W/nuz/g/y5CmMnmJn18Zhb9WNhjI vGFTYCq4P8iCW+xzjHgjwvmG0vbwOBHBLjunmtnVY+brR+5So/oya/k4g41IEkYp/ZGk z8L8MhEe62BFPUYA/rZvCrNG2kL6eXNg58rkl0xz1WK0Jy7g++FhyHYI6KY0KXe0xfDj KIQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4QAhzd/W0r8TJvQ/tpkZasgmlrwwDur43nPhrGFrRIA=; b=QjKoI0nDpJdFWLZaIHpqg3mXIaW+FpYKH3xsjV7WJSHLG9qUKZnPk/fUx80zflfV9J TAiRl3lcQY3a6uXpgq6G/ROzMjBGPc61tvnRl1tcaNS3LN4a6y5YEceiMG9IPSsMNduX kUJ4Mj6bSi/w0r5TLdYuIfLfZfS1bjBuGD0/bEBsOxhzgSZkOiigSi6EejF5xvAUuRc3 E6ErpCSlMB24KhDOQo6bZlaS64lnCOEfYsHzkIWE+6cJTavCWjggWDiyE1jhLyjYNgCK pCr7Do3Dx+Z3znN1JAYIVbeH6icifRDc0kF55Hrm3LB7Srrfpv/EKPt15Y5fh7W6j+Vp IZwg== X-Gm-Message-State: AOAM531QIT2oj43KM7XO25WeKMKDOVIvocu/yvIVSGdy2QE5qr6tf9FQ HtY31LSVkKQXGH3x7/gtBw8= X-Received: by 2002:adf:cd86:: with SMTP id q6mr27839488wrj.422.1627454956496; Tue, 27 Jul 2021 23:49:16 -0700 (PDT) Received: from [10.30.0.16] ([188.241.83.98]) by smtp.gmail.com with ESMTPSA id k6sm4495714wrm.10.2021.07.27.23.49.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Jul 2021 23:49:15 -0700 (PDT) Subject: Re: [RFC] tcp: Initial support for RFC5925 auth option To: Francesco Ruggeri Cc: David Ahern , Eric Dumazet , "David S. Miller" , Herbert Xu , Hideaki YOSHIFUJI , Jakub Kicinski , David Ahern , Yuchung Cheng , Mat Martineau , Christoph Paasch , Priyaranjan Jha , Kuniyuki Iwashima , Menglong Dong , open list , linux-crypto@vger.kernel.org, netdev , Salam Noureddine , Bob Gilligan , Dmitry Safonov References: <01383a8751e97ef826ef2adf93bfde3a08195a43.1626693859.git.cdleonard@gmail.com> <3afe618a-e848-83c3-2cc5-6ad66f3ef44b@gmail.com> From: Leonard Crestez Message-ID: Date: Wed, 28 Jul 2021 09:49:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 7/27/21 11:23 PM, Francesco Ruggeri wrote: > On Tue, Jul 27, 2021 at 11:06 AM Leonard Crestez wrote: >> On 7/27/21 6:05 AM, Francesco Ruggeri wrote: >>> Hi Leonard, >>> >>> thanks for taking on this task! >>> >>>> I'm especially interested in feedback regarding ABI and testing. >>> >>> I noticed that the TCP connection identifier is not part of the >>> representation of the MKT (tcp_authopt_key_info). >>> This could cause some issues if, for example 2 MKTs with different >>> in the TCP connection identifier but same >>> KeyID (recv_id) are installed on a socket. In that case >>> tcp_authopt_inbound_key_lookup() may not pick the correct MKT for the >>> connection. Matching incoming segments only based on recv_id may not >>> comply with the RFC. >>> I think there may be other cases where TCP connection identifiers may >>> be needed to resolve conflicts, but I have to look at your patch in >>> more detail. >> >> The RFC doesn't specify what the "tcp connection identifier" needs to >> contains so for this first version nothing was implemented. >> >> Looking at MD5 support in linux the initial commit only supported >> binding keys to addresses and only relatively support was added for >> address prefixes and interfaces. Remote ports still have no effect. >> >> I think adding explicit address binding for TCP-AO would be sufficient, >> this can be enhanced later. The most typical usecase for TCP auth is to >> connect with a BGP peer with a fixed IP address. >> >> As far as I understand this only actually matters for SYN packets where >> you want a single listen socket to accept client using overlapping >> keyids. For an active connection userspace can only add keys for the >> upcoming destination. > > The RFC does not seem to put any restrictions on the MKTs used with a > TCP connection, except that every segment must match at most one MKT, > where the matching is done on the socket pair and for incoming > segments on the KeyID, and for outgoing segments by designating a > desired MKT. > If I understand what you suggest for the initial commit, socket pair > matching would not be done, and user level (together with out-of-band > coordination between peers) would be responsible for making sure that > the segments' socket pairs are consistent with the implied socket > pairs of the MKTs on the socket. Failure to do that would be > considered a misconfiguration and would result in undefined behavior. > Is that correct? All MKTs are assigned to individual sockets via setsockopt, there is no sharing of keys. For an established connection the socket is already determined by linux TCP stack based on addr/port so no further matching on per-key address needs to be done. The only interesting cases are: 1) Keys in SYN packets are possibly ambiguous. Current limitation is that a server socket needs all key ids to be different and this is indeed bad. 2) User is currently allowed to configure same keyid multiple times. RFC does not allow this and behavior is undefined. > Even if the MKT's socket pair is not used in the initial commit, would > it help having it in the API, to avoid future incompatibilities with > user level? Or would it be understood that user level code using the > initial commit may have to change with future commits? The rules used to distinguish keys in SYN packets can be further elaborated by extending the uapi tcp_authopt_key structure. Increasing the size of a structure doesn't break ABI if you're careful with length checks. -- Regards, Leonard