Merge branch 'main' into v3_issue_872-apply-lombok-to-classes-with-boilerplate-code
Some checks failed
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (ubuntu-20.04) (push) Has been cancelled
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (windows-2022) (push) Has been cancelled
HIRS Build and Unit Test / ACA_Provisioner_Unit_Tests (push) Has been cancelled
HIRS System Tests / DockerTests (push) Has been cancelled
Dotnet Provisioner Unit Tests / Evaluate Tests (push) Has been cancelled

This commit is contained in:
TheSilentCoder 2025-01-24 14:41:02 -05:00
commit da598977c6
13 changed files with 99 additions and 46 deletions

View File

@ -25,17 +25,22 @@ dependencies {
implementation libs.spring.boot.starter.log4j2
implementation libs.minimal.json
// pull the pci dependency and ...
implementation libs.pci
// and explicitly include the patched version of the apache http client dependency
// explicitly include the patched version of the apache http client dependency
implementation libs.apacheHttpClient
implementation libs.protobuf.java
implementation libs.spring.boot.starter.data.jpa
implementation libs.spring.retry
implementation libs.spring.boot.starter.web
// explicitly include the patched version of the spring framework webmvc dependency
implementation libs.spring.framework.webmvc
// explicitly include the patched version of the logback-core dependency
implementation libs.logback.classic
compileOnly libs.lombok
annotationProcessor libs.lombok
@ -43,8 +48,13 @@ dependencies {
annotationProcessor libs.spotbugs.annotations
testImplementation libs.commons.io
// explicitly include the patched version of the logback-core dependency
testImplementation libs.logback.classic
testImplementation libs.spring.boot.starter.test
testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok
}

View File

@ -2,7 +2,7 @@ plugins {
id 'application'
id 'war'
id 'com.netflix.nebula.ospackage' version '11.10.0'
id 'org.springframework.boot' version '3.0.13'
id 'org.springframework.boot' version '3.1.12'
id 'io.spring.dependency-management' version '1.1.7'
}
@ -36,29 +36,49 @@ dependencies {
implementation libs.jakarta.servlet
implementation libs.jakarta.xml
// pull the pci dependency and ...
implementation libs.pci
// and explicitly include the patched version of the apache http client dependency
// explicitly include the patched version of the apache http client dependency
implementation libs.apacheHttpClient
implementation libs.mariadb.java.client
implementation libs.spring.boot.starter.web
//implementation libs.spring.framework.webmvc
// explicitly include the patched version of the snake yaml dependency
implementation libs.snake.yaml
implementation libs.spring.boot.starter.validation
implementation libs.spring.boot.starter.data.jpa
implementation libs.spring.boot.starter.log4j2
// explicitly include the patched version of the spring framework jdbc dependency
implementation libs.spring.framework.jdbc
// explicitly include the patched version of spring framework expression dependency
implementation libs.spring.framework.expression
// explicitly include the patched version of the tomcat embed core dependency
implementation libs.tomcat.embed.core
implementation libs.tomcat.embed.jasper
// explicitly include the patched version of the tomcat embed websocket dependency
implementation libs.tomcat.embed.websocket
compileOnly libs.lombok
annotationProcessor libs.lombok
providedRuntime libs.spring.boot.starter.tomcat
// explicitly include the patched version of the json path dependency
testImplementation libs.jsonPath
testImplementation libs.hsqldb
testImplementation libs.spring.boot.starter.test
testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok
// explicitly include the patched version of the xmlunit-core dependency
testImplementation libs.xmlunit.core
}
test {

View File

@ -35,9 +35,12 @@
<Target Name="CopyFiles" AfterTargets="DeletePDB">
<ItemGroup>
<PaccorScriptsDll Include="$(OUTDIR)paccor_scripts.dll"/>
<PaccorPcieDll Include="$(OUTDIR)Pcie.dll"/>
<PaccorSmbiosDll Include="$(OUTDIR)Smbios.dll"/>
<PaccorStorageDll Include="$(OUTDIR)Storage.dll"/>
</ItemGroup>
<Copy
SourceFiles="@(PaccorScriptsDll)"
SourceFiles="@(PaccorScriptsDll);@(PaccorPcieDll);@(PaccorSmbiosDll);@(PaccorStorageDll)"
DestinationFolder="$(PublishDir)plugins"
/>
</Target>

View File

@ -6,9 +6,10 @@
<RuntimeIdentifiers>linux-x64;win-x64</RuntimeIdentifiers>
<StartupObject>hirs.Program</StartupObject>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageVersion>3.0.1</PackageVersion>
<PackageVersion>3.0.5</PackageVersion>
<Release></Release>
</PropertyGroup>
@ -24,26 +25,29 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Google.Protobuf" Version="3.20.1" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.20.1">
<PackageReference Include="Google.Protobuf" Version="3.28.3" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.28.3">
<PrivateAssets>all</PrivateAssets> <!-- These assets will be consumed but won't flow to the parent project -->
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.TSS" Version="2.1.1" />
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="paccor.HardwareManifestPlugin" Version="1.0.0" />
<PackageReference Include="paccor.HardwareManifestPluginManager" Version="1.0.0" />
<PackageReference Include="paccor.paccor_scripts" Version="1.0.1" />
<PackageReference Include="paccor.HardwareManifestPlugin" Version="2.0.5" />
<PackageReference Include="paccor.HardwareManifestPluginManager" Version="2.0.5" />
<PackageReference Include="paccor.paccor_scripts" Version="2.0.5" />
<PackageReference Include="paccor.pcie" Version="0.5.0" />
<PackageReference Include="paccor.smbios" Version="0.5.0" />
<PackageReference Include="paccor.storage" Version="0.5.0" />
<PackageReference Include="Packaging.Targets" Version="0.1.226">
<PrivateAssets>all</PrivateAssets> <!-- These assets will be consumed but won't flow to the parent project -->
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Serilog" Version="2.11.0" />
<PackageReference Include="Serilog" Version="4.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="System.Management" Version="6.0.0" />
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
<PackageReference Include="WiX" Version="3.14.1">
<PrivateAssets>all</PrivateAssets> <!-- These assets will be consumed but won't flow to the parent project -->
@ -81,7 +85,7 @@
<Exec Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))'" Command="for /f %%i in ('dir /s /b $(FOLDER_PROTO)\*.proto') do ( $(protoc) -I=$(FOLDER_PROTO) --csharp_out=$(FOLDER_OUT) %%i )" />
<Exec Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'" Command="for file in `ls -1R $(FOLDER_PROTO)/*.proto` ; do $(protoc) -I=$(FOLDER_PROTO) --csharp_out=$(FOLDER_OUT) $file; done " />
</Target>
<Import Project="$(NuGetPackageRoot)paccor.paccor_scripts/1.0.1/contentFiles/any/net6.0/resources/paccor.paccor_scripts.targets" Condition="Exists('$(NuGetPackageRoot)paccor.paccor_scripts/1.0.1/contentFiles/any/net6.0/resources/paccor.paccor_scripts.targets')" />
<Import Project="$(NuGetPackageRoot)paccor.paccor_scripts/2.0.5/contentFiles/any/net8.0/resources/paccor.paccor_scripts.targets" Condition="Exists('$(NuGetPackageRoot)paccor.paccor_scripts/2.0.5/contentFiles/any/net8.0/resources/paccor.paccor_scripts.targets')" />
<Target Name="ImportPaccorScripts" BeforeTargets="PreBuildEvent">
<ItemGroup>
<PaccorScriptsLinux Include="$(dotnet_paccor_scripts_directory)/*" />

