!CcTBuBritXGywOEGWJ:matrix.org

NixOS Binary Cache Self-Hosting

167 Members
About how to host a very large-scale binary cache and more57 Servers

Load older messages


SenderMessageTime
24 Aug 2023
@brian:bmcgee.ieBMG It seems to be fetching the narinfo from the remote, adding the signature and doing a PUT back. Slight window for issues there but I imagine it's a small one 15:24:02
@brian:bmcgee.ieBMGunlikely to be adding 2 signatures at once from different sources15:24:22
@linus:schreibt.jetzt@linus:schreibt.jetztyeah I'm not sure it's possible to improve that, at least with the HTTP API15:24:53
@linus:schreibt.jetzt@linus:schreibt.jetztwait no15:24:58
@linus:schreibt.jetzt@linus:schreibt.jetztthere are headers for conditional update, aren't there?15:25:10
@brian:bmcgee.ieBMGi was just about to check for that :)15:25:18
@brian:bmcgee.ieBMGI remember e-tags but it's been a while since i looked into this15:25:42
@brian:bmcgee.ieBMGGonna capture what nix is doing to see if it's setting anything 15:25:52
@linus:schreibt.jetzt@linus:schreibt.jetztat the same time, I think it's fair enough to just not implement it15:25:55
@brian:bmcgee.ieBMGCan confirm, Nix isn't setting anything special on the request15:26:58
@brian:bmcgee.ieBMG A PATCH would technically be the 'correct' way to do this I guess 15:27:29
@brian:bmcgee.ieBMGOr it looks like ETag and If-Match is how you can prevent this https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag#avoiding_mid-air_collisions15:28:56
@brian:bmcgee.ieBMGNix client would refresh and try again 15:29:34
@linus:schreibt.jetzt@linus:schreibt.jetztI think generally something like attic is a better approach to a binary cache anyway15:29:51
@brian:bmcgee.ieBMGattic is using it's own client right?15:31:25
@brian:bmcgee.ieBMGinstead of the http interface15:31:30
@linus:schreibt.jetzt@linus:schreibt.jetztit can serve Nix's protocol read-only as well15:31:44
@brian:bmcgee.ieBMGMakes sense now why Domen did it aswell15:32:00
@brian:bmcgee.ieBMGthe http interface is fine for read15:32:11
@brian:bmcgee.ieBMGnot that great for the writes15:32:18
@brian:bmcgee.ieBMGFor context, I'm playing around with my own cache implementation which is why I'm interested 15:33:05
@linus:schreibt.jetzt@linus:schreibt.jetztone thing I'd like to have in Attic is the ability to have signatures from the client in addition to server-managed signing keys15:34:12
@brian:bmcgee.ieBMGHave it merge on upload?15:34:34
@linus:schreibt.jetzt@linus:schreibt.jetztwell currently attic just stores a single signature for each narinfo (which is a database table entry, not an actual file), and that signature is generated by the server at upload time15:36:02
@linus:schreibt.jetzt@linus:schreibt.jetztbut it means that you have to trust the server much more than if the client could provide its own signatures15:36:24
@brian:bmcgee.ieBMGmakes sense, also what happens with key rotation on the server 15:37:06
@linus:schreibt.jetzt@linus:schreibt.jetztkey rotation is generally a tricky topic with nix https://github.com/NixOS/rfcs/pull/14915:37:58
@zhaofeng:zhaofeng.liZhaofeng Li
In reply to @linus:schreibt.jetzt
well currently attic just stores a single signature for each narinfo (which is a database table entry, not an actual file), and that signature is generated by the server at upload time

The signature is generated at download time using the the per-cache private key managed by the server. It does store client-supplied signatures in the database but they aren't exposed at the moment. I wrote a bit more here: https://github.com/zhaofengli/attic/issues/80#issuecomment-1684347741

(oh right, forgot to respond)

15:40:33
@zhaofeng:zhaofeng.liZhaofeng Li So we can easily have client-managed signatures now by changing how narinfo is generated (need to fix serialization for multiple signatures), but I'd prefer to have a complete story UX-wise (the client should be able to automatically sign on upload) 15:42:27
@zhaofeng:zhaofeng.liZhaofeng Li
In reply to @brian:bmcgee.ie
makes sense, also what happens with key rotation on the server
You currently can rotate the server-managed key with attic cache configure --regenerate-keypair, but all clients who download need to reconfigure their trusted public keys
15:44:35

Show newer messages


Back to Room ListRoom Version: 10