Search in sources :

Example 1 with TblHostSpecificManifestJpaController

use of com.intel.mtwilson.as.controller.TblHostSpecificManifestJpaController in project OpenAttestation by OpenAttestation.

the class HostBO method createHostSpecificManifest.

private void createHostSpecificManifest(List<TblHostSpecificManifest> tblHostSpecificManifests, TblHosts tblHosts) throws IOException {
    if (tblHostSpecificManifests != null && !tblHostSpecificManifests.isEmpty()) {
        for (TblHostSpecificManifest tblHostSpecificManifest : tblHostSpecificManifests) {
            tblHostSpecificManifest.setHostID(tblHosts.getId());
            TblHostSpecificManifestJpaController tblHostSpecificManifestJpaController = getHostSpecificManifestJpaController();
            tblHostSpecificManifestJpaController.create(tblHostSpecificManifest);
        }
    }
}
Also used : TblHostSpecificManifestJpaController(com.intel.mtwilson.as.controller.TblHostSpecificManifestJpaController) TblHostSpecificManifest(com.intel.mtwilson.as.data.TblHostSpecificManifest)

Example 2 with TblHostSpecificManifestJpaController

use of com.intel.mtwilson.as.controller.TblHostSpecificManifestJpaController in project OpenAttestation by OpenAttestation.

the class HostBO method deleteHostSpecificManifest.

// PREMIUM FEATURE ? 
private void deleteHostSpecificManifest(TblHosts tblHosts) throws NonexistentEntityException, IOException {
    //TblHostSpecificManifestJpaController tblHostSpecificManifestJpaController = My.jpa().mwHostSpecificManifest();
    TblHostSpecificManifestJpaController tblHostSpecificManifestJpaController = getHostSpecificManifestJpaController();
    for (TblModuleManifest moduleManifest : tblHosts.getVmmMleId().getTblModuleManifestCollection()) {
        if (moduleManifest.getUseHostSpecificDigestValue() != null && moduleManifest.getUseHostSpecificDigestValue().booleanValue()) {
            // For open source we used to have multiple module manifests for the same hosts. So, the below query by hostID was returning multiple results.
            TblHostSpecificManifest hostSpecificManifest = tblHostSpecificManifestJpaController.findByModuleAndHostID(tblHosts.getId(), moduleManifest.getId());
            if (hostSpecificManifest != null) {
                log.debug("Deleting Host specific manifest." + moduleManifest.getComponentName() + ":" + hostSpecificManifest.getDigestValue());
                tblHostSpecificManifestJpaController.destroy(hostSpecificManifest.getId());
            }
        }
    }
}
Also used : TblHostSpecificManifestJpaController(com.intel.mtwilson.as.controller.TblHostSpecificManifestJpaController) TblHostSpecificManifest(com.intel.mtwilson.as.data.TblHostSpecificManifest) TblModuleManifest(com.intel.mtwilson.as.data.TblModuleManifest)

Example 3 with TblHostSpecificManifestJpaController

use of com.intel.mtwilson.as.controller.TblHostSpecificManifestJpaController in project OpenAttestation by OpenAttestation.

the class ReportsBO method addManifestLogs.

private void addManifestLogs(Integer hostId, PcrLogReport manifest, TblTaLog log, Boolean failureOnly, TblPcrManifest tblPcrManifest) throws IOException {
    HashMap<String, ModuleLogReport> moduleReports = new HashMap<>();
    if (log.getTblModuleManifestLogCollection() != null) {
        logger.debug("addManifestLogs - This is module based attestation with {} of modules.", log.getTblModuleManifestLogCollection().size());
        for (TblModuleManifestLog moduleManifestLog : log.getTblModuleManifestLogCollection()) {
            moduleReports.put(moduleManifestLog.getName(), new ModuleLogReport(moduleManifestLog.getName(), moduleManifestLog.getValue(), moduleManifestLog.getWhitelistValue(), 0));
        }
    }
    if (!failureOnly) {
        logger.debug("FailureOnly flag is false. Adding all manifests.");
        for (TblModuleManifest moduleManifest : tblPcrManifest.getMleId().getTblModuleManifestCollection()) {
            if (moduleManifest.getExtendedToPCR().equalsIgnoreCase(tblPcrManifest.getName()) && !moduleReports.containsKey(moduleManifest.getComponentName())) {
                if (moduleManifest.getUseHostSpecificDigestValue() != null && moduleManifest.getUseHostSpecificDigestValue().booleanValue()) {
                    // For open source we used to have multiple module manifests for the same hosts. So, the below query by hostID was returning multiple results.
                    //String hostSpecificDigestValue = new TblHostSpecificManifestJpaController(getEntityManagerFactory()).findByHostID(hostId).getDigestValue();
                    //String hostSpecificDigestValue = My.jpa().mwHostSpecificManifest().findByModuleAndHostID(hostId, moduleManifest.getId()).getDigestValue();
                    TblHostSpecificManifestJpaController tblHostSpecificManifestJpaController = getTblHostSpecificManifestJpaController();
                    String hostSpecificDigestValue = tblHostSpecificManifestJpaController.findByModuleAndHostID(hostId, moduleManifest.getId()).getDigestValue();
                    moduleReports.put(moduleManifest.getComponentName(), new ModuleLogReport(moduleManifest.getComponentName(), hostSpecificDigestValue, hostSpecificDigestValue, 1));
                } else {
                    moduleReports.put(moduleManifest.getComponentName(), new ModuleLogReport(moduleManifest.getComponentName(), moduleManifest.getDigestValue(), moduleManifest.getDigestValue(), 1));
                }
            }
        }
    }
    manifest.getModuleLogs().addAll(moduleReports.values());
}
Also used : TblHostSpecificManifestJpaController(com.intel.mtwilson.as.controller.TblHostSpecificManifestJpaController) TblModuleManifest(com.intel.mtwilson.as.data.TblModuleManifest) TblModuleManifestLog(com.intel.mtwilson.as.data.TblModuleManifestLog)

Aggregations

TblHostSpecificManifestJpaController (com.intel.mtwilson.as.controller.TblHostSpecificManifestJpaController)3 TblHostSpecificManifest (com.intel.mtwilson.as.data.TblHostSpecificManifest)2 TblModuleManifest (com.intel.mtwilson.as.data.TblModuleManifest)2 TblModuleManifestLog (com.intel.mtwilson.as.data.TblModuleManifestLog)1