Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Nov 2019 06:50:59 +0800
From:      Ben Woods <woodsb02@gmail.com>
To:        Hiroki Sato <hrs@allbsd.org>
Cc:        brooks@freebsd.org, driesm.michiels@gmail.com, freebsd-net@freebsd.org,  hrs@freebsd.org, julian@freebsd.org, roy@marples.name
Subject:   Re: DHCPv6 client in base
Message-ID:  <CAOc73CAMvh4dcN9c3tGaS2uu6C_OsbaTOT94dcQxgzcA4xp1vQ@mail.gmail.com>
In-Reply-To: <20191015.215732.1618848784026596315.hrs@allbsd.org>
References:  <CAOc73CBzvRD0Je5%2BXQJ9_UqTP2_cgJvc7_7JTU0fjKBCVnTt-w@mail.gmail.com> <20191014.043209.919156653743886519.hrs@allbsd.org> <f3c51ba5-ebad-4f2f-2ae5-ab08055f6b6b@marples.name> <20191015.215732.1618848784026596315.hrs@allbsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 15 Oct 2019 at 9:00 pm, Hiroki Sato <hrs@allbsd.org> wrote:

> Roy Marples <roy@marples.name> wrote
>   in <f3c51ba5-ebad-4f2f-2ae5-ab08055f6b6b@marples.name>:
> ro> Sorry if it was not clear. The discussion involves what is the
> ro> required acceptance for Priviledge Seperation because this is quite
> ro> new to me.
> ro>
> ro> My current idea is to open DHCP, IPv6RA and DHCP6 ports, chroot, drop
> ro> privs and fork. This concept is pretty standard thus far. These are
> ro> listening ports only and will dry-run any received message through
> ro> dhcpcd's two commons paths:
> ro>   1) extract address and routing information without applying it
> ro>   2) environment option generation from the whole message
>
>  A typical separation is three process model which contains
>  processes for 1) sending/accepting packets (and parsing them), 2)
>  state machine for each protocol handling, and 3) global namespace
>  access (file, routing socket, network interface state, etc).  The
>  superuser privilege can be dropped in 1) and 2) completely.  1) and
>  3) communicate with 2) on demand or event-driven basis.  1) do not
>  communicate directly with 3).  Protocol-specific routines are in 1)
>  and 2)---the former handles its wire-format, and the latter deals
>  with protocol-specific state machines.
>
>  However, this is often an overkill for a small, single-protocol
>  network daemon.  A two process model which contains one for 1)+2) and
>  another for 3) above is used in sbin/dhclient, for example.  I think
>  this separation is the minimum level.  3) performs privileged tasks
>  such as ioctls for network interfaces.
>
>  I believe the three process model is appropriate for dhcpcd because
>  of the nature of multi-protocol support.  Parsing is one of the
>  attack surfaces.  For instances, a dhcp6_findoption() loop in
>  dhcp6_recv() should be in process 1 and changes of D6_STATE(ifp)
>  should be managed in process 2.  The current dhcp6_bind() directly
>  uses dhcp6_findmoption() to extract options from a DHCP message on
>  demand and also directly accesses the global namespace by using
>  dhcp6_writelease(ifp).  These packet inspection and file access can
>  be replaced with IPC requests to process 1 or 3 in the model, and it
>  can be realized without a big structural change to the original logic
>  in dhcp6.c (though it requires a certain amount of changes to the
>  current code).
>
>  In the ideal world everything should work fine and this kind of
>  separation just sounds to make the program complex unnecessary, but
>  an incomplete separation between the possible attack surfaces and
>  access to the global namespace does not provide a good security even
>  if the superuser privilege dropped.


Hi Everyone,

FYI, Roy (upstream dhcpcd developer) has recently committed privilege
separation to dhcpcd.

It is not yet enabled by default until he gets more feedback from others
that it is working ok. I intend to update the FreeBSD port to enable this
feature (perhaps with a =E2=80=9C-devel=E2=80=9D port) to allow it to be te=
sted more easily
on FreeBSD.

Mailing list message:
https://roy.marples.name/archives/dhcpcd-discuss/0002711.html

Commit:
https://github.com/rsmarples/dhcpcd/commit/d5786118da1bad4c247631cae86344f1=
b249a8cb

Regards,
Ben

> --

--
From: Benjamin Woods
woodsb02@gmail.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOc73CAMvh4dcN9c3tGaS2uu6C_OsbaTOT94dcQxgzcA4xp1vQ>