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

zos4 New service to register nodes instead of tfchain #1304

Open
9 of 10 tasks
ashraffouda opened this issue Jan 9, 2025 · 6 comments
Open
9 of 10 tasks

zos4 New service to register nodes instead of tfchain #1304

ashraffouda opened this issue Jan 9, 2025 · 6 comments

Comments

@ashraffouda
Copy link
Collaborator

ashraffouda commented Jan 9, 2025

Create a golang service to act as a registrar of the nodes of zos4 where it supports the following

  • Create a farm
  • List farms
  • Get a farm
  • Update a farm
  • Register a node
  • list all nodes
  • get a node
  • store uptime report
  • store consumption report
  • Store hardware info (DMI data)

Note: we need to create a standalone service that handles all of this away from using tfchain/substrate
let's have an interface implementing this so we can plug other implementations of this service in the future in zos

@xmonader
Copy link
Contributor

xmonader commented Jan 9, 2025

Eta: 14th of Jan

@xmonader xmonader transferred this issue from threefoldtech/zos Jan 9, 2025
@rawdaGastan rawdaGastan added this to the v0.17.x milestone Jan 15, 2025
@Eslam-Nawara
Copy link
Contributor

Eslam-Nawara commented Jan 26, 2025

Remaining work

  • add account struct and update how to sign
  • update how registrar handle uptime report
  • add (Interfaces, SecureBoot, Virtualized, BoardSerial, ConnectionPrice) to the node struct
  • add endpoint to update the node
  • add endpoint to get zos version
  • update uptime endpoint to return hash (what is hash?) - same for consumption report
  • update create node/farm to return the ID of the created struct
  • update how we handle the auth

@sameh-farouk
Copy link
Member

sameh-farouk commented Jan 26, 2025

Update:
I have started implementing the remaining work needed for the registration flow.
I have completed the account structure addition and handlers for creating and getting accounts.
Now, users can create accounts with a public key, which generates a TwinID.
Security aspects include:

  • Using ED25519 signatures for account creation to prove ownership of the private key.
  • Timestamp-based challenges to prevent replay attacks.

@sameh-farouk
Copy link
Member

Update:
I have completed the update on how the registrar handles uptime reports, supporting the tracking of historical reports to calculate availability.

@sameh-farouk
Copy link
Member

sameh-farouk commented Jan 28, 2025

Update:

I have completed the implementation of middleware to manage authentication in the registrar. I made several code adjustments and fixed a few bugs. Additionally, I added authorization checks in the handlers to complement the authentication middleware.

I conducted initial tests for the following processes:

  • Creating an account providing proper challenge
  • Creating a farm with twin authentication
  • Registering a node in that farm with twin authentication

Remaining tasks:

  • Add an endpoint to update a node
  • Add an endpoint to get an account by public key
  • Manage zOS version

Estimated time for predefined work
2 Hours (By the end of the day)

@sameh-farouk
Copy link
Member

Update:
All communicated work completed
I have completed the implementation of the update node endpoint, adjusted the code to support querying the account by either public key or twin_id, and added relevant flags and endpoints to allow a configurable admin to set the zOS version.

I'm waiting for the integration results so that I can make any necessary changes if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants