Search in sources :

Example 1 with IGKVStrategy

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;
}
Also used : IManifestStrategy(com.intel.mountwilson.manifest.IManifestStrategy) UnknownHostException(java.net.UnknownHostException) ASException(com.intel.mountwilson.as.common.ASException) WebApplicationException(javax.ws.rs.WebApplicationException) ConfigurationException(org.apache.commons.configuration.ConfigurationException) CryptographyException(com.intel.mtwilson.crypto.CryptographyException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) TblHosts(com.intel.mtwilson.as.data.TblHosts) IGKVStrategy(com.intel.mtwilson.as.business.trust.gkv.IGKVStrategy) ASException(com.intel.mountwilson.as.common.ASException)

Aggregations

ASException (com.intel.mountwilson.as.common.ASException)1 IManifestStrategy (com.intel.mountwilson.manifest.IManifestStrategy)1 IGKVStrategy (com.intel.mtwilson.as.business.trust.gkv.IGKVStrategy)1 TblHosts (com.intel.mtwilson.as.data.TblHosts)1 CryptographyException (com.intel.mtwilson.crypto.CryptographyException)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 ConfigurationException (org.apache.commons.configuration.ConfigurationException)1