2023-02-14 12:30:16 +00:00
|
|
|
plugins {
|
|
|
|
id 'application'
|
|
|
|
id 'java'
|
|
|
|
id 'war'
|
2024-02-14 14:53:57 +00:00
|
|
|
id 'com.netflix.nebula.ospackage' version '11.8.0'
|
2023-04-26 12:32:45 +00:00
|
|
|
id 'org.springframework.boot' version '3.0.6'
|
2023-02-14 12:30:16 +00:00
|
|
|
id 'io.spring.dependency-management' version '1.1.0'
|
2024-02-02 13:07:08 +00:00
|
|
|
id 'checkstyle'
|
2023-02-14 12:30:16 +00:00
|
|
|
}
|
2018-09-06 13:47:33 +00:00
|
|
|
|
2023-03-17 18:47:10 +00:00
|
|
|
// Get version from main project gradle
|
|
|
|
def packVersion = properties.get("packageVersion");
|
|
|
|
def jarVersion = properties.get("jarVersion");
|
2024-04-24 19:40:46 +00:00
|
|
|
def projVersion = properties.get("projVersion");
|
2023-03-17 18:47:10 +00:00
|
|
|
//println "packageVersion is ${projVersion}"
|
|
|
|
|
2023-02-14 12:30:16 +00:00
|
|
|
java {
|
|
|
|
toolchain {
|
|
|
|
languageVersion = JavaLanguageVersion.of(17)
|
2018-09-06 13:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-07 20:02:24 +00:00
|
|
|
bootRun {
|
|
|
|
if (project.hasProperty('debug')) {
|
2024-05-07 20:53:15 +00:00
|
|
|
jvmArgs project.debug
|
2024-05-07 20:02:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-14 12:30:16 +00:00
|
|
|
configurations {
|
|
|
|
compileOnly {
|
|
|
|
extendsFrom annotationProcessor
|
2018-09-06 13:47:33 +00:00
|
|
|
}
|
2023-06-27 19:58:36 +00:00
|
|
|
all*.exclude module: 'spring-boot-starter-logging'
|
2018-09-06 13:47:33 +00:00
|
|
|
}
|
|
|
|
|
2023-02-14 12:30:16 +00:00
|
|
|
repositories {
|
|
|
|
flatDir { dirs "lib" }
|
|
|
|
mavenCentral()
|
2018-09-06 13:47:33 +00:00
|
|
|
}
|
|
|
|
|
2023-02-14 12:30:16 +00:00
|
|
|
dependencies {
|
2023-03-07 01:54:49 +00:00
|
|
|
implementation project(':HIRS_Utils')
|
|
|
|
implementation project(':HIRS_AttestationCA')
|
|
|
|
|
2023-03-07 14:23:55 +00:00
|
|
|
implementation libs.pci
|
2023-06-13 13:29:29 +00:00
|
|
|
implementation libs.gson
|
2023-03-07 14:23:55 +00:00
|
|
|
implementation libs.bouncycastle
|
|
|
|
implementation libs.guava
|
|
|
|
implementation libs.jakarta.servlet
|
2024-04-17 13:38:11 +00:00
|
|
|
implementation libs.jakarta.api
|
|
|
|
implementation libs.jakarta.xml
|
2023-02-16 17:05:36 +00:00
|
|
|
|
2023-02-14 12:30:16 +00:00
|
|
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
|
|
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
|
|
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
2023-06-27 19:58:36 +00:00
|
|
|
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
|
|
|
|
implementation 'org.apache.logging.log4j:log4j-spring-boot'
|
2023-02-23 17:28:52 +00:00
|
|
|
implementation 'org.projectlombok:lombok'
|
2023-06-13 13:29:29 +00:00
|
|
|
implementation 'commons-fileupload:commons-fileupload:1.5'
|
2023-06-26 13:15:54 +00:00
|
|
|
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper:10.1.5'
|
2023-03-07 01:54:49 +00:00
|
|
|
|
2023-02-14 12:30:16 +00:00
|
|
|
compileOnly 'org.projectlombok:lombok'
|
2023-08-23 20:30:06 +00:00
|
|
|
implementation 'org.mariadb.jdbc:mariadb-java-client:3.1.4'
|
2023-02-14 12:30:16 +00:00
|
|
|
annotationProcessor 'org.projectlombok:lombok'
|
|
|
|
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
|
|
|
|
|
|
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
2023-10-13 20:57:01 +00:00
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3'
|
|
|
|
testImplementation 'org.hsqldb:hsqldb'
|
|
|
|
}
|
|
|
|
|
2024-02-02 13:07:08 +00:00
|
|
|
checkstyle {
|
|
|
|
toolVersion = '10.12.7'
|
|
|
|
configFile file("${rootDir}/config/checkstyle/checkstyle.xml")
|
|
|
|
}
|
|
|
|
// https://github.com/checkstyle/checkstyle/issues/14211#issuecomment-1884129948
|
|
|
|
configurations.checkstyle {
|
|
|
|
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
|
|
|
|
select("com.google.guava:guava:0")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
checkstyleMain {
|
|
|
|
source ='src/main/java'
|
|
|
|
}
|
|
|
|
checkstyleTest {
|
|
|
|
source ='src/test/java'
|
|
|
|
}
|
|
|
|
tasks.withType(Checkstyle) {
|
|
|
|
reports {
|
|
|
|
xml.required = false
|
|
|
|
html.required = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-13 20:57:01 +00:00
|
|
|
test {
|
|
|
|
useJUnitPlatform()
|
2023-02-14 12:30:16 +00:00
|
|
|
}
|
2018-09-06 13:47:33 +00:00
|
|
|
|
2024-02-21 18:16:13 +00:00
|
|
|
task buildVersion() {
|
|
|
|
doLast {
|
2024-02-13 13:59:43 +00:00
|
|
|
def verFile = new File(projectDir, "build/VERSION")
|
|
|
|
verFile.write("${jarVersion}")
|
2024-02-21 18:16:13 +00:00
|
|
|
}
|
|
|
|
}
|
2024-02-14 14:53:57 +00:00
|
|
|
|
2023-04-27 19:51:22 +00:00
|
|
|
ospackage {
|
|
|
|
packageName = 'HIRS_AttestationCA'
|
2024-04-24 19:40:46 +00:00
|
|
|
description = 'HIRS Attestation CA. Use systemctl status hirs-aca'
|
2023-04-27 19:51:22 +00:00
|
|
|
os = LINUX
|
|
|
|
arch = NOARCH
|
|
|
|
version = "$packVersion"
|
2024-04-24 19:40:46 +00:00
|
|
|
release = '2'
|
2024-02-14 14:53:57 +00:00
|
|
|
|
2024-04-24 19:40:46 +00:00
|
|
|
|
2023-04-27 19:51:22 +00:00
|
|
|
user 'root'
|
|
|
|
fileMode = 0755
|
|
|
|
|
|
|
|
addParentDirs = true
|
|
|
|
createDirectoryEntry true
|
|
|
|
|
2024-04-24 19:40:46 +00:00
|
|
|
into ('/etc/hirs') {
|
|
|
|
from '../VERSION'
|
|
|
|
}
|
2023-09-27 18:40:18 +00:00
|
|
|
// copy json tables
|
|
|
|
into ('/etc/hirs/aca/default-properties') {
|
|
|
|
from '../HIRS_AttestationCA/src/main/resources/component-class.json'
|
|
|
|
from '../HIRS_AttestationCA/src/main/resources/vendor-table.json'
|
|
|
|
}
|
|
|
|
// copy springboot property file
|
|
|
|
into ('/etc/hirs/aca/') {
|
|
|
|
from '../HIRS_AttestationCAPortal/src/main/resources/application.properties'
|
2024-02-13 13:59:43 +00:00
|
|
|
from 'build/VERSION'
|
2023-09-27 18:40:18 +00:00
|
|
|
}
|
2023-09-06 20:09:27 +00:00
|
|
|
// copy setup scripts to /opt/hirs/aca
|
|
|
|
into ('/opt/hirs/aca/scripts/') {
|
2024-03-13 17:49:42 +00:00
|
|
|
from '../package/linux/'
|
2023-06-02 19:23:55 +00:00
|
|
|
}
|
2023-09-06 20:09:27 +00:00
|
|
|
// copy the war file into /opt/hirs/aca
|
|
|
|
into ('/opt/hirs/aca/') {
|
|
|
|
from '../HIRS_AttestationCAPortal/build/libs/HIRS_AttestationCAPortal.war'
|
|
|
|
user 'root'
|
2024-02-13 13:59:43 +00:00
|
|
|
fileMode = 0755
|
2023-06-02 19:23:55 +00:00
|
|
|
}
|
2024-02-21 18:16:13 +00:00
|
|
|
|
2024-04-04 20:27:02 +00:00
|
|
|
// Install - check for existing setup
|
2024-04-24 19:40:46 +00:00
|
|
|
preInstall 'if [ -d /etc/hirs ]; then echo "Error: /etc/hirs/ exists, aborting install"; exit 1; fi;'
|
2024-04-04 20:27:02 +00:00
|
|
|
preInstall 'if [ -d /opt/hirs ]; then echo "Error: /opt/hirs/ exists, aborting install"; exit 1; fi;'
|
2023-09-06 20:09:27 +00:00
|
|
|
// Uninstall
|
2024-04-24 19:40:46 +00:00
|
|
|
preUninstall 'bash /opt/hirs/aca/scripts/aca/aca_remove_setup.sh $1'
|
2024-03-18 16:32:30 +00:00
|
|
|
preUninstall 'bash /opt/hirs/aca/scripts/systemd/aca_disable_service.sh'
|
2024-02-23 20:19:02 +00:00
|
|
|
postUninstall 'if [ -d /etc/hirs ]; then rm -rf /etc/hirs; fi;'
|
2024-04-24 19:40:46 +00:00
|
|
|
postUninstall 'if [ -d /opt/hirs ]; then rm -rf /opt/hirs; fi;'
|
2024-03-28 19:26:21 +00:00
|
|
|
|
2023-04-27 19:51:22 +00:00
|
|
|
buildRpm {
|
2024-02-21 18:16:13 +00:00
|
|
|
dependsOn ':HIRS_AttestationCAPortal:buildVersion'
|
2024-02-16 18:40:03 +00:00
|
|
|
dependsOn ':HIRS_AttestationCAPortal:bootWar'
|
2023-04-27 19:51:22 +00:00
|
|
|
arch = X86_64
|
2024-02-16 14:45:47 +00:00
|
|
|
// Required apps will be aut installed by dnf if not present
|
|
|
|
requires('java-17-openjdk', '17.0', GREATER | EQUAL)
|
2024-02-14 14:53:57 +00:00
|
|
|
requires('mariadb-server' , '10.3' , GREATER | EQUAL)
|
2024-02-16 14:45:47 +00:00
|
|
|
requires('procps-ng', '3.3.15', GREATER | EQUAL)
|
2024-02-21 18:16:13 +00:00
|
|
|
requires('alternatives', '1.19', GREATER | EQUAL)
|
2024-02-16 14:45:47 +00:00
|
|
|
// Post Trans stage (Occurs after required app and postInstall stage)
|
|
|
|
// Note postInstall wont wait forrequired apps
|
2024-02-21 18:16:13 +00:00
|
|
|
postTrans 'update-alternatives --set java java-17-openjdk.x86_64'
|
2024-02-23 20:19:02 +00:00
|
|
|
postTrans 'firewall-cmd --add-port=8443/tcp --permanent'
|
|
|
|
postTrans 'firewall-cmd --reload'
|
2024-02-16 14:45:47 +00:00
|
|
|
postTrans 'bash /opt/hirs/aca/scripts/aca/aca_setup.sh -u'
|
2024-03-18 16:32:30 +00:00
|
|
|
postTrans 'bash /opt/hirs/aca/scripts/systemd/aca_enable_service.sh'
|
2024-02-16 14:45:47 +00:00
|
|
|
postTrans 'chmod +x /opt/hirs/aca/scripts/aca/*'
|
|
|
|
postTrans 'if [ -f /opt/hirs/aca/VERSION ]; then rm /opt/hirs/aca/VERSION; fi;'
|
|
|
|
// Wait for ACA to start up before finishing the install
|
|
|
|
postTrans 'bash /opt/hirs/aca/scripts/aca/check_for_aca.sh'
|
2023-04-27 19:51:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
buildDeb {
|
2024-02-21 18:16:13 +00:00
|
|
|
dependsOn ':HIRS_AttestationCAPortal:buildVersion'
|
2024-02-16 18:40:03 +00:00
|
|
|
dependsOn ':HIRS_AttestationCAPortal:bootWar'
|
2023-10-10 18:29:37 +00:00
|
|
|
packageName = 'hirs-attestationca'
|
2023-04-27 19:51:22 +00:00
|
|
|
arch = 'amd64'
|
2024-02-16 14:45:47 +00:00
|
|
|
requires('openjdk-17-jdk', '17.0', GREATER | EQUAL)
|
|
|
|
requires('mariadb-server' , '10.3' , GREATER | EQUAL)
|
|
|
|
requires('curl')
|
|
|
|
// Install after required packages
|
|
|
|
postInstall 'bash /opt/hirs/aca/scripts/aca/aca_setup.sh -u'
|
2024-03-18 16:32:30 +00:00
|
|
|
postInstall 'bash /opt/hirs/aca/scripts/systemd/aca_enable_service.sh'
|
2024-02-16 18:40:03 +00:00
|
|
|
postInstall 'chmod +x /opt/hirs/aca/scripts/aca/*'
|
|
|
|
postInstall 'if [ -f /opt/hirs/aca/VERSION ]; then rm /opt/hirs/aca/VERSION; fi;'
|
2024-02-16 14:45:47 +00:00
|
|
|
// Wait for ACA to start up before finishing the install
|
|
|
|
postInstall 'bash /opt/hirs/aca/scripts/aca/check_for_aca.sh'
|
2023-04-27 19:51:22 +00:00
|
|
|
}
|
|
|
|
}
|