-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
This is a feature of cvm-reverse-proxy:
func (p *Proxy) copyMeasurementsToHeader(conn *tls.ConnectionState, header *http.Header) (int, error) {
certs := conn.PeerCertificates
atlsVariant, extractedMeasurements, err := GetMeasurementsFromTLS(certs, p.validatorOIDs)
if err != nil {
return http.StatusTeapot, err
} else if extractedMeasurements == nil {
p.log.Debug("[proxy-request: add-headers] no measurements, not adding headers")
return 0, nil
}
measurementsInHeaderFormat := make(map[uint32]string, len(extractedMeasurements))
for pcr, value := range extractedMeasurements {
measurementsInHeaderFormat[pcr] = hex.EncodeToString(value)
}
marshaledPcrs, err := json.Marshal(measurementsInHeaderFormat)
if err != nil {
return http.StatusInternalServerError, errors.New("could not marshal measurement extracted from tls extension")
}
header.Set(AttestationTypeHeader, atlsVariant.String())
header.Set(MeasurementHeader, string(marshaledPcrs))
p.log.With(AttestationTypeHeader, atlsVariant.String()).With(MeasurementHeader, string(marshaledPcrs)).Debug("[proxy-request: add-headers] measurement headers added")
return 0, nil
}This is not so simple to add here as this is a generic TCP proxy service which doesn't (currently) assume HTTP or modify or parse traffic (besides the initial attestation).
Metadata
Metadata
Assignees
Labels
No labels