From 1ade8acb7f7033c91146b37120dea924628b3d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20H=C3=A9bert?= Date: Mon, 3 Oct 2022 10:58:03 +0200 Subject: [PATCH 1/2] fix(build): update build script to work with gradle 7 --- README.md | 8 ++++-- build.gradle | 74 +++++++++++++++++++++++++++++----------------------- 2 files changed, 47 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 0d00945..250b8ac 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ The OSS wrapping key is generated and encrypted with multiple PGP keys. Optional Calls to the OSS are authenticated using signatures generated by an SSH agent. -The dialogue with the SSH agent is established using the JUDS 0.94 library (see https://github.com/mcfunley/juds). - +The dialogue with the SSH agent is established using the JUDS 0.95 library (see https://github.com/mcfunley/juds). +To correctly install the JUDS library, you may have to install the `lib32-gcc-libs` library. Follow those steps to set up an OSS instance: @@ -27,6 +27,10 @@ Note: On OSX you may have to run the following first: ## 2. Generate a master secret +To build OSS client run + + gradle ossClientJar + ### 2.1. Export your PGP keyring (we use gpg in the example below) gpg --export -a > pubring.gpg diff --git a/build.gradle b/build.gradle index c15f5b8..44fff0a 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ buildscript { } dependencies { - classpath 'org.ajoberstar:gradle-git:0.2.3' + classpath 'org.ajoberstar:gradle-git:1.5.1' } } @@ -46,7 +46,7 @@ configurations { ossclient } -import org.ajoberstar.gradle.git.tasks.*; +import org.ajoberstar.grgit.*; // // Publishing infos @@ -59,29 +59,37 @@ version = '1.0.1' // Retrieve/Configure/Build JUDS // -task clonejuds(type: GitClone) { +task clonejuds { def destination = file('juds') - uri = 'https://github.com/mcfunley/juds.git' - destinationPath = destination - bare = false - enabled = !destination.exists() //to clone only once + if (!destination.exists()) { + Grgit.clone(dir: file('juds'), uri: 'https://github.com/mcfunley/juds.git') + } +} + +task autoConfjuds(type: Exec, dependsOn: 'clonejuds') { + workingDir './juds' + if (!new File('./juds/juds-0.95.jar').exists()) { + commandLine './autoconf.sh' + } else { + commandLine 'ls', 'juds-0.95.jar' + } } -task confjuds(type: Exec, dependsOn: 'clonejuds') { +task confjuds(type: Exec, dependsOn: 'autoConfjuds') { workingDir './juds' - if (!new File('./juds/juds-0.94.jar').exists()) { + if (!new File('./juds/juds-0.95.jar').exists()) { commandLine './configure','CFLAGS=-I' + System.getProperty('java.home') + '/include' } else { - commandLine 'ls', 'juds-0.94.jar' + commandLine 'ls', 'juds-0.95.jar' } } task buildjuds(type: Exec, dependsOn: 'confjuds') { workingDir './juds' - if (!new File('./juds/juds-0.94.jar').exists()) { + if (!new File('./juds/juds-0.95.jar').exists()) { commandLine 'make' } else { - commandLine 'ls', 'juds-0.94.jar' + commandLine 'ls', 'juds-0.95.jar' } } @@ -98,34 +106,34 @@ repositories { // dependencies { - compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.47' - compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.47' - compile group: 'org.bouncycastle', name: 'bcpg-jdk15on', version: '1.47' - compile group: 'javax.servlet', name: 'servlet-api', version: '2.5' - compile group: 'com.google.inject', name: 'guice', version: '3.0' - compile group: 'com.google.inject.extensions', name: 'guice-servlet', version: '3.0' - compile group: 'com.google.code.gson', name: 'gson', version: '2.2.2' - compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.2.5' - compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.2.5' - compile group: 'org.slf4j', name: 'slf4j-api', version: '1.6.6' - compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.6.6' - compile group: 'org.apache.pig', name: 'pig', version: '0.8.0', transitive: false - compile group: 'org.apache.zookeeper', name: 'zookeeper', version: '3.3.5', transitive: false - compile group: 'org.apache.hadoop', name: 'hadoop-core', version: '0.20.2', transitive: false - compile group: 'log4j', name: 'log4j', version: '1.2.15', transitive: false + implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.47' + implementation group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.47' + implementation group: 'org.bouncycastle', name: 'bcpg-jdk15on', version: '1.47' + implementation group: 'javax.servlet', name: 'servlet-api', version: '2.5' + implementation group: 'com.google.inject', name: 'guice', version: '3.0' + implementation group: 'com.google.inject.extensions', name: 'guice-servlet', version: '3.0' + implementation group: 'com.google.code.gson', name: 'gson', version: '2.2.2' + implementation group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.2.5' + implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.2.5' + implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.6.6' + implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.6.6' + implementation group: 'org.apache.pig', name: 'pig', version: '0.8.0', transitive: false + implementation group: 'org.apache.zookeeper', name: 'zookeeper', version: '3.3.5', transitive: false + implementation group: 'org.apache.hadoop', name: 'hadoop-core', version: '0.20.2', transitive: false + implementation group: 'log4j', name: 'log4j', version: '1.2.15', transitive: false - compile files('juds/juds-0.94.jar') + implementation files('juds/juds-0.95.jar') tools files('tools/jarjar-1.4.jar') - testCompile group: 'junit', name: 'junit', version: '4.+' + testImplementation group: 'junit', name: 'junit', version: '4.+' } war { ext.clspth = [] for (f in classpath) { - if (!f.toString().endsWith('juds-0.94.jar')) { + if (!f.toString().endsWith('juds-0.95.jar')) { ext.clspth.add(f) } } @@ -263,7 +271,7 @@ task ossClientJar(type: Jar, dependsOn: jar) { // // Iterate over .jar files // - configurations.runtime.files.findAll {file -> + configurations.runtimeClasspath.files.findAll {file -> ['log4', 'hadoop-', 'pig-', 'slf4j-', 'servlet-api', 'guice-servlet', 'guice', 'javax.inject', 'aopalliance', 'asm'].every { !file.name.startsWith(it) } }.each {jarjarFile -> zipfileset(src: jarjarFile) { @@ -342,8 +350,8 @@ publishing { url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : stagingRepoUrl credentials { - username = ossrhUsername - password = ossrhPassword + username = "ossrhUsername" + password = "ossrhPassword" } } } From 85e91b66e86f2b8b56fbb47ec4df0edc32fc35cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20H=C3=A9bert?= Date: Mon, 10 Oct 2022 17:49:42 +0200 Subject: [PATCH 2/2] feat(doc): add hint about how to run oss with gradle 7 --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 250b8ac..07fb50b 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,18 @@ oss.token.ttl Delay in ms during which authentication tokens will be considered JAVA_OPTS="-Doss.keystore.dir=/var/tmp/oss-test -Doss.init.sshkeys=... -Doss.gensecret.sshkeys=... -Doss.putsecret.sshkeys=... -Doss.acl.sshkeys=..." gradle jettyRun +When using oss with Gradle version above of 7.0, `gradle jettyRun` is not available anymore. However you can still download a version of jetty compatible with the jdk8: https://search.maven.org/artifact/org.eclipse.jetty/jetty-runner. Download the jetty jar file of a version `9.X`. + +Then write a `run.sh` file which would look like: + +```sh +## run.sh file +export JAVA_OPTS="-Doss.keystore.dir=/var/tmp/oss-test -Doss.init.sshkeys=46:94:d7:......:26:d9:ac -Doss.gensecret.sshkeys=46:94:d7:......:26:d9:ac -Doss.putsecret.sshkeys=46:94:d7:......:26:d9:ac -Doss.acl.sshkeys=46:94:d7:......:26:d9:ac" +echo "runing OSS war " +java $JAVA_OPTS -jar jetty/jetty-runner-9.4.49.v20220914.jar --port 8080 --host 127.0.0.1 --path /oss build/libs/oss-1.0.1.war +``` + +And finally use this `run.sh` to start oss ## 4. Have K persons send their master secret split to OSS using the following command: