Skip to content
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

Add Quorum Key Resharding Service #446

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fb6f7e3
Add Quorum Key Resharding Service
emostov Dec 14, 2023
712d75b
Update changelog for #428
emostov Jan 24, 2024
ff89a91
Update gitignore
emostov Jan 24, 2024
955f350
wip
emostov Feb 13, 2024
64e73c2
wip enclave reshard service
emostov Apr 18, 2024
ec3c54f
try getting enclave_reshard
emostov Apr 18, 2024
0f28dd8
make sure no toolchain
emostov Apr 18, 2024
add57ba
small fix
emostov Apr 18, 2024
9987767
enclave_reshard builds
emostov Apr 18, 2024
21046c7
add enclave_reshard target
emostov Apr 18, 2024
c9fd19d
try fix perms issue
emostov Apr 18, 2024
54f56e3
remove enclave_reshard image (pivoting to mono)
emostov Apr 18, 2024
7b8925f
revert ci changes
emostov Apr 19, 2024
e08bb9d
fix some comments
emostov Apr 19, 2024
dfc8996
another small comment fix
emostov Apr 19, 2024
8d1eca2
Update reshard service
emostov Apr 19, 2024
69469a9
small adjustment to default dev port
emostov Apr 20, 2024
3c0cfad
ensure deterministic reshard input
emostov Apr 21, 2024
3ab39ca
sort share set members
emostov Apr 21, 2024
17b44ff
ensure reshard input is deterministic when reading in
emostov Apr 21, 2024
a335417
update ci
emostov Apr 23, 2024
5342ff3
address comments; fix tests
emostov Apr 23, 2024
b887810
review comments; try fix CI
emostov Apr 23, 2024
1608d8c
lint
emostov Apr 23, 2024
7427f33
update common image tags
emostov Apr 23, 2024
e51d281
remove fail fast
emostov Apr 23, 2024
13a7aed
make sure to pull only hash pinned
emostov Apr 23, 2024
3063310
just run make; no updload
emostov Apr 24, 2024
553043c
respond to some feedback
emostov May 7, 2024
72b6de2
remove lfs and release section
emostov May 7, 2024
a3ef37a
revert container file
emostov Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: artifacts-build
name: stagex-build

on:
push:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ target/
!src/integration/mock/boot-e2e/all-personal-dir/user2-dir/*
!src/integration/mock/boot-e2e/all-personal-dir/user3-dir/*
!src/integration/mock/boot-e2e/genesis-dir/*
!src/integration/mock/new-share-set-secrets/*
!src/integration/mock/reshard/user1/qkey1/*
!src/integration/mock/reshard/user2/qkey1/*
!src/integration/mock/reshard/user3/qkey1/*
src/integration/mock/pivot-build-fingerprints.txt
src/integration/pivot_ok2_works
src/integration/pivot_ok_works
Expand Down
Empty file removed .gitmodules
Empty file.
2 changes: 0 additions & 2 deletions .lfsconfig

This file was deleted.

9 changes: 9 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ Removed: for now removed features.
Fixed: for any bug fixes.
Security: in case of vulnerabilities.

## Unreleased

### Added

- BREAKING CHANGE: qos_core: quorum key resharding service, new state machine transitions, and new `ProtocolMsg` variants (#428)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to highlight this breaking change - @r-n-o lmk if you want to merge your qos_net pr first so you can update qos in mono without worrying about breaking changes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me! If you don't mind having my PR go first I'll take you on this offer!

- qos_client: commands to run quorum key resharding and high level documentation (#428)
- qos_crypto: function to generate n choose k variants (#428)
- qos_hex: support more array sizes for serde deserialize

## [0.4.0] 2024.4.9

### Added
Expand Down
28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,36 +152,8 @@ make toolchain-shell
make toolchain-update
```


### Release Process

0. Determine the release semver version by consulting the [changelog](./CHANGELOG.MD).
1. Create a branch for your release e.g.
`git checkout -b release/v1.0.0`
2. Run `make dist` as described in ["Release" section](#release)
3. Commit the new dist folder `git commit -m "Release v1.0.0" -- dist/`
4. Push up your branch to github, and make a pull request.
5. You may also create and push a signed `-rcX` git tag where the number after `rc` doesn't already exist.
`git tag -S v1.0.0-rc0 -m v1.0.0-rc0`
`git push origin v1.0.0-rc0`
6. Wait for others to replicate your build, see ["Verify" section](#verify)
7. Once the release has enough `git sig` signatures, make the final tag and merge the pull request.
`git tag -S v1.0.0 -m v1.0.0`
`git push origin v1.0.0`


[gs]: https://codeberg.org/distrust/git-sig

### LFS setup

This repository externalises large files so that they do not bulk up the git repo itself.
This is done through a tool called `git-lfs`, which must be installed for it to work.
Additionally, we use a custom agent to store our LFS objects in S3 (rather than the default and more expensive Github LFS service).

In order to setup our s3 based lfs:

1) Install [tkinfra](https://github.com/tkhq/mono/tree/main/src/go/tkinfra)
2) Run `./scripts/setup-lfs.sh`

#### Troubleshooting

Expand Down
2 changes: 2 additions & 0 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ local-host:
cargo run --bin qos_host \
-- \
--host-ip 127.0.0.1 \
--host-port 3000 \
--host-port 3001 \
--usock ./dev.sock

.PHONY: vm-host
Expand Down
2 changes: 1 addition & 1 deletion src/images/common/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ COPY --from=file . /
COPY --from=gcc . /
COPY --from=linux-nitro /bzImage .
COPY --from=linux-nitro /nsm.ko .
COPY --from=linux-nitro /linux.config .
COPY --from=linux-nitro /linux.config .
1 change: 1 addition & 0 deletions src/integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ aws-nitro-enclaves-nsm-api = { version = "0.3", default-features = false }
rand = "0.8"
ureq = { version = "2.9", features = ["json"], default-features = false }
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
1 change: 1 addition & 0 deletions src/integration/mock/keys/new-share-set/quorum_threshold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
1 change: 1 addition & 0 deletions src/integration/mock/keys/new-share-set/reshard-1.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
040ee9045f3718bd1345dccf88693c993626d08448fdeba8ecaf1b867f4d0572d439852ef460963a9e8fab08864a55994c0779216b44a165b4eaced98722ed3778041646e59014eaec046b2636d3943f446282363c26cf995320d5944b8b4d7af0aa588c208c13ded5c86c3e9a31af687c4027d4636173f405503e7b1baeeee7eaa5
1 change: 1 addition & 0 deletions src/integration/mock/keys/new-share-set/reshard-2.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
04c82672b2f8c4d520c5c7cda207b4a05f433e4db7f0daed9bbde6f54d42814af5aeabec191d2dda32ba4cdc6616aa3fda0a6711affa0d42efbe11144043028622044810d6d24626abfe6c31e884e674c870a2197c9e9cd80786b2fd3a087e2c38cad8376d9b7086901915d261ecb92bde5a757d27bbf1a20904120ff079b8a8ef71
1 change: 1 addition & 0 deletions src/integration/mock/keys/new-share-set/reshard-3.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
049872acc56bca90eea07e1e1185e3015be3b7295b4ba484299702489bf4858b1374928b335d3405a16221ec240e80817fbfd783c7052446a31bd1821a9a10ff9c0469361a228e22e7cad34774a50f7cd8f97e7d6542f3903bf9d14647302691ef9195ae2c08ec62dcd0e845bc75e94ef8b9fa45925199a2f7d94d00981d6d2e0d85
1 change: 1 addition & 0 deletions src/integration/mock/keys/new-share-set/reshard-4.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0442993076a3b8345cb58b860477bce9db21bb6caceae8df298860410594ea08d4fc2ffec944fd7623a893b57037e0f20c44ff8eee6eff03110717efb9269181ed04bb495296212027597e2eb93ffbba07f0c41ae3018409b9ad2177e87b53a2729806f52ad6d0f6399ca3d37edddc81a687cd2a0a9f8aab914d76be2930ff8f5bba
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
60dd1d44decfa12be68c49abdb47b02c7d03e63de8f6d61ac7d9c4a59e2bf381
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1b28ba3a047709e4bac8f5911bd213dbeca7b7023a702ea5333837a80c2ed170
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f37186894abb1f45ce0eb5b24b5184334d7d85278037d28af11423f50043d83b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ccb796f57e4a5f52f2ebd81af50a7c98d7576b5503b5dddc337e67b6217d1fa3
1 change: 1 addition & 0 deletions src/integration/mock/reshard/user1/qkey1/quorum_key.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
04c9434ba0a681ee7c21e17c7ce4f668360803686b198774c9362dac090f9995eeb68961319370969bd0d657167d9cfce13a7466ec47aba9845fbfc4fe9277866d04043daa777f57c1ebef21ff3eb71e00a681921da56186ac96b5d3b06b645c88c512fe8072d12971ce1f9592ef6bafd98b4982f8cf73cb6e80c8f6424294e54c71
Binary file not shown.
1 change: 1 addition & 0 deletions src/integration/mock/reshard/user2/qkey1/quorum_key.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
04c9434ba0a681ee7c21e17c7ce4f668360803686b198774c9362dac090f9995eeb68961319370969bd0d657167d9cfce13a7466ec47aba9845fbfc4fe9277866d04043daa777f57c1ebef21ff3eb71e00a681921da56186ac96b5d3b06b645c88c512fe8072d12971ce1f9592ef6bafd98b4982f8cf73cb6e80c8f6424294e54c71
Binary file not shown.
1 change: 1 addition & 0 deletions src/integration/mock/reshard/user3/qkey1/quorum_key.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
04c9434ba0a681ee7c21e17c7ce4f668360803686b198774c9362dac090f9995eeb68961319370969bd0d657167d9cfce13a7466ec47aba9845fbfc4fe9277866d04043daa777f57c1ebef21ff3eb71e00a681921da56186ac96b5d3b06b645c88c512fe8072d12971ce1f9592ef6bafd98b4982f8cf73cb6e80c8f6424294e54c71
Binary file not shown.
2 changes: 2 additions & 0 deletions src/integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ pub const LOCAL_HOST: &str = "127.0.0.1";
pub const PCR3: &str = "78fce75db17cd4e0a3fb8dad3ad128ca5e77edbb2b2c7f75329dccd99aa5f6ef4fc1f1a452e315b9e98f9e312e6921e6";
/// QOS dist directory.
pub const QOS_DIST_DIR: &str = "./mock/dist";
/// Mock pcr3 pre-image.
pub const PCR3_PRE_IMAGE_PATH: &str = "./mock/namespaces/pcr3-preimage.txt";

const MSG: &str = "msg";

Expand Down
18 changes: 9 additions & 9 deletions src/integration/tests/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use std::{

use borsh::de::BorshDeserialize;
use integration::{
LOCAL_HOST, PIVOT_OK2_PATH, PIVOT_OK2_SUCCESS_FILE, QOS_DIST_DIR,
LOCAL_HOST, PCR3_PRE_IMAGE_PATH, PIVOT_OK2_PATH, PIVOT_OK2_SUCCESS_FILE,
QOS_DIST_DIR,
};
use qos_core::protocol::{
services::{
Expand Down Expand Up @@ -51,7 +52,6 @@ async fn standard_boot_e2e() {
let namespace = "quit-coding-to-vape";

let personal_dir = |user: &str| format!("{all_personal_dir}/{user}-dir");

let user1 = "user1";
let user2 = "user2";
let user3 = "user3";
Expand Down Expand Up @@ -81,7 +81,7 @@ async fn standard_boot_e2e() {
"--qos-release-dir",
QOS_DIST_DIR,
"--pcr3-preimage-path",
"./mock/namespaces/pcr3-preimage.txt",
PCR3_PRE_IMAGE_PATH,
"--manifest-path",
&cli_manifest_path,
"--pivot-args",
Expand Down Expand Up @@ -157,7 +157,7 @@ async fn standard_boot_e2e() {
"--manifest-approvals-dir",
&*boot_dir,
"--pcr3-preimage-path",
"./mock/namespaces/pcr3-preimage.txt",
PCR3_PRE_IMAGE_PATH,
"--pivot-hash-path",
PIVOT_HASH_PATH,
"--qos-release-dir",
Expand Down Expand Up @@ -306,7 +306,7 @@ async fn standard_boot_e2e() {
"--host-ip",
LOCAL_HOST,
"--pcr3-preimage-path",
"./mock/pcr3-preimage.txt",
PCR3_PRE_IMAGE_PATH,
"--unsafe-skip-attestation",
])
.spawn()
Expand Down Expand Up @@ -361,7 +361,7 @@ async fn standard_boot_e2e() {
"--manifest-envelope-path",
&manifest_envelope_path,
"--pcr3-preimage-path",
"./mock/namespaces/pcr3-preimage.txt",
PCR3_PRE_IMAGE_PATH,
"--manifest-set-dir",
"./mock/keys/manifest-set",
"--alias",
Expand Down Expand Up @@ -400,9 +400,9 @@ async fn standard_boot_e2e() {
stdin.write_all("yes\n".as_bytes()).expect("Failed to write to stdin");

assert_eq!(
&stdout.next().unwrap().unwrap(),
"Does this AWS IAM role belong to the intended organization: arn:aws:iam::123456789012:role/Webserver? (yes/no)"
);
&stdout.next().unwrap().unwrap(),
"Does this AWS IAM role belong to the intended organization: arn:aws:iam::123456789012:role/Webserver? (yes/no)"
);
stdin.write_all("yes\n".as_bytes()).expect("Failed to write to stdin");

assert_eq!(
Expand Down
6 changes: 3 additions & 3 deletions src/integration/tests/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
};

use borsh::de::BorshDeserialize;
use integration::{LOCAL_HOST, QOS_DIST_DIR};
use integration::{LOCAL_HOST, PCR3_PRE_IMAGE_PATH, QOS_DIST_DIR};
use qos_core::protocol::services::genesis::GenesisOutput;
use qos_crypto::{sha_512, shamir::shares_reconstruct};
use qos_nsm::nitro::unsafe_attestation_doc_from_der;
Expand Down Expand Up @@ -153,7 +153,7 @@ async fn genesis_e2e() {
"--qos-release-dir",
QOS_DIST_DIR,
"--pcr3-preimage-path",
"./mock/pcr3-preimage.txt",
PCR3_PRE_IMAGE_PATH,
"--dr-key-path",
DR_KEY_PUBLIC_PATH,
"--unsafe-skip-attestation"
Expand Down Expand Up @@ -225,7 +225,7 @@ async fn genesis_e2e() {
"--qos-release-dir",
QOS_DIST_DIR,
"--pcr3-preimage-path",
"./mock/pcr3-preimage.txt",
PCR3_PRE_IMAGE_PATH,
"--unsafe-skip-attestation"
])
.spawn()
Expand Down
12 changes: 7 additions & 5 deletions src/integration/tests/key.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::{fs, process::Command};

use integration::{LOCAL_HOST, PIVOT_LOOP_PATH, QOS_DIST_DIR};
use integration::{
LOCAL_HOST, PCR3_PRE_IMAGE_PATH, PIVOT_LOOP_PATH, QOS_DIST_DIR,
};
use qos_crypto::sha_256;
use qos_p256::{P256Pair, P256Public};
use qos_test_primitives::{ChildWrapper, PathWrapper};
Expand Down Expand Up @@ -158,7 +160,7 @@ fn generate_manifest_envelope() {
"--restart-policy",
"always",
"--pcr3-preimage-path",
"./mock/namespaces/pcr3-preimage.txt",
PCR3_PRE_IMAGE_PATH,
"--pivot-hash-path",
PIVOT_HASH_PATH,
"--qos-release-dir",
Expand Down Expand Up @@ -196,7 +198,7 @@ fn generate_manifest_envelope() {
"--manifest-approvals-dir",
BOOT_DIR,
"--pcr3-preimage-path",
"./mock/namespaces/pcr3-preimage.txt",
PCR3_PRE_IMAGE_PATH,
"--pivot-hash-path",
PIVOT_HASH_PATH,
"--qos-release-dir",
Expand Down Expand Up @@ -293,7 +295,7 @@ fn boot_old_enclave(old_host_port: u16) -> (ChildWrapper, ChildWrapper) {
"--host-ip",
LOCAL_HOST,
"--pcr3-preimage-path",
"./mock/namespaces/pcr3-preimage.txt",
PCR3_PRE_IMAGE_PATH,
"--unsafe-skip-attestation",
])
.spawn()
Expand Down Expand Up @@ -343,7 +345,7 @@ fn boot_old_enclave(old_host_port: u16) -> (ChildWrapper, ChildWrapper) {
"--manifest-envelope-path",
MANIFEST_ENVELOPE_PATH,
"--pcr3-preimage-path",
"./mock/namespaces/pcr3-preimage.txt",
PCR3_PRE_IMAGE_PATH,
"--manifest-set-dir",
"./mock/keys/manifest-set",
"--alias",
Expand Down
Loading