diff --git a/verifier/api/auth.go b/verifier/api/auth.go index f6c7555..bb3cd8c 100644 --- a/verifier/api/auth.go +++ b/verifier/api/auth.go @@ -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" diff --git a/verifier/api/register.go b/verifier/api/register.go index e53410b..94d445b 100644 --- a/verifier/api/register.go +++ b/verifier/api/register.go @@ -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" ) @@ -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)