use of com.intel.mtwilson.as.data.TblModuleManifest in project OpenAttestation by OpenAttestation.
the class HostBO method deleteModulesForMLE.
private void deleteModulesForMLE(TxtHostRecord host) throws NonexistentEntityException, IOException {
TblMleJpaController tblMleJpaController = getMleJpaController();
TblModuleManifestJpaController tblModuleManifestJpaController = getModuleJpaController();
try {
TblMle tblMle = tblMleJpaController.findVmmMle(host.VMM_Name, host.VMM_Version, host.VMM_OSName, host.VMM_OSVersion);
if (tblMle != null) {
// Retrieve the list of all the modules for the specified VMM MLE.
List<TblModuleManifest> moduleList = tblModuleManifestJpaController.findTblModuleManifestByHardwareUuid(host.Hardware_Uuid);
if (moduleList != null && moduleList.size() > 0) {
for (TblModuleManifest moduleObj : moduleList) {
//if (moduleObj.getUseHostSpecificDigestValue()) // we cannot delete the host specific one since it would be referenced by the Hosts
// continue;
tblModuleManifestJpaController.destroy(moduleObj.getId());
}
}
}
} catch (IllegalOrphanException | NonexistentEntityException ex) {
log.error("Error during the deletion of VMM modules {}. ", host.VMM_Name, ex);
throw new ASException(ErrorCode.WS_MODULE_WHITELIST_DELETE_ERROR, ex.getClass().getSimpleName());
}
}
use of com.intel.mtwilson.as.data.TblModuleManifest 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());
}
}
}
}
use of com.intel.mtwilson.as.data.TblModuleManifest 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());
}
Aggregations