References: <20200813072923.24385-1-eric@...1918...>
<1fb10dd1-8ddf-c467-21a5-a93e21e6a8ac@...1227...>
<0a634481-cf3b-de2f-5e34-8f5c5ef16fdc@...1918...>
From: Eric Thorpe
Message-ID: <294d779c-44a1-7f4c-c506-5f21dc76e8ac@...1918...>
Date: Tue, 25 Aug 2020 09:51:09 +1000
MIME-Version: 1.0
In-Reply-To:
Content-Type: multipart/alternative;
boundary="------------0604474FBB50D76259979902"
Content-Language: en-US
Subject: Re: [Openvpn-devel] [PATCH 1/2] Send auth-fail messages to clients
on renegotiation failures via auth-token or user-pass expiry
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: Selva Nair
Cc: Arne Schwabe , openvpn-devel
This is a multi-part message in MIME format.
--------------0604474FBB50D76259979902
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: quoted-printable
Hi Selva,
> In multi_connection_estableished, we have
>
> #ifdef MANAGEMENT_DEF_AUTH
> =C2=A0 =C2=A0 if (management)
> =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 management_connection_established(management,
> &mi->context.c2.mda_context, mi->context.c2.es );
> =C2=A0 =C2=A0 }
> #endif
> I do not see why this requires --management-client-auth or any=20
> management related options to be in use.=20
management is set to NULL unless a management address is defined=20
(--management), so the above is not called for a plugin or script
bool
open_management(struct context *c)
{
=C2=A0=C2=A0=C2=A0 /* initialize management layer */
=C2=A0=C2=A0=C2=A0 if (management)
=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (c->options.management_addr)=
<----
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ....
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 close_m=
anagement(); <----
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
I'm not trying to be resistant in finding another way here to avoid this=20
extra state you guys don't want, this is a real bug in re-auth/reneg=20
that we have seen occur multiple times in various setups that we want to=20
see fixed, and it effects management, script and plugin authentication,=20
however I have had a good walk through the code and I can't see another way.
The other alternative here is to refactor up the call chain so the=20
context_2 is passed to each of these functions instead of just multi &=20
session, however this is about a 500 line refactor that I really don't=20
want to do.
Cheers,
Eric
---
Eric Thorpe
SparkLabs Developer
https://www.sparklabs.com
https://twitter.com/sparklabs
support@...1918...
On 25/08/2020 12:25 am, Selva Nair wrote:
>
>
> On Mon, Aug 24, 2020 at 3:49 AM Eric Thorpe > wrote:
>
> Hi Selva,
>
>> my=C2=A0suggestion would be to make
>> this conditional on MANAGEMNET_DEF_AUTH so that we can
>> then get it from=C2=A0 session->opt->mda_context just as we do it wh=
en
>> auth is=C2=A0done via the management. In practice, that would cover
>> most builds where this is really useful.
> Unfortunately this doesn't help. The mda_context flags are only
> set when --management-client-auth is in use, meaning this patch
> would not cover plugin or script authentication, which are the
> more commonly used, and this patch set specifically addresses
> plugin authentication.
>
>
> Are you sure of that?
>
> In multi_connection_estableished, we have
>
> #ifdef MANAGEMENT_DEF_AUTH
> =C2=A0 =C2=A0 if (management)
> =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 management_connection_established(management,
> &mi->context.c2.mda_context, mi->context.c2.es );
> =C2=A0 =C2=A0 }
> #endif
>
> management_connection_established will set DAF_CONENCTION_ESATBLISHED=20
> in mdac->flags and that's what's used to determine REAUTH.
>
> I do not see why this requires --management-client-auth or any=20
> management related options to be in use. Sure, management support and=20
> deferred auth support have to be enabled but restricting the=20
> usefulness of your patch to those cases is not really a limitation.
>
> What am I missing?
>
> Selva
>
> ---
> Eric Thorpe
> SparkLabs Developer
> https://www.sparklabs.com
> https://twitter.com/sparklabs
> support@...1918...
>
> On 23/08/2020 12:13 pm, Selva Nair wrote:
>> Hi,
>>
>> On Thu, Aug 13, 2020 at 4:37 AM Eric Thorpe > > wrote:
>>
>> Hi Arne,
>>
>> The issue is your state is not accessible from where that
>> boolean needs
>> to be used unless I am missing something? Please advise if
>> I'm mistaken
>> or of another route.
>>
>>
>> I agree with Arne that duplicating a state machine variable is
>> not a good approach. But we have to somehow get the REAUTH (reneg)
>> info in here.
>>
>> This has stalled for too long, so my=C2=A0suggestion would be to make
>> this conditional on MANAGEMNET_DEF_AUTH so that we can
>> then get it from session->opt->mda_context just as we do it when
>> auth is=C2=A0done via the management. In practice, that would cover
>> most builds where this is really useful.
>>
>> In fact, I think we should always enable MANAGEMENT_DEF_AUTH
>> when management is enabled. That also gets rid of a lot of IFDEFs and
>> allow the use of useful bits like CID more widely in the code. I see
>> no compelling reason for such fine-grained build options.
>>
>> A marginal increase in code size is of little consequence all but
>> embedded devices which can continue to cope without this
>> as they do now.
>>
>> Selva
>
--------------0604474FBB50D76259979902
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Hi Selva,
In multi_connection_estableished, we have
#ifdef MANAGEMENT_DEF_AUTH
=C2=A0 =C2=A0 if (management)
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 management_connection_established(manag=
ement,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0
&mi->context.c2.mda_context, mi->context.c2.es);
=C2=A0 =C2=A0 }
#endif
I do not see why this requires
--management-client-auth or any management related options to be
in use.
management is set to NULL unless a management address is defined
(--management), so the above is not called for a plugin or script
bool
open_management(struct context *c)
{
=C2=A0=C2=A0=C2=A0 /* initialize management layer */
=C2=A0=C2=A0=C2=A0 if (management)
=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (c->options.manageme=
nt_addr) <----
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ....
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cl=
ose_management(); <----
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
I'm not trying to be resistant in finding another way here to
avoid this extra state you guys don't want, this is a real bug in
re-auth/reneg that we have seen occur multiple times in various
setups that we want to see fixed, and it effects management,
script and plugin authentication, however I have had a good walk
through the code and I can't see another way.
The other alternative here is to refactor up the call chain so
the context_2 is passed to each of these functions instead of just
multi & session, however this is about a 500 line refactor
that I really don't want to do.
Cheers,
Eric
---
Eric Thorpe
SparkLabs Developer
https=
://www.sparklabs.com
h=
ttps://twitter.com/sparklabs
su=
pport@...1918...
On 25/08/2020 12:25 am, Selva Nair
wrote:
Hi Selva,
my=C2=A0suggestion would be to make
this conditional on MANAGEMNET_DEF_AUTH so that we
can
then get it from=C2=A0 session->opt->mda_context
just as we do it when=C2=A0
auth is=C2=A0done via the management. In practice, that
would cover
most builds where this is really useful.
Unfortunately this doesn't help. The mda_context flags are
only set when --management-client-auth is in use, meaning
this patch would not cover plugin or script
authentication, which are the more commonly used, and this
patch set specifically addresses plugin authentication.
Are you sure of that?=C2=A0
In multi_connection_estableished, we have
#ifdef MANAGEMENT_DEF_AUTH
=C2=A0 =C2=A0 if (management)
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 management_connection_established(m=
anagement,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0
&mi->context.c2.mda_context, mi->
contex=
t.c2.es);
=C2=A0 =C2=A0 }
#endif
management_connection_established will set
DAF_CONENCTION_ESATBLISHED in mdac->flags and that's
what's used to determine REAUTH.=C2=A0
I do not see why this requires --management-client-auth
or any management related options to be in use. Sure,
management support and deferred auth support have to be
enabled but restricting the usefulness of your patch to
those cases is not really a limitation.
What am I missing?
Selva
---
Eric Thorpe
SparkLabs Developer
https://www.sparklabs.com
https://twitter.com/sparklabs
support@...1918...
On 23/08/2020 12:13 pm, Selva Nair wrote:
Hi Arne,
The issue is your state is not accessible from
where that boolean needs
to be used unless I am missing something? Please
advise if I'm mistaken
or of another route.
I agree with Arne that duplicating a state
machine variable is=C2=A0
not a good approach. But we have to somehow get
the REAUTH (reneg)=C2=A0
info in here.
This has stalled for too long, so my=C2=A0suggesti=
on
would be to make
this conditional on MANAGEMNET_DEF_AUTH so that
we can
then get it from=C2=A0
session->opt->mda_context just as we do it
when=C2=A0
auth is=C2=A0done via the management. In practice,
that would cover
most builds where this is really useful.
In fact, I think we should always enable
MANAGEMENT_DEF_AUTH
when management is enabled. That also gets rid
of a lot of IFDEFs and
allow the use of useful bits like CID more
widely in the code. I see
no compelling reason for such fine-grained
build options.
A marginal increase in code size is of little
consequence all but
embedded devices which can continue to cope
without this
as they do now.
Selva
--------------0604474FBB50D76259979902--