Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): update build script to work with gradle 7 #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand Down Expand Up @@ -96,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:

Expand Down
74 changes: 41 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ buildscript {
}

dependencies {
classpath 'org.ajoberstar:gradle-git:0.2.3'
classpath 'org.ajoberstar:gradle-git:1.5.1'
}
}

Expand All @@ -46,7 +46,7 @@ configurations {
ossclient
}

import org.ajoberstar.gradle.git.tasks.*;
import org.ajoberstar.grgit.*;

//
// Publishing infos
Expand All @@ -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'
}
}

Expand All @@ -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)
}
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -342,8 +350,8 @@ publishing {
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : stagingRepoUrl

credentials {
username = ossrhUsername
password = ossrhPassword
username = "ossrhUsername"
password = "ossrhPassword"
}
}
}
Expand Down