use of com.intel.mtwilson.as.business.trust.gkv.IGKVStrategy in project OpenAttestation by OpenAttestation.
the class HostTrustBO method getTrustStatus.
/**
*
* @param hostName must not be null
* @return
*/
public HostTrustStatus getTrustStatus(Hostname hostName) {
HashMap<String, ? extends IManifest> pcrManifestMap;
HashMap<String, ? extends IManifest> gkvBiosPcrManifestMap, gkvVmmPcrManifestMap;
if (hostName == null) {
throw new IllegalArgumentException("missing hostname");
}
TblHosts tblHosts = null;
try {
tblHosts = getHostByIpAddress(InetAddress.getByName(hostName.toString()).getHostAddress());
} catch (UnknownHostException e) {
throw new ASException(e);
}
if (tblHosts == null) {
throw new ASException(ErrorCode.AS_HOST_NOT_FOUND, hostName.toString());
}
log.info("VMM name for host is {}", tblHosts.getVmmMleId().getName());
log.info("OS name for host is {}", tblHosts.getVmmMleId().getOsId().getName());
// bug #538 first check if the host supports tpm
HostAgentFactory factory = new HostAgentFactory();
HostAgent agent = factory.getHostAgent(tblHosts);
if (!agent.isTpmAvailable()) {
//Bug 510 add a blank row in the ta log for this host. this is so the host does not report mle's incorrectly.
logBlankTrustStatus(tblHosts);
throw new ASException(ErrorCode.AS_INTEL_TXT_NOT_ENABLED, hostName.toString());
}
IManifestStrategy manifestStrategy = getManifestStrategy(tblHosts);
try {
long start = System.currentTimeMillis();
pcrManifestMap = manifestStrategy.getManifest(tblHosts);
log.info("Manifest Time {}", (System.currentTimeMillis() - start));
} catch (ASException e) {
throw e;
} catch (Exception e) {
throw new ASException(e);
}
long start = System.currentTimeMillis();
log.info("PCRS from the VMM host {}", pcrManifestMap);
/**
* Get GKV for the given host
*
*/
IGKVStrategy gkvStrategy = getGkvStrategy(tblHosts);
gkvBiosPcrManifestMap = gkvStrategy.getBiosGoodKnownManifest(tblHosts.getBiosMleId().getName(), tblHosts.getBiosMleId().getVersion(), tblHosts.getBiosMleId().getOemId().getName());
gkvVmmPcrManifestMap = gkvStrategy.getVmmGoodKnownManifest(tblHosts.getVmmMleId().getName(), tblHosts.getVmmMleId().getVersion(), tblHosts.getVmmMleId().getOsId().getName(), tblHosts.getVmmMleId().getOsId().getVersion(), tblHosts.getId());
/**
* Verify trust
*
*/
log.info("tblHosts.getId()" + tblHosts.getId());
log.info("tblHosts.getIPAddress()" + tblHosts.getIPAddress());
HostTrustStatus trust = verifyTrust(tblHosts, pcrManifestMap, gkvBiosPcrManifestMap, gkvVmmPcrManifestMap);
log.info("Verfication Time {}", (System.currentTimeMillis() - start));
return trust;
}
Aggregations