Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2644976pxb; Fri, 5 Nov 2021 02:08:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMfrtIhk9dcSgkrZK34gYqPWJ48juGfY9FJ6p86QP92f+dUKZjMVjdkJnwZAZJA/dEpzNY X-Received: by 2002:a05:6602:1550:: with SMTP id h16mr39374629iow.125.1636103288593; Fri, 05 Nov 2021 02:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636103288; cv=none; d=google.com; s=arc-20160816; b=RaDqw80pkRN6X+/hO0rRkHOeLNegcBpjbO7yF3G/F1oAcn8YMQkiD+hFEQ35R1J5Oa 3pONOyg3zbecA/Z5AbtS8pdJh+5mPdfShPwCIbrldmJ04xzbHig0jfYuBJzDAnTSPnu7 J4a7OYpmHqPiAUztPxXSXillye32rRFGP0QVm1LmVs3bRvByQOyZkQzckiaijJFR5bPl r4d3+H9uc3QZGe38T1pvIIbV4NHoAaXho/O/Npqnwq5cfCey0K3J/i5sxiNI5T0lTT+d tMlSpwvJgOeck+QCPEZMqM3l26zO/btJBsvPuHdABFcmJU7z9X7jbO1KFUyuurEuwsQO jegg== 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=miJ0rDj8jMHnmzBCgBZcLItm2609iMUpxmfr/aGoC+4=; b=0rGhcA02xrqehApxC/v+X2GYXnIEwD1kted2f7LXGAhhgTS0+7dHLDo+ztnVXlEzZS JdkPsRGYl1Lk4y6H3oWJN6PkjzV8lbDKvf1Df7aYvm+6MqcoLNUlMQ8PLxJVexGisowg 6hQuzwemhnCn3oD9Wg5w/BsXYzYhjRdQNqQf26KHR4FtluddrzYoRlG+X6S5ynyZAamg eG9UiZU49lrkq0V0J3aLrzKUeQ6VQwK7EnIAsnKAMO3K9QDZKEFFpA7szZ9oknq6hQh/ 2+wAp3xCHQy/S8gprjs8XHgVojjl4+Aj6yIYnXjr5sJBQAFNYCYdCMigCz/hHoxY3c60 eq7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T0vvh3k6; 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 v20si14789575jat.116.2021.11.05.02.07.43; Fri, 05 Nov 2021 02:08:08 -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=20210112 header.b=T0vvh3k6; 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 S232803AbhKEIwp (ORCPT + 99 others); Fri, 5 Nov 2021 04:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232788AbhKEIwo (ORCPT ); Fri, 5 Nov 2021 04:52:44 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CFADC061203; Fri, 5 Nov 2021 01:50:05 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id v11so28044703edc.9; Fri, 05 Nov 2021 01:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=miJ0rDj8jMHnmzBCgBZcLItm2609iMUpxmfr/aGoC+4=; b=T0vvh3k6Fzd+A1OCPPxaQy6lxJQov68G5vCdJfRHGu++rPUoyTkXzI/me20ALqTrgZ MLjj3v3kqH3HlfdN5yJnQrrZfUnlzs/r8Or99ExWO7nkNR8NkthaSJOCrwysX2kRBrDG 8/RfMVLFdId7tRb7ckR5Qj0xmYv/yL9Hd8Uajl3x/5K2co88Rb5hwAL+1eLy96k2Bg9k BWpvsnmIPN46U9PKrX18NKgw7SS5Gz6cKJUp8ATfN4fJUngJA8cd10agPnavKg2wJeUF 5XqzHAzGhPWNx9E3X2Dzu9x5BQy//71WawqDJ/p3vEb41mMOpVvqZcfe+P+wIczkvfmq udXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=miJ0rDj8jMHnmzBCgBZcLItm2609iMUpxmfr/aGoC+4=; b=x/VpVuToMGVRllf+Ca2DdYHL+ml94YxxgB/gon7dlXVXlDC9XAjl4xD27JCC5eU1jr vjWxZRiBSWk5s+g26Qx1HxM6AFC3c+ItqZyHurI2VbbLz31d8PkOeb06cXGEeXkKSNbz A76wlmjUdYPLrPUJXEE+2lWdzTM4slCSziEt3O6lVXYAEcHNVhP/wW0mC31BnMLi3AgX BThh8/ofSvuiwpEAiwdP4dgVnw2/VzGN/qA99UrUMS7d4of12eFBkC/P3D74KF2/iESE eYAfTfu9Z3bm32X0aPJOH0bRAdH73Mye0W0t0J5NEmV+imkpjfWAkmc3eFcUk4FbpGsJ cmcQ== X-Gm-Message-State: AOAM532AFvRysDnWloTFCBhA0gbyl4HJdHBF1X9irkVTK9qQqpeVcuEY 0il7+zFBywAzAK6UAQKgMCU= X-Received: by 2002:a50:fd0d:: with SMTP id i13mr56131907eds.309.1636102204050; Fri, 05 Nov 2021 01:50:04 -0700 (PDT) Received: from ?IPv6:2a04:241e:501:3870:9439:4202:183c:5296? ([2a04:241e:501:3870:9439:4202:183c:5296]) by smtp.gmail.com with ESMTPSA id bw25sm3808303ejb.20.2021.11.05.01.50.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Nov 2021 01:50:03 -0700 (PDT) Subject: Re: [PATCH v2 09/25] tcp: authopt: Disable via sysctl by default To: David Ahern , Dmitry Safonov <0x7f454c46@gmail.com>, Eric Dumazet Cc: "David S. Miller" , Herbert Xu , Kuniyuki Iwashima , Hideaki YOSHIFUJI , Jakub Kicinski , Yuchung Cheng , Francesco Ruggeri , Mat Martineau , Christoph Paasch , Ivan Delalande , Priyaranjan Jha , netdev@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , linux-hardening@vger.kernel.org, Kees Cook References: <137399b962131c278acbfa5446a3b6d59aa0547b.1635784253.git.cdleonard@gmail.com> <019e96b5-4047-6458-0cfa-c9ef8f0d0470@gmail.com> From: Leonard Crestez Message-ID: Date: Fri, 5 Nov 2021 10:50:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <019e96b5-4047-6458-0cfa-c9ef8f0d0470@gmail.com> 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 11/3/21 4:39 AM, David Ahern wrote: > On 11/1/21 10:34 AM, Leonard Crestez wrote: >> diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c >> index 97eb54774924..cc34de6e4817 100644 >> --- a/net/ipv4/sysctl_net_ipv4.c >> +++ b/net/ipv4/sysctl_net_ipv4.c >> @@ -17,10 +17,11 @@ >> #include >> #include >> #include >> #include >> #include >> +#include >> >> static int two = 2; >> static int three __maybe_unused = 3; >> static int four = 4; >> static int thousand = 1000; >> @@ -583,10 +584,19 @@ static struct ctl_table ipv4_table[] = { >> .mode = 0644, >> .proc_handler = proc_douintvec_minmax, >> .extra1 = &sysctl_fib_sync_mem_min, >> .extra2 = &sysctl_fib_sync_mem_max, >> }, >> +#ifdef CONFIG_TCP_AUTHOPT >> + { >> + .procname = "tcp_authopt", >> + .data = &sysctl_tcp_authopt, >> + .maxlen = sizeof(int), >> + .mode = 0644, >> + .proc_handler = proc_dointvec, > > Just add it to the namespace set, and this could be a u8 (try to plug a > hole if possible) with min/max specified: > > .maxlen = sizeof(u8), > .mode = 0644, > .extra1 = SYSCTL_ZERO, > .extra2 = SYSCTL_ONE > > > see icmp_echo_enable_probe as an example. And if you are not going to > clean up when toggled off, you need a handler that tells the user it can > not be disabled by erroring out on attempts to disable it. This is deliberately per-system because the goal is to avoid possible local privilege escalations by reducing the attack surface. Even the smallest flaw could be exploited by a malicious application establishing an authenticated connection on loopback. Applications running in containers frequently have full access to sysctls so making this per-namespace would defeat the original purpose. I can't think of any reason to prevent using this feature at the namespace level, it has no interesting effects outside TCP connections for which it is enabled. I also believe that as similar sysctl would be useful for TCP-MD5. You're right about adding additional prints. -- Regards, Leonard