View File

@ -5,7 +5,7 @@
"certificate_output_directory": "",
"paccor_output_file": "",
"event_log_file": "",
"hardware_manifest_collectors": "paccor_scripts",
"hardware_manifest_collectors": "paccor_scripts,paccor.pcie,paccor.smbios,paccor.storage",
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],

View File

@ -77,7 +77,7 @@ namespace hirs {
public virtual string certificate_output_directory {
get; private set;
}
private List<IHardwareManifest> hardwareManifests = new();
private List<IHardwareManifestPlugin> hardwareManifests = new();
private Dictionary<string, string> hardware_manifest_collectors_with_args = new();
private bool hardware_manifest_collection_swid_enforced = false;
@ -163,7 +163,7 @@ namespace hirs {
List<string> names = hardware_manifest_collectors_with_args.Keys.ToList();
if (!string.IsNullOrWhiteSpace(configFromSettingsFile[Options.hardware_manifest_collection_swid_enforced.ToString()])) {
string hardware_manifest_collection_swid_enforced_str = $"{ configFromSettingsFile[Options.hardware_manifest_collection_swid_enforced.ToString()] }";
hardware_manifest_collection_swid_enforced = Boolean.Parse(hardware_manifest_collection_swid_enforced_str);
hardware_manifest_collection_swid_enforced = bool.Parse(hardware_manifest_collection_swid_enforced_str);
Log.Debug("SWID enforcement of Hardware Manifest Plugins are " + (hardware_manifest_collection_swid_enforced ? "en" : "dis") + "abled in settings.");
}
hardwareManifests = HardwareManifestPluginManagerUtils.LoadPlugins(names, hardware_manifest_collection_swid_enforced);
@ -196,23 +196,21 @@ namespace hirs {
public virtual string RunHardwareManifestCollectors() {
Log.Debug("Gathering data from loaded hardware manifest collectors.");
string manifestJson = "";
foreach (IHardwareManifest manifest in hardwareManifests) {
HardwareManifestProto.ManifestV2 manifestJson = new();
foreach (IHardwareManifestPlugin manifest in hardwareManifests) {
try {
Log.Debug(" Configuring " + manifest.Name);
if (hardware_manifest_collectors_with_args.ContainsKey(manifest.Name)) {
manifest.Configure(CLI.SplitArgs(hardware_manifest_collectors_with_args[manifest.Name]));
}
// TODO: Combine JSON Better
// OR Return proto objects
Log.Debug(" Gathering from " + manifest.Name);
manifestJson = string.Join(manifestJson, manifest.GatherHardwareManifestAsJsonString());
if (manifest.GatherHardwareIdentifiers()) {
manifestJson.MergeFrom(manifest.ManifestV2);
}
} catch (Exception e) {
Log.Debug($"Problem retrieving hardware manifest from {manifest.Name}.", e.InnerException);
}
}
//TODO: Verify JSON?
return manifestJson;
string manifestString = manifestJson.ToString();
return manifestString;
}
#endregion
@ -262,7 +260,7 @@ namespace hirs {
Log.Debug("Checking Auto Detect TPM setting.");
string auto_detect_tpm_str = $"{ configFromSettingsFile[Options.auto_detect_tpm.ToString()] }";
try {
auto_detect_tpm = Boolean.Parse(auto_detect_tpm_str);
auto_detect_tpm = bool.Parse(auto_detect_tpm_str);
Log.Debug(" Auto Detect TPM is " + (auto_detect_tpm ? "en" : "dis") + "abled.");
} catch (FormatException) {
auto_detect_tpm = false;

View File

@ -3,6 +3,7 @@ using Hirs.Pb;
using Serilog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

View File

@ -30,14 +30,14 @@ namespace hirs {
private readonly Tpm2 tpm;
private readonly Boolean simulator;
private readonly bool simulator;
private List<AuthSession> sessionTracking = new List<AuthSession>();
/**
* For TCP TpmDevices
*/
public CommandTpm(Boolean sim, string ip, int port) {
public CommandTpm(bool sim, string ip, int port) {
simulator = sim;
Tpm2Device tpmDevice = new TcpTpmDevice(ip, port);
tpm = TpmSetupByType(tpmDevice);

View File

@ -6,6 +6,9 @@ dependencies {
testImplementation libs.spring.boot.starter.test
// explicitly include the patched version of the logback-core dependency
testImplementation libs.logback.classic
testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok
}

View File

@ -24,17 +24,18 @@ dependencies {
implementation libs.spring.boot.starter.log4j2
implementation libs.minimal.json
// pull the pci dependency and ...
implementation libs.pci
// and explicitly include the patched version of the apache http client dependency
// explicitly include the patched version of the apache http client dependency
implementation libs.apacheHttpClient
implementation libs.slf4j.simple
compileOnly libs.lombok
annotationProcessor libs.lombok
testImplementation libs.spring.boot.starter.test
// explicitly include the patched version of the logback-core dependency
testImplementation libs.logback.classic
testImplementation project(path: ':HIRS_AttestationCA')
testCompileOnly libs.lombok

View File

@ -7,6 +7,7 @@ plugins {
id 'application'
id 'checkstyle'
id 'com.github.spotbugs' version '6.0.13' apply false
id 'org.owasp.dependencycheck' version '11.1.1'
id 'java'
}
@ -17,6 +18,7 @@ subprojects {
apply plugin: "com.github.spotbugs"
apply plugin: "java"
apply plugin: "checkstyle"
apply plugin: "org.owasp.dependencycheck"
repositories {
flatDir { dirs "lib" }

View File

@ -7,27 +7,30 @@ commonsLang3Version = "3.17.0"
gsonVersion = "2.11.0"
glassfishJakartaJsonVersion = "2.0.1"
glassfishJaxbRuntimeVersion = "4.0.5"
guavaVersion = "33.3.1-jre"
guavaVersion = "33.4.0-jre"
jacksonVersion = "2.18.2"
jakartaPersistenceApiVersion = "3.2.0"
jakartaPersistenceApiVersion = "3.1.0"
jakartaServletVersion = "3.0.0"
jakartaXmlVersion = "4.0.2"
jcommanderVersion = "2.0"
lombokVersion = "1.18.36"
logbackClassicVersion = "1.5.13"
mariadbVersion = "3.5.1"
minimalJsonVersion = "0.9.5"
ospackageVersion = "11.2.0"
pciVersion = "0.3"
protobufJavaVersion = "4.28.3"
springBootVersion = "3.4.0"
springCoreVersion = "6.2.1"
snakeYamlVersion = "2.0"
springBootVersion = "3.4.1"
springFrameworkVersion = "6.2.1"
springRetryVersion = "2.0.10"
tomcatVersion = "10.1.33"
tomcatVersion = "10.1.34"
#test dependencies versions
hsqldbVersion = "2.7.3"
slf4jVersion = "2.0.16"
jsonPathVersion = "2.9.0"
spotBugAnnotationVersion = "4.8.6"
xmlunitCoreVersion = "2.10.0"
[libraries]
apacheHttpClient = { module = "org.apache.httpcomponents:httpclient", version.ref = "apacheHttpClientVersion" }
@ -45,24 +48,31 @@ jakarta-persistence-api = { module = "jakarta.persistence:jakarta.persistence-ap
jakarta-servlet = { module = "org.glassfish.web:jakarta.servlet.jsp.jstl", version.ref = "jakartaServletVersion" }
jakarta-xml = { module = "jakarta.xml.bind:jakarta.xml.bind-api", version.ref = "jakartaXmlVersion" }
jcommander = { module = "org.jcommander:jcommander", version.ref = "jcommanderVersion" }
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logbackClassicVersion" }
lombok = { module = "org.projectlombok:lombok", version.ref = "lombokVersion" }
mariadb-java-client = { module = "org.mariadb.jdbc:mariadb-java-client", version.ref = "mariadbVersion" }
minimal-json = { module = "com.eclipsesource.minimal-json:minimal-json", version.ref = "minimalJsonVersion" }
pci = { module = "com.github.marandus:pci-ids", version.ref = "pciVersion" }
protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "protobufJavaVersion" }
slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4jVersion" }
snake-yaml = { module = "org.yaml:snakeyaml", version.ref = "snakeYamlVersion" }
spring-boot-starter-data-jpa = { module = "org.springframework.boot:spring-boot-starter-data-jpa", version.ref = "springBootVersion" }
spring-boot-starter-log4j2 = { module = "org.springframework.boot:spring-boot-starter-log4j2", version.ref = "springBootVersion" }
spring-boot-starter-tomcat = { module = "org.springframework.boot:spring-boot-starter-tomcat", version.ref = "springBootVersion" }
spring-boot-starter-validation = { module = "org.springframework.boot:spring-boot-starter-validation", version.ref = "springBootVersion" }
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web", version.ref = "springBootVersion" }
spring-framework-webmvc = { module = "org.springframework:spring-webmvc", version.ref = "springCoreVersion" }
spring-framework-expression = { module = "org.springframework:spring-expression", version.ref = "springFrameworkVersion" }
spring-framework-jdbc = { module = "org.springframework:spring-jdbc", version.ref = "springFrameworkVersion" }
spring-framework-webmvc = { module = "org.springframework:spring-webmvc", version.ref = "springFrameworkVersion" }
spring-retry = { module = "org.springframework.retry:spring-retry", version.ref = "springRetryVersion" }
tomcat-embed-core = { module = "org.apache.tomcat.embed:tomcat-embed-core", version.ref = "tomcatVersion" }
tomcat-embed-jasper = { module = "org.apache.tomcat.embed:tomcat-embed-jasper", version.ref = "tomcatVersion" }
tomcat-embed-websocket = { module = "org.apache.tomcat.embed:tomcat-embed-websocket", version.ref = "tomcatVersion" }
# test dependencies
hsqldb = { module = "org.hsqldb:hsqldb", version.ref = "hsqldbVersion" }
jsonPath = { module = "com.jayway.jsonpath:json-path", version.ref = "jsonPathVersion" }
spring-boot-starter-test = { module = "org.springframework.boot:spring-boot-starter-test", version.ref = "springBootVersion" }
spotbugs-annotations = { module = "com.github.spotbugs:spotbugs-annotations", version.ref = "spotBugAnnotationVersion" }
xmlunit-core = { module = "org.xmlunit:xmlunit-core", version.ref = "xmlunitCoreVersion" }
[plugins]

View File

@ -21,6 +21,7 @@ dependencies {
implementation libs.jakarta.xml
implementation libs.spring.boot.starter.log4j2
implementation libs.spring.boot.starter.data.jpa
implementation libs.logback.classic
compileOnly libs.lombok
annotationProcessor libs.lombok