Re: [IPsec] WGLC of draft-ietf-ipsecme-labeled-ipsec

Paul Wouters <paul@nohats.ca> Thu, 04 November 2021 17:29 UTC

Return-Path: <paul@nohats.ca>
X-Original-To: ipsec@ietfa.amsl.com
Delivered-To: ipsec@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 81F5F3A117F for <ipsec@ietfa.amsl.com>; Thu, 4 Nov 2021 10:29:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Level:
X-Spam-Status: No, score=-2.097 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nohats.ca
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i8UXkKji-3Lv for <ipsec@ietfa.amsl.com>; Thu, 4 Nov 2021 10:29:09 -0700 (PDT)
Received: from mx.nohats.ca (mx.nohats.ca [IPv6:2a03:6000:1004:1::85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1A40C3A117D for <ipsec@ietf.org>; Thu, 4 Nov 2021 10:29:08 -0700 (PDT)
Received: from localhost (localhost [IPv6:::1]) by mx.nohats.ca (Postfix) with ESMTP id 4HlVxC6xfmz3BD; Thu, 4 Nov 2021 18:29:03 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nohats.ca; s=default; t=1636046943; bh=058SNNGo/GqZHXGdvjlWiXJ5NdFHVnpBiDw3W8L/j5A=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=XHT/LlDusO5twJBEZEmurLFyg58cCRCO/FVCSc9B8uMg0g4/yJljBTMZozdJVq0DQ Q01JcpKDzuqkQT/2gPMGpBGxElDqtmcOjqp1aNwFE37/Es0a5aaoR4UBxWdp/qJ9L2 fTTI0C4vsWIkEd4jOWGLvLPIRJyxxN0UooT1bcQE=
X-Virus-Scanned: amavisd-new at mx.nohats.ca
Received: from mx.nohats.ca ([IPv6:::1]) by localhost (mx.nohats.ca [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 1wLgCiPit4VJ; Thu, 4 Nov 2021 18:29:02 +0100 (CET)
Received: from bofh.nohats.ca (bofh.nohats.ca [193.110.157.194]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.nohats.ca (Postfix) with ESMTPS; Thu, 4 Nov 2021 18:29:02 +0100 (CET)
Received: by bofh.nohats.ca (Postfix, from userid 1000) id 9D8861308EE; Thu, 4 Nov 2021 13:29:01 -0400 (EDT)
Received: from localhost (localhost [127.0.0.1]) by bofh.nohats.ca (Postfix) with ESMTP id 99ACD1308ED; Thu, 4 Nov 2021 13:29:01 -0400 (EDT)
Date: Thu, 04 Nov 2021 13:29:01 -0400
From: Paul Wouters <paul@nohats.ca>
To: Valery Smyslov <smyslov.ietf@gmail.com>
cc: ipsec@ietf.org, 'Tero Kivinen' <kivinen@iki.fi>
In-Reply-To: <093501d7d0b1$dd0db1d0$97291570$@gmail.com>
Message-ID: <4066a22d-fe4b-e27f-3350-f41ab91ff76@nohats.ca>
References: <24831.15082.263253.443690@fireball.acr.fi> <2d1501d799ba$af76bc40$0e6434c0$@gmail.com> <ed3d346-8f66-620-1914-d55e0dd9f2c@nohats.ca> <080101d7cfc5$88f62a60$9ae27f20$@gmail.com> <d297ab6c-a182-3d51-e0b5-ccd7b09dcda8@nohats.ca> <093501d7d0b1$dd0db1d0$97291570$@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"; format="flowed"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ipsec/7VZx5oqhgJ0q_eB91Q8u8kV0JfU>
Subject: Re: [IPsec] WGLC of draft-ietf-ipsecme-labeled-ipsec
X-BeenThere: ipsec@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Discussion of IPsec protocols <ipsec.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ipsec>, <mailto:ipsec-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ipsec/>
List-Post: <mailto:ipsec@ietf.org>
List-Help: <mailto:ipsec-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ipsec>, <mailto:ipsec-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 04 Nov 2021 17:29:15 -0000

On Wed, 3 Nov 2021, Valery Smyslov wrote:

> It can represent optionality of the security label.

An optional security label has no meaning. If you have
a real case of optional security labels, lets year it. Otherwise,
I think we should move on without supporting optional security
labels. From a security point of view, it just makes no sense. From
a migration point of view, it can be done without further protocol
support.

>> It is too ambiguous with "no security label". It makes
>> common sense to me to simply not allow it. And comparing a 0 size NULL
>> with a zero byte also seems just way to risky.
>
> I failed to understand why do you think implementers are so stupid,
> that even such a primitive task would run them into problems.

Experience reading and acting on opensource code ?

>> Ideally, I would have
>> stated "a minimum length of one non-zero octet".
>>
>> I guess we need to get other people's opinion on this.
>
> OK, let's wait for other opinions.

Okay, good.

>> In our implementation you can define two "conns", one with and one
>> without. And choosing the right one will work. On the responder, there
>> is a connection switching mechanism that can switch to the better
>> matching connection once the TS payloads are read from IKE_AUTH. So
>> first you add all the conns with sec_label. And after a while, you can
>> just remove all the conns without sec_label.
>
> When upgraded initiator contacts not yet upgraded responder this won't work.

Correct. this assumes you have an established system of updating
configurations, like cloud/terraform based, or puppet or system roles
or ansible or what not.

> To make this case workable the initiator must implement a complex logic
> (first it tries TS with seclabels, then it receives TS_UNACCEPTABLE,
> which BTW may come due to any reason, but it guesses that it may be
> due to seclabels, and perform another attempt with no seclabels).
> This logic complicates IKEv2 state machine and may lead to more
> serious implementation errors.

I don't think this is a change to the state machine. It is a change
to the allowed configuration and/or default action. No state machine
changes are needed.

You can simple choose to not support the unlikely use case. Security
labels are dictated to systems _before_ you are allowed to access them.
The hypothetical upgrade case is not a real life deployment scenario.

Still, with todays automated (cloud) deployments, you first upgrade the
required software, then upgrade the required configuration files, then
let machines switch to the new behaviour.

> If you make TS_SECLABLE with no data an indication,
> that seclabels are optional for this connection, then it would
> require require minimum changes to IKE state machine and in fact
> is much safer with regard to implementation errors.

I fail to see how it would be safer to include a mechanism for
allowing for mismatched configurations to establish a less secure
connection ?

> And more efficient from protocol point of view.

Thie claimed efficiency is for a use case (upgrading via optional
security labels without configuration change) that I just don't see
a real life use case for. And it comes at a cost of complexity and
error handling of configuration mismatch cases that would be more
likely, not less likely, to be prone to errors.


>>>> Changed. Old text:
>>>>
>>>>     A responder that selected a TS with TS_SECLABEL MUST use the Security
>>>>     Label for all selector operations on the resulting IPsec SA.  It MUST
>>>>     NOT select a TS_set with a TS_SECLABEL without using the specified
>>>>     Security Label, even if it deems the Security Label optional, as the
>>>>     initiator TS_set with TS_SECLABEL means the initiator mandates using
>>>>     that Security Label.
>>>>
>>>> New text:
>>>>
>>>>     A responder that selected a TS with TS_SECLABEL MUST use the Security
>>>>     Label for all selector operations on the resulting TS. It MUST
>>>>     NOT select a TS_SECLABEL without using the specified Security Label,
>>>>     even if it deems the Security Label optional, as the initiator has
>>>>     indicated (and expects) that Security Label will be set for all
>>>>     traffic matching the negotiated TS.
>>>
>>> I'm a bit confused with the part of \new text:
>>>
>>> "...all selector operations on the resulting TS."
>>> What do you mean? Did you mean
>>> "on the resulting Traffic Selector"?
>>> Or am I missing something?
>>
>> I mean to say, if you pick a TS with TS_SECLABEL, you MUST have a
>> security label as part of your SPD selector mechanism. You cannot
>> decide to ignore it and only use IP address based SPD selectors.
>
> Isn't it obvious?

It is. But I wanted to clarify it because it might be that the IKE
daemon needs to "do something" to make that happen that goes beyond
installing an IPsec SA. I'm okay to leave it out.

>> In our implementation, using the selector means _setting_ the SElinux
>> context (sec_label) on the decrypted packet before releasing it to the
>> OS for further processing by the application. The application might make
>> security decisions based on the sec_label, so not "applying" the sec_label
>> negotiated would be a security violation of the negotiated policy.
>>
>> That is, things might appear to work but in fact might be working
>> without sec_label security and the remote peer has no way of detecting
>> this. It is trusting the peer to apply the security policy to the
>> packets.
>>
>> If you have a suggested text you prefer, please let me know.
>
> No, I just was wondering why you replaced "IPsec SA" with "TS" in this sentence.

Ok.

>>>> (I avoided talking about IPsec SA or Child SA, as one of those _may_
>>>> include multiple different TS'es)
>>>
>>> So what? I think that the essence of this text is that if TS_SECLABEL
>>> is used, then it is applied for the whole Traffic Selector for this Child SA.
>>> Am I missing the essence?
>>
>> I avoided talking about IPsec / Child SA because different ones can have
>> different negotiated TS_SECLABELS - eg they can be independent from the
>> exchange we are talking about. (I think we are saying the same thing?)
>
> Of course different IPsec SAs can have different Traffic Selectors.
> But you talked not about any IPsec SA, but about the IPsec SA that
> resulted from negotiation, which included Traffic Selector with seclabels:
>
> Old text.
>
>     A responder that selected a TS with TS_SECLABEL MUST use the Security
>     Label for all selector operations on the resulting IPsec SA.
>                                                                       ^^^^^^^^^^^^^^^^^^
>
> I think, that this sentence is more clear than the corresponding one from new text
> (the rest of new text is OK).

I'm okay removing it.

> Well, I still don't think that the idea, that this document defines a behavior
> for not yet defined TS_TYPEs and will need to be updated if the defined
> behavior is wrong, is a good engineering approach. But I can live with it.

I agree that RFC 7296 should have thought about it and specified it for
to be designed TS_TYPEs, but it didn't. So here we are.

> OK. I seem to understand the source of my confusion.
>
> With first para of Section 3.2 you seem to imply the following negotiation scenario:
>
> Initiator:
>   TSi = (TS_SECLABEL="nfs-client", TS_SECLABEL="nfs-server")
>   TSi = (TS_SECLABEL="nfs-client", TS_SECLABEL="nfs-server")
>
> Responder:
>   TSi = (TS_SECLABEL="nfs-client")
>   TSi = (TS_SECLABEL="nfs-server")
>
> Am I right?

No. Our implementation never uses more than one sec_label, due to the
nature of the sec_label. In our case, it basically comes from an ACQUIRE
message, so the IKE daemon has no way of determining that the reply to
a packet we send would require a different sec_label by the remote peer.
In fact, the IKE daemon does not even know if the reply traffic would
match the inbound SA sec-label or not. The remote peer's sec-label will
receive its own ACQUIRE if the return traffic has another sec-label set,
and will negotiate a second IPsec SA that only differs in label.


> If you mean this case, then it's a major change what the semantics of traffic selectors currently is.

I don't mean that.

> You seem to imply that with regard to seclabels matching the following logic applies:
> for outgoing packet to match SPD only TSi should be checked on initiator
> and only TSr on responder and visa versa for incoming packet.
> But this is not how it is defined in RFC7296 and how it works now -
> both TSi and TSr are checked for any packet.

I do not imply that.

> Unless I'm missing something and my speculations above are wrong,

It is.

> Either remove the possibility of having different seclabels in TSi and TSr
> or add clarification and describe, that this is another update for RFC 7296
> (and probably for 4301 too).

I do not believe our SElinux based labeled IPsec should limit how people
can use security labels in general.

Paul