updated with package for tcg_rim_tool [no ci]

This commit is contained in:
iadgovuser26 iadgovuser26@empire.eclipse.ncsc.mil 2023-03-17 14:47:10 -04:00
parent d862e95708
commit ef65c6ad8b
11 changed files with 143 additions and 55 deletions

View File

@ -7,6 +7,11 @@ plugins {
id 'io.spring.dependency-management' version '1.1.0' id 'io.spring.dependency-management' version '1.1.0'
} }
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion");
//println "packageVersion is ${projVersion}"
java { java {
toolchain { toolchain {
languageVersion = JavaLanguageVersion.of(17) languageVersion = JavaLanguageVersion.of(17)
@ -53,3 +58,5 @@ war {
} }
archiveFileName = 'HIRS_AttestationCAPortal.war' archiveFileName = 'HIRS_AttestationCAPortal.war'
} }

View File

@ -1,6 +1,11 @@
plugins { plugins {
id 'java' id 'java'
} }
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion");
//println "packageVersion is ${projVersion}"
java { java {
toolchain { toolchain {
@ -10,7 +15,6 @@ java {
repositories { repositories {
mavenCentral() mavenCentral()
flatDir { dirs "lib" } flatDir { dirs "lib" }
} }
@ -47,9 +51,13 @@ test {
useJUnitPlatform() useJUnitPlatform()
} }
//task generateXjcLibrary(type:Exec) { jar {
// workingDir 'config' duplicatesStrategy = DuplicatesStrategy.EXCLUDE
// manifest {
// commandLine './genXjcLibrary.sh' attributes(
//} 'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
//compileJava.dependsOn generateXjcLibrary )
}
//jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
archiveVersion = jarVersion
}

View File

@ -257,14 +257,7 @@ public final class TCGEventLog {
return pcrs; return pcrs;
} }
/**
* Returns a flag which is set if the event log follows the "Crypto Agile" Format Type.
* A false implies the type is SHA1 format.
* @return true if log follows the Crypto Agile format.
*/
public boolean isCryptoAgile() {
return bCryptoAgile;
}
/** /**
* Returns a list of event found in the Event Log. * Returns a list of event found in the Event Log.

View File

@ -36,6 +36,7 @@ def gitHash = { ->
return gitHash; return gitHash;
} }
project.ext["jarVersion"] = "${projectVersion}.${buildTime}.${gitHash}"
project.ext["packageVersion"] = "${projectVersion}.${buildTime}.${gitHash}.el8" project.ext["packageVersion"] = "${projectVersion}.${buildTime}.${gitHash}.el8"
//subprojects { //subprojects {

View File

@ -2,3 +2,4 @@ excludeGroups=rhel-6,performance
includeGroups= includeGroups=
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
org.gradle.caching=true

View File

@ -3,17 +3,20 @@ rootProject.name = 'HIRS'
include 'HIRS_Utils', include 'HIRS_Utils',
'HIRS_AttestationCA', 'HIRS_AttestationCA',
'HIRS_AttestationCAPortal', 'HIRS_AttestationCAPortal',
':tools:tcg_eventlog_tool' ':tools:tcg_eventlog_tool',
':tools:tcg_rim_tool'
dependencyResolutionManagement { dependencyResolutionManagement {
versionCatalogs { versionCatalogs {
libs { libs {
version('springboot', '3.0.1') version('springboot', '3.0.1')
version('jackson', '2.14.2') version('jackson', '2.14.2')
library('bouncycastle', 'org.bouncycastle:bcmail-jdk15on:1.70')
library('commons-codec', 'commons-codec:commons-codec:1.15') library('commons-codec', 'commons-codec:commons-codec:1.15')
library('commons-lang3', 'org.apache.commons:commons-lang3:3.12.0') library('commons-lang3', 'org.apache.commons:commons-lang3:3.12.0')
library('commons_io', 'commons-io:commons-io:2.11.0') library('commons_io', 'commons-io:commons-io:2.11.0')
library('bouncycastle', 'org.bouncycastle:bcmail-jdk15on:1.70') library('glassfish_json', 'org.glassfish:javax.json:1.1.4')
library('glassfish_jaxb_runtime', 'org.glassfish.jaxb:jaxb-runtime:2.3.1')
library('guava', 'com.google.guava:guava:31.1-jre') library('guava', 'com.google.guava:guava:31.1-jre')
library('minimal-json', 'com.eclipsesource.minimal-json:minimal-json:0.9.5') library('minimal-json', 'com.eclipsesource.minimal-json:minimal-json:0.9.5')
library('jakarta-servlet', 'org.glassfish.web:jakarta.servlet.jsp.jstl:3.0.0') library('jakarta-servlet', 'org.glassfish.web:jakarta.servlet.jsp.jstl:3.0.0')
@ -21,12 +24,15 @@ dependencyResolutionManagement {
library('jakarta-xml', 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0') library('jakarta-xml', 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0')
library('jackson-core', 'com.fasterxml.jackson.core', 'jackson-core').versionRef('jackson') library('jackson-core', 'com.fasterxml.jackson.core', 'jackson-core').versionRef('jackson')
library('jackson-databind', 'com.fasterxml.jackson.core', 'jackson-databind').versionRef('jackson') library('jackson-databind', 'com.fasterxml.jackson.core', 'jackson-databind').versionRef('jackson')
library('jcommander', 'com.beust:jcommander:1.82') library('jcommander', 'com.beust:jcommander:1.82')
// library('log4j2', 'org.apache.logging.log4j:log4j-api:2.17.1')
// library('log4j2-core', 'org.apache.logging.log4j:log4j-core:2.17.1')
library('lombok', 'org.projectlombok:lombok:1.18.26')
library('pci', 'com.github.marandus:pci-ids:0.3') library('pci', 'com.github.marandus:pci-ids:0.3')
library('testng', 'org.testng:testng:7.4.0')
// library('spring-datajpa', 'org.springframework.boot', 'spring-boot-starter-data-jpa').version('springboot') // library('spring-datajpa', 'org.springframework.boot', 'spring-boot-starter-data-jpa').version('springboot')
// library('spring-datajpa', 'org.springframework.boot', 'spring-boot-starter-web').version('springboot') // library('spring-datajpa', 'org.springframework.boot', 'spring-boot-starter-web').version('springboot')
// library('spring-datajpa', 'org.springframework.boot', 'spring-boot-starter-validation').version('springboot') // library('spring-datajpa', 'org.springframework.boot', 'spring-boot-starter-validation').version('springboot')
library('lombok', 'org.projectlombok:lombok:1.18.26')
} }
} }
} }

View File

@ -1,12 +1,14 @@
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
plugins { plugins {
id "java" id "java"
// id "findbugs" // id "findbugs"
// id "checkstyle" // id "checkstyle"
id "nebula.ospackage" version "9.1.1" id "nebula.ospackage" version "9.1.1"
} }
version = '1.0' // Get version from main project gradle
def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion");
//println "packageVersion is ${projVersion}"
java { java {
toolchain { toolchain {
@ -16,9 +18,10 @@ java {
repositories { repositories {
mavenCentral() mavenCentral()
flatDir { dirs "lib" }
} }
dependencies { dependencies {
implementation project(':HIRS_Utils') implementation project(':HIRS_Utils')
implementation libs.jcommander implementation libs.jcommander
implementation libs.commons.io implementation libs.commons.io
@ -39,7 +42,6 @@ ext.configDir = new File(projectDir, 'config')
// showViolations = true // showViolations = true
//} //}
//findbugs { //findbugs {
// toolVersion = '3.0.0' // toolVersion = '3.0.0'
// ignoreFailures = false // ignoreFailures = false
@ -47,19 +49,18 @@ ext.configDir = new File(projectDir, 'config')
//} //}
jar { jar {
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF' // Keep jar clean:
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { manifest {
attributes( attributes(
"Main-Class": "hirs.tcg_eventlog.Main", "Main-Class": "hirs.tcg_eventlog.Main",
'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ') 'Class-Path':configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
) )
} }
// from(configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) {} //jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
// exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA' archiveVersion = jarVersion
} }
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
//println "packageVersion is ${projVersion}"
// Produce packages // Produce packages
ospackage { ospackage {
@ -74,8 +75,7 @@ ospackage {
into ('/opt/hirs/eventlog/lib') { into ('/opt/hirs/eventlog/lib') {
from jar.outputs.files from jar.outputs.files
from 'lib' from configurations.runtimeClasspath
from 'configurations.runtimeClasspath'
} }
into ('/opt/hirs/eventlog/scripts') { into ('/opt/hirs/eventlog/scripts') {
from ('scripts') { from ('scripts') {
@ -92,6 +92,12 @@ ospackage {
details.file.name.endsWith('.odt') details.file.name.endsWith('.odt')
} }
} }
from('./') {
include {
FileTreeElement details ->
details.file.name.endsWith('.md')
}
}
} }
// Copy vendor-table into /tmp to avoid conflict with the ACA // Copy vendor-table into /tmp to avoid conflict with the ACA
into('/tmp/elt/default-properties') { into('/tmp/elt/default-properties') {
@ -105,10 +111,11 @@ ospackage {
link("/usr/local/bin/elt", "/opt/hirs/eventlog/scripts/eventlog.sh", 0x755) link("/usr/local/bin/elt", "/opt/hirs/eventlog/scripts/eventlog.sh", 0x755)
// PostInstall // PostInstall
//postInstall "cp ../../HIRS_Utils/build/libs/* /opt/hirs/eventlog/lib/."
// Copy files from /opt/elt/default-properties/ to avoid conflicts with the ACA // Copy files from /opt/elt/default-properties/ to avoid conflicts with the ACA
postInstall "cp /tmp/elt/default-properties/vendor-table.json /opt/hirs/default-properties/." postInstall "cp /tmp/elt/default-properties/* /opt/hirs/default-properties/."
postInstall "rm -rf /tmp/elt" postInstall "rm -rf /tmp/elt"
// Uninstall // Uninstall
// copy files to where package manager exspects them and remove project files // copy files to where package manager exspects them and remove project files
preUninstall "mkdir -p /tmp/elt/default-properties" preUninstall "mkdir -p /tmp/elt/default-properties"
@ -121,4 +128,4 @@ ospackage {
buildDeb { buildDeb {
arch = X86_64 arch = X86_64
} }
} }

View File

@ -4,5 +4,5 @@
scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
baseDir=${scriptDir%/*} baseDir=${scriptDir%/*}
libDir=$baseDir"/lib/" libDir=$baseDir"/lib/"
jar="tcg_eventlog_tool-1.0.jar"; jar="tcg_eventlog_tool-*.jar";
java -jar $libDir$jar "$@" java -jar $libDir$jar "$@"

View File

@ -115,7 +115,7 @@ final class Main {
// General event log output // General event log output
if ((bEventFlag || bHexFlag) && !bPcrFlag) { if ((bEventFlag || bHexFlag) && !bPcrFlag) {
if (!bHexFlag) { if (!bHexFlag) {
if (evLog.isCryptoAgile()) { if (evLog.isBCryptoAgile()) {
writeOut("\nEvent Log follows the \"Crypto Agile\" format and has " writeOut("\nEvent Log follows the \"Crypto Agile\" format and has "
+ evLog.getEventList().size() + " events:\n\n"); + evLog.getEventList().size() + " events:\n\n");
} else { } else {

View File

@ -1,12 +1,35 @@
apply plugin: 'java' plugins {
id "java"
id "nebula.ospackage" version "9.1.1"
id 'com.intershop.gradle.jaxb' version '5.1.0'
}
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion");
//println "packageVersion is ${projVersion}"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories { repositories {
mavenCentral() mavenCentral()
flatDir { dirs "lib" }
} }
dependencies { dependencies {
compile 'javax.json:javax.json-api:1.1.4', 'org.glassfish:javax.json:1.1.4', 'com.beust:jcommander:1.72', 'org.bouncycastle:bcmail-jdk15on:1.59' implementation libs.bouncycastle
testCompile 'org.testng:testng:6.8.8' implementation libs.glassfish.json
implementation libs.glassfish.jaxb.runtime
implementation libs.jcommander
// implementation libs.javax.json
// implementation libs.javax.jaxb
// implementation libs.javax.annotation
testImplementation libs.testng
} }
test { test {
@ -14,19 +37,61 @@ test {
} }
jar { jar {
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { manifest {
attributes("Main-Class": "hirs.swid.Main", attributes("Main-Class": "hirs.swid.Main",
"Class-Path": configurations.runtime.files.collect { "lib/$it.name" }.join(' ') 'Class-Path':configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
) )
} }
from(configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) {} //jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA' archiveVersion = jarVersion
} }
uploadArchives { ospackage {
repositories { packageName = 'tcg-rim-tool'
flatDir { os = LINUX
dirs "${buildDir}" arch = NOARCH
} version = "$packVersion"
} release = '1'
user 'root'
fileMode = 0755
into ('/opt/hirs/rimtool/lib') {
from jar.outputs.files
from configurations.runtimeClasspath
from 'libs'
}
into ('/opt/hirs/rimtool/scripts') {
from ('scripts') {
exclude {
FileTreeElement details ->
details.file.name.endsWith('.bat')
}
}
}
into ('/opt/hirs/rimtool/docs') {
from('./') {
include {
FileTreeElement details ->
details.file.name.endsWith('.md')
}
}
}
into ('/opt/hirs/rimtool/data') {
from('src/test/resources/') {
}
}
link("/usr/local/bin/rim", "/opt/hirs/rimtool/scripts/rimtool.sh", 0x755)
} }
buildRpm {
arch = X86_64
}
buildDeb {
arch = 'amd64'
}

View File

@ -3,6 +3,6 @@
# Calls the the_tcg_rim_tool and passes in parameters # Calls the the_tcg_rim_tool and passes in parameters
scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
baseDir=${scriptDir%/*} baseDir=${scriptDir%/*}
jar="tcg_rim_tool-2.1.0.jar"; libDir=$baseDir"/lib/"
java -jar $baseDir/$jar "$@" jar="tcg_rim_tool-*.jar";
java -jar $libDir$jar "$@"