-
Notifications
You must be signed in to change notification settings - Fork 28
make zainod reproducible and use stagex build toolchain #641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
make zainod reproducible and use stagex build toolchain #641
Conversation
|
To test, you will need Docker v26.0.0+ and |
a247da8 to
5dbe7a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed this by following the instructions on an underpowered VPS, and everything seemed to work as expected!
Though I did check basic help outputs and version commands, I did not put the resulting binary through its full paces. Similarly I looked over the changes to the Dockerfile but I would like more experienced eyes on it.
This modifies our default Dockerfile in place. I'm not sure if it makes sense to do so, but an idea I had was to have this be an option instead of StageX being incorporated into the only Dockerfile available; probably with something like Dockerfile.classic Dockerfile.stagex. Perhaps this would be useful as a transtional gesture. I suspect the proposed change will break existing CI setups because it uses cargo build instead of cargo install for example.
So I approve, but to merge we probably should test more thoroughly and also look at the StageX tooling in greater detail (I only gave it a look-over) - perhaps others from ZL (@zancas @nachog00 ?) can come and try this out.
A few points to @antonleviathan about this PR at this moment:
Documentation is still needed.
I'd also like to see build.sh renamed to something more clearly StageX oriented, because it is not a 'core' Zaino utility. Similar thought for the build directory (and maybe Dockerfile itself).
One other detail I noticed was that the resulting binary was dated Jan 1 1970, if it's possible it might be nice to have the resulting binary's timestamp set to when it's created.
These all seem like small points, and it's probable someone from ZL could make these changes themselves either as a PR into your branch or more directly.
StageX is a drop in replacement for distributions like Alpine and Debian, providing the same software, but built more securely. If you decide to have multiple different images that's fine, but it's redundant. |
|
Building Ideally, you have a team of several people who do the reproduction, and sign the resulting hashes (this is what Bitcoin core does for each release) using well managed PGP keys (ideally never exposed to memory and only stored on smart cards), and make those hashes available with each release. Keyoxide is a nice way to build trust in PGP keys btw. The ultimate way to verify StageX is to read the part of the tree that's relevant to you, for example the bootstrapping stages for compilers, and rust, and then build it yourself and check that the hashes match what's published here. I know it's a lot but I'm happy to support around this if there is interest. Just upgrading to the toolchain and making the software deterministic is already a good start though. |
The date always has to be the same or the software will not be reproducible. You can set it to some different value per release, but that's state you have to manage, so it's best to not touch that. The value there is relatively low vs the security gains. Of course, if you decide, you can update the build date for each release, or as desired. |
|
Let me know what you would like to see in terms of documentation! Happy to write up whatever you feel is missing butt he idea is that there should be a |
|
Great comments. We'll be discussing them in ZingoLabs. Thank you very much @antonleviathan ! |
maliciously |
REPORTTLDR:StageX is an advanced, container-native distribution specifically made to provide tooling for bootstrapping and reproducibility. It aims to eliminate 'single points of failure' along the software supply chain, using their own multi-party trust for all released packages. I think highly of this project, but it is still relatively novel and with some rough edges. In my view, at this time this PR should be modified to create a second, clearly labeled Dockerfile for StageX, along with its novel scripts, and merged in with our existing code. Using the StageX project would be a significant improvement on our current setup BUT currently StageX cannot build Detailed information and further suggestions below. OverviewFor StageX background/overview: I learned some things by reading the whitepaper in draft form, and by working with building StageX directly. I'm happy to try to answer questions, but @antonleviathan has been active here and Distrust has some active chat channels as well. The idea is bootstrapping up from a very minimal assembler with This PR does not renovate Zanio testing, or change BenefitsWhat would Zaino get from using StageX:
ChangesBUILD Containers RUNTIME container A number of bash scripts are also in the PR. Concerns
Recommendations
Stop the presses!News Flash! Sighting of (draft - working?!) Rust This is 0 day news! Maybe we could get this working now in short order. Footnotes
|
|
One other thing I forgot to put down here - perhaps it is possible to leverage some kind of auditing via Least Authority, who have some kind of arrangement to spend time on zec related projects in an ongoing way. The assertion from StageX is that Stage0 could be audited by someone competent in a handful of hours. Because there is no public audit currently, this sounds like a ripe possibility. Maybe they could even go higher into the stages too, time permitting. |
|
To enable the needed see this document for details. |
Motivation
I introduced the use of the StageX build toolchain, and made the
zainodbuild deterministic.It's worth nothing that runtime inherits a secure config from here:
https://codeberg.org/stagex/stagex/src/commit/4a9058f6cc16dc81f762543d768176762b600dd7/packages/core/filesystem/Containerfile
Tests
I built the image twice using
utils/build.shand compared the resulting hashesFollow-up Work
We need to figure out how to update the
Makefile.tomlaccording to team preferences to use the updated image for creatingzainodimages and for producing binaries as needed.I'm also happy to help write documentation as desired.
PR Checklist