Skip to content

Commit

Permalink
Merge pull request #152 from akakou/hotfix/check-attestation-detils
Browse files Browse the repository at this point in the history
Hotfix/check attestation detils
  • Loading branch information
akakou authored Oct 4, 2024
2 parents 6897881 + dc807d0 commit 7caa7eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion verifier/api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const (
ERROR_AUTHENTICATE_ADMIN = "failed to authenticate admin"
ERROR_ACCESS_DOMAIN_AUTH_TARGET = "failed to access domain auth target"
ERROR_DOMAIN_AUTH_INVALID = "domain auth token is invalid"
ERROR_QUOTE_INVALID = "quote is invalid"
ERROR_QUOTE_INVALID1 = "quote is invalid (debug)"
ERROR_QUOTE_INVALID2 = "quote is invalid (up-to-date)"
ERROR_QUOTE_INVALID3 = "quote is invalid (unique)"
)

var SCHEME = "https"
Expand Down
12 changes: 10 additions & 2 deletions verifier/api/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
verifiercore "github.com/akakou/ra_webs/verifier/core"
"github.com/akakou/ra_webs/verifier/ent"
"github.com/akakou/ra_webs/verifier/ent/taserver"
"github.com/edgelesssys/ego/attestation/tcbstatus"
"github.com/labstack/echo/v4"
)

Expand Down Expand Up @@ -68,14 +69,21 @@ func DomainExist(domain string, verifier *verifiercore.Verifier) (bool, error) {

func CheckValidity(uniqueId []byte, req core.RegisterRequest, exist bool, service *ent.Service, verifier *verifiercore.Verifier) error {
report, err := core.VerifyServer(req.Quote, req.PublicKey, service.Token)

if err != nil {
return err
}

if report.Debug {
return fmt.Errorf(ERROR_QUOTE_INVALID1)
}

if report.TCBStatus != tcbstatus.UpToDate {
return fmt.Errorf(ERROR_QUOTE_INVALID2)
}

fmt.Printf("Unique ID: %x == %x\n", report.UniqueID, uniqueId)
if !reflect.DeepEqual(report.UniqueID, uniqueId) {
return fmt.Errorf(ERROR_QUOTE_INVALID)
return fmt.Errorf(ERROR_QUOTE_INVALID3)
}

err = verifier.Monitor.PreCheck(req.Domain, exist, verifier)
Expand Down

0 comments on commit 7caa7eb

Please sign in to comment.