diff --git a/README.md b/README.md index d1a1af7..c9cc602 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,14 @@ # Delegatio -Delegatio is a framework that can be used to manage homework of classes (i.e. system security). The aim is to provide a infrastructure to let students work on problems independent of their hardware. +
+ +Delegatio is a framework that can be used to manage homework of classes (i.e. system security). The aim is to provide a infrastructure to let students work on problems independent of their hardware. # Installation ```bash -pacman -S libvirt qemu-full go mkosi make cmake +pacman -S libvirt qemu-full go mkosi make cmake ``` `systemd 253` or newer is required to build the images, otherwise a local systemd tree is needed [mkosi issue](https://github.com/systemd/mkosi/issues/1290) @@ -17,7 +21,7 @@ make ``` # Run -Before we start the program we have create a kubernetes persistent storage. The easiest way to do that is through NFS. +Before we start the program we have create a kubernetes persistent storage. The easiest way to do that is through NFS. First create a shared dir and make is user accessible. ```bash sudo mkdir /mnt/myshareddir @@ -39,7 +43,7 @@ Connecting is possible by sshing into the daemon, either on the kubernetes nodes ```bash ssh testchallenge2@localhost -p 2200 -i ~/.ssh/id_rsa ``` -You must provide your public keys in `./internal/config/global.go` (will be changed to read a config file soon) +You must provide your public keys in `./internal/config/global.go` (will be changed to read a config file soon) ## Limitations Currently we only support one ControlPlane, thus we only have one KubeAPIServer. It might be possible that under high load (many port forward requests) the container is not capable of handing everything. However, we need to test it with some 100 users. diff --git a/cli/main.go b/cli/main.go index 0691dd2..6326c45 100644 --- a/cli/main.go +++ b/cli/main.go @@ -44,7 +44,7 @@ func registerSignalHandler(ctx context.Context, log *zap.Logger) (context.Contex func main() { var imageLocation string - flag.StringVar(&imageLocation, "path", "", "path to the image to measure (required)") + flag.StringVar(&imageLocation, "path", "", "path to the image to load (required)") flag.Parse() zapconf := zap.NewDevelopmentConfig() log, err := zapconf.Build() diff --git a/grader/gradeapi/request.go b/grader/gradeapi/request.go index a55ad8f..e73cc37 100644 --- a/grader/gradeapi/request.go +++ b/grader/gradeapi/request.go @@ -19,8 +19,8 @@ import ( "google.golang.org/grpc/status" ) -func (a *API) updatePointsUser(_ context.Context, points int, user string) error { - a.logger.Info("updating points for user", zap.String("user", user), zap.Int("points", points)) +func (a *API) updatePointsUser(_ context.Context, points int, uuid string, exerciseID int) error { + a.logger.Info("updating points", zap.String("uuid", uuid), zap.Int("points", points), zap.Int("exercise", exerciseID)) // ToDO: Update points for user and add database connection / container return nil } @@ -47,8 +47,8 @@ func (a *API) RequestGrading(ctx context.Context, in *gradeproto.RequestGradingR if err != nil { a.logger.Error("failed to create graders", zap.Error(err)) } - - switch id := in.GetExerciseId(); id { + exerciseID := in.GetExerciseId() + switch exerciseID { case 1: a.logger.Info("received grading request for id 1") points, log, err = grader.GradeExerciseType1(ctx, in.GetSolution(), 1) @@ -59,16 +59,16 @@ func (a *API) RequestGrading(ctx context.Context, in *gradeproto.RequestGradingR a.logger.Info("received grading request for id 2") } - if err := a.updatePointsUser(ctx, points, uuid); err != nil { + if err := a.updatePointsUser(ctx, points, uuid, exerciseID); err != nil { return nil, status.Error(codes.Internal, "failed to update points") } return &gradeproto.RequestGradingResponse{Points: int32(points), Log: log}, nil } -func (a *API) checkSignature(_ context.Context, UUID string, signature, solution []byte) error { - a.logger.Info("checking signature", zap.String("studentID", UUID)) - exists, err := a.data().UUIDExists(UUID) +func (a *API) checkSignature(_ context.Context, uuid string, signature, solution []byte) error { + a.logger.Info("checking signature", zap.String("studentID", uuid)) + exists, err := a.data().UUIDExists(uuid) if err != nil { return err } @@ -76,7 +76,7 @@ func (a *API) checkSignature(_ context.Context, UUID string, signature, solution return status.Error(codes.NotFound, "user not found") } var userData config.UserInformation - if err := a.data().GetUUIDData(UUID, &userData); err != nil { + if err := a.data().GetUUIDData(uuid, &userData); err != nil { return status.Error(codes.FailedPrecondition, "failed to get user data") } a.logger.Info("got user data", zap.String("publicKey", string(userData.PubKey)))