unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* K of N trust in substitutes (related to reproducible builds)
@ 2020-06-13 22:35 Christopher Baines
  2020-06-16  9:36 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Baines @ 2020-06-13 22:35 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3090 bytes --]

Hey,

So, I've finally got around to actually looking at what code changes
might be involved in changing how users of Guix substitutes trust which
substitutes to use, and which not to use. This follows on from some of
the build reproducibility metrics work that happened recently [1].

1: https://lists.gnu.org/archive/html/guix-devel/2020-06/msg00034.html

The current situation as I understand it is that as a user, you list
public keys in your ACL (access control list), and Guix will trust a
substitute from a particular cache if it can find a narinfo for that
hash with a valid signature, made with a public key listed in the
ACL. There's some useful complexity here, because you can end up
downloading substitutes from a cache you don't directly trust, but
because you trust a different cache that's generated the same substitute
(it built reproducibly).

As described above, build reproducibility is already making some useful
behaviour possible. However, there's no current way of trusting
substitutes based on the agreement of multiple substitute servers
(caches). Making that possible would allow users to reduce the risk in
using substitutes by supporting a more distributed approach to trust.

My feeling is that making some initial step forward in this area is
going to be tricky, care needs to be taken around the security and
backwards compatibility aspects. I've now got around to actually
thinking about potential ways to make parts of this happen though, and
even changed some code [2] (although I haven't actually tried to run it
yet).

2: https://git.cbaines.net/guix/log/?h=k-of-n-substitute-trust&qt=range&q=k-of-n-substitute-trust...master

As I understand, the format for the ACL is based around [3] and I was
excited to see as part of that specification is something I think might
overlap with what I describe wanting above. Specifically, the k-of-n
<subj-thresh> bit. I think this could work something like this in an
ACL:

(acl
 (entry
  (k-of-n
   2
   3
   (public-key
    (ecc
     (curve Ed25519)
     (q #5F5F4F321533D3A38F909785E682798933BA9BE257C97E5ABC07DD08F27B8DBF#)
     )
    )
   (public-key
    (ecc
     (curve Ed25519)
     (q #3AF2631C5E78F520CB1DC0D438D8D6F88EEF4B8E11097A62EE2DF390E946AED0#)
     )
    )
   (public-key
    (ecc
     (curve Ed25519)
     (q #1EEE5340C3AAD6E062A1395A88A86FC75982E8BC7DCBAE171858EEAAB14AAB77#)
     )
    )
  )
  (tag
   (guix import)
   )
  )
)

3: http://theworld.com/~cme/spki.txt

Using the above ACL, you'd trust a substitute for a path with a specific
hash if you can find 2 narinfos for that path and hash if they're signed
with keys in that entry. Multiple entries would still be supported, and
you wouldn't need to specify the k-of-n bit if you don't want to.

I'm not quite sure how expressive this is, or if there are some policies
that would be good to support that either can't be expressed, or can't
be expressed easily. There's probably other approaches, and how to
support trusting substitutes is an important part to consider.

Let me know if you have any thoughts or questions,

Thanks,

Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: K of N trust in substitutes (related to reproducible builds)
  2020-06-13 22:35 K of N trust in substitutes (related to reproducible builds) Christopher Baines
@ 2020-06-16  9:36 ` Ludovic Courtès
  2020-06-16 19:05   ` Christopher Baines
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2020-06-16  9:36 UTC (permalink / raw)
  To: Christopher Baines; +Cc: guix-devel

Hi!

Christopher Baines <mail@cbaines.net> skribis:

> My feeling is that making some initial step forward in this area is
> going to be tricky, care needs to be taken around the security and
> backwards compatibility aspects. I've now got around to actually
> thinking about potential ways to make parts of this happen though, and
> even changed some code [2] (although I haven't actually tried to run it
> yet).

Nice!

> As I understand, the format for the ACL is based around [3] and I was
> excited to see as part of that specification is something I think might
> overlap with what I describe wanting above. Specifically, the k-of-n
> <subj-thresh> bit. I think this could work something like this in an
> ACL:
>
> (acl
>  (entry
>   (k-of-n
>    2
>    3
>    (public-key
>     (ecc
>      (curve Ed25519)
>      (q #5F5F4F321533D3A38F909785E682798933BA9BE257C97E5ABC07DD08F27B8DBF#)
>      )
>     )
>    (public-key
>     (ecc
>      (curve Ed25519)
>      (q #3AF2631C5E78F520CB1DC0D438D8D6F88EEF4B8E11097A62EE2DF390E946AED0#)
>      )
>     )
>    (public-key
>     (ecc
>      (curve Ed25519)
>      (q #1EEE5340C3AAD6E062A1395A88A86FC75982E8BC7DCBAE171858EEAAB14AAB77#)
>      )
>     )
>   )
>   (tag
>    (guix import)
>    )
>   )
> )
>
> 3: http://theworld.com/~cme/spki.txt
>
> Using the above ACL, you'd trust a substitute for a path with a specific
> hash if you can find 2 narinfos for that path and hash if they're signed
> with keys in that entry. Multiple entries would still be supported, and
> you wouldn't need to specify the k-of-n bit if you don't want to.
>
> I'm not quite sure how expressive this is, or if there are some policies
> that would be good to support that either can't be expressed, or can't
> be expressed easily. There's probably other approaches, and how to
> support trusting substitutes is an important part to consider.

I would be tempted to not bake it into /etc/guix/acl.  You would still
authorize all the servers, but instead of choosing a policy that accepts
anything signed by one of them, as is currently the case, you would
choose a policy that only accepts something signed by two of them.

The policy would be implemented in (guix scripts substitute).  I haven’t
put much thought into it but it could be something akin to
‘lookup-narinfos/diverse’, roughly.

Thoughts?

Ludo’.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: K of N trust in substitutes (related to reproducible builds)
  2020-06-16  9:36 ` Ludovic Courtès
@ 2020-06-16 19:05   ` Christopher Baines
  2020-06-19 20:33     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Baines @ 2020-06-16 19:05 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]


Ludovic Courtès <ludo@gnu.org> writes:

>> 3: http://theworld.com/~cme/spki.txt
>>
>> Using the above ACL, you'd trust a substitute for a path with a specific
>> hash if you can find 2 narinfos for that path and hash if they're signed
>> with keys in that entry. Multiple entries would still be supported, and
>> you wouldn't need to specify the k-of-n bit if you don't want to.
>>
>> I'm not quite sure how expressive this is, or if there are some policies
>> that would be good to support that either can't be expressed, or can't
>> be expressed easily. There's probably other approaches, and how to
>> support trusting substitutes is an important part to consider.
>
> I would be tempted to not bake it into /etc/guix/acl.  You would still
> authorize all the servers, but instead of choosing a policy that accepts
> anything signed by one of them, as is currently the case, you would
> choose a policy that only accepts something signed by two of them.
>
> The policy would be implemented in (guix scripts substitute).  I haven’t
> put much thought into it but it could be something akin to
> ‘lookup-narinfos/diverse’, roughly.
>
> Thoughts?

I think that could work, do you have any suggestions on how that "two"
would be configured? I guess it could be a boolean on/off, but it would
be probably more extensible to just allow providing a minimum number of
substitiute servers to agree.

Thanks,

Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: K of N trust in substitutes (related to reproducible builds)
  2020-06-16 19:05   ` Christopher Baines
@ 2020-06-19 20:33     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2020-06-19 20:33 UTC (permalink / raw)
  To: Christopher Baines; +Cc: guix-devel

Hi,

Christopher Baines <mail@cbaines.net> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>>> 3: http://theworld.com/~cme/spki.txt
>>>
>>> Using the above ACL, you'd trust a substitute for a path with a specific
>>> hash if you can find 2 narinfos for that path and hash if they're signed
>>> with keys in that entry. Multiple entries would still be supported, and
>>> you wouldn't need to specify the k-of-n bit if you don't want to.
>>>
>>> I'm not quite sure how expressive this is, or if there are some policies
>>> that would be good to support that either can't be expressed, or can't
>>> be expressed easily. There's probably other approaches, and how to
>>> support trusting substitutes is an important part to consider.
>>
>> I would be tempted to not bake it into /etc/guix/acl.  You would still
>> authorize all the servers, but instead of choosing a policy that accepts
>> anything signed by one of them, as is currently the case, you would
>> choose a policy that only accepts something signed by two of them.
>>
>> The policy would be implemented in (guix scripts substitute).  I haven’t
>> put much thought into it but it could be something akin to
>> ‘lookup-narinfos/diverse’, roughly.
>>
>> Thoughts?
>
> I think that could work, do you have any suggestions on how that "two"
> would be configured? I guess it could be a boolean on/off, but it would
> be probably more extensible to just allow providing a minimum number of
> substitiute servers to agree.

There should be a procedure that takes a list of narinfos signed with an
authorized key and returns a Boolean.

Then there can be a higher-order procedure returning a predicate, like:

  (make-ratio-predicate k n)

The user-chosen predicate could live in /etc/guix/substitute-policy.scm
or similar.

Thanks,
Ludo’.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-19 20:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13 22:35 K of N trust in substitutes (related to reproducible builds) Christopher Baines
2020-06-16  9:36 ` Ludovic Courtès
2020-06-16 19:05   ` Christopher Baines
2020-06-19 20:33     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).