mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 15:20:54 +03:00
* Improve SshdContainer: log `docker build` to stdout, don't wait too long if container exited * Fix #740: Lean on Config.keyAlgorithms choosing between rsa-sha2-* and ssh-rsa Previously, there was a heuristic that was choosing rsa-sha2-512 after receiving a host key of type RSA. It didn't work well when a server doesn't have an RSA host key. OpenSSH 8.8 introduced a breaking change: it removed ssh-rsa from the default list of supported public key signature algorithms. SSHJ was unable to connect to OpenSSH 8.8 server if the server has an EcDSA or Ed25519 host key. Current behaviour behaves the same as OpenSSH 8.8 client does. SSHJ doesn't try to determine rsa-sha2-* support on the fly. Instead, it looks only on `Config.getKeyAlgorithms()`, which may or may not contain ssh-rsa and rsa-sha2-* in any order. Sorry, this commit mostly reverts changes from #607. * Introduce ConfigImpl.prioritizeSshRsaKeyAlgorithm to deal with broken backward compatibility Co-authored-by: Jeroen van Erp <jeroen@hierynomus.com>
284 lines
8.4 KiB
Groovy
284 lines
8.4 KiB
Groovy
plugins {
|
|
id "java"
|
|
id "groovy"
|
|
id "jacoco"
|
|
id "com.github.blindpirate.osgi" version '0.0.6'
|
|
id "maven-publish"
|
|
id "signing"
|
|
id 'pl.allegro.tech.build.axion-release' version '1.13.3'
|
|
id "com.bmuschko.docker-remote-api" version "7.1.0"
|
|
id "com.github.hierynomus.license" version "0.16.1"
|
|
id 'ru.vyarus.github-info' version '1.2.0'
|
|
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
group = "com.hierynomus"
|
|
defaultTasks ["build"]
|
|
ext.moduleName = "${project.group}.${project.name}"
|
|
|
|
scmVersion {
|
|
tag {
|
|
prefix = 'v'
|
|
versionSeparator = ''
|
|
}
|
|
hooks {
|
|
pre 'fileUpdate', [file: 'README.adoc', pattern: { v, c -> /:sshj_version: .*/}, replacement: { v, c -> ":sshj_version: $v" }]
|
|
pre 'commit'
|
|
}
|
|
}
|
|
|
|
project.version = scmVersion.version
|
|
|
|
configurations.implementation.transitive = false
|
|
|
|
def bouncycastleVersion = "1.69"
|
|
def sshdVersion = "2.1.0"
|
|
|
|
dependencies {
|
|
implementation "org.slf4j:slf4j-api:1.7.32"
|
|
implementation "org.bouncycastle:bcprov-jdk15on:$bouncycastleVersion"
|
|
implementation "org.bouncycastle:bcpkix-jdk15on:$bouncycastleVersion"
|
|
implementation "com.jcraft:jzlib:1.1.3"
|
|
implementation "com.hierynomus:asn-one:0.6.0"
|
|
|
|
implementation "net.i2p.crypto:eddsa:0.3.0"
|
|
|
|
testImplementation "junit:junit:4.12"
|
|
testImplementation 'org.spockframework:spock-core:1.3-groovy-2.4'
|
|
testImplementation "org.mockito:mockito-core:2.28.2"
|
|
testImplementation "org.apache.sshd:sshd-core:$sshdVersion"
|
|
testImplementation "org.apache.sshd:sshd-sftp:$sshdVersion"
|
|
testImplementation "org.apache.sshd:sshd-scp:$sshdVersion"
|
|
testImplementation "ch.qos.logback:logback-classic:1.2.6"
|
|
testImplementation 'org.glassfish.grizzly:grizzly-http-server:2.4.4'
|
|
testImplementation 'org.apache.httpcomponents:httpclient:4.5.9'
|
|
testImplementation 'org.testcontainers:testcontainers:1.16.2'
|
|
}
|
|
|
|
license {
|
|
header rootProject.file('LICENSE_HEADER')
|
|
strictCheck true
|
|
mapping {
|
|
java = 'SLASHSTAR_STYLE'
|
|
}
|
|
excludes(['**/djb/Curve25519.java', '**/sshj/common/Base64.java', '**/com/hierynomus/sshj/userauth/keyprovider/bcrypt/*.java'])
|
|
}
|
|
|
|
if (!JavaVersion.current().isJava9Compatible()) {
|
|
throw new GradleScriptException("Minimum compilation version is Java 9")
|
|
}
|
|
|
|
// This disables the pedantic doclint feature of JDK8
|
|
if (JavaVersion.current().isJava8Compatible()) {
|
|
tasks.withType(Javadoc) {
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
}
|
|
}
|
|
|
|
compileJava {
|
|
options.compilerArgs.addAll(['--release', '7'])
|
|
}
|
|
|
|
task writeSshjVersionProperties {
|
|
doLast {
|
|
project.file("${project.buildDir}/resources/main").mkdirs()
|
|
project.file("${project.buildDir}/resources/main/sshj.properties").withWriter { w ->
|
|
w.append("sshj.version=${version}")
|
|
}
|
|
}
|
|
}
|
|
|
|
jar.dependsOn writeSshjVersionProperties
|
|
jar {
|
|
inputs.property("moduleName", moduleName)
|
|
manifest {
|
|
attributes 'Automatic-Module-Name': moduleName
|
|
|
|
// please see http://bnd.bndtools.org/chapters/390-wrapping.html
|
|
instruction "Bundle-Description", "SSHv2 library for Java"
|
|
instruction "Bundle-License", "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
instruction "Import-Package", "!net.schmizz.*"
|
|
instruction "Import-Package", "!com.hierynomus.sshj.*"
|
|
instruction "Import-Package", "javax.crypto*"
|
|
instruction "Import-Package", "!net.i2p.crypto.eddsa.math"
|
|
instruction "Import-Package", "net.i2p*"
|
|
instruction "Import-Package", "com.jcraft.jzlib*;version=\"[1.1,2)\";resolution:=optional"
|
|
instruction "Import-Package", "org.slf4j*;version=\"[1.7,5)\""
|
|
instruction "Import-Package", "org.bouncycastle*;resolution:=optional"
|
|
instruction "Import-Package", "org.bouncycastle.jce.provider;resolution:=optional"
|
|
instruction "Import-Package", "*"
|
|
instruction "Export-Package", "com.hierynomus.sshj.*;version=\"${project.jar.manifest.version}\""
|
|
instruction "Export-Package", "net.schmizz.*;version=\"${project.jar.manifest.version}\""
|
|
}
|
|
}
|
|
|
|
|
|
java {
|
|
withJavadocJar()
|
|
withSourcesJar()
|
|
}
|
|
|
|
sourcesJar {
|
|
manifest {
|
|
attributes(
|
|
// Add the needed OSGI attributes
|
|
"Bundle-ManifestVersion": "2",
|
|
"Bundle-Name": "${project.jar.manifest.name} Source",
|
|
"Bundle-Version": project.jar.manifest.version,
|
|
"Eclipse-SourceBundle": "${project.jar.manifest.symbolicName};version=\"${project.jar.manifest.version}\";roots:=\".\"",
|
|
"Bundle-SymbolicName": "${project.jar.manifest.symbolicName}.source"
|
|
)
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
integrationTestImplementation.extendsFrom testImplementation
|
|
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
|
|
}
|
|
|
|
sourceSets {
|
|
integrationTest {
|
|
groovy {
|
|
compileClasspath += sourceSets.main.output + sourceSets.test.output
|
|
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
|
|
srcDir file('src/itest/groovy')
|
|
}
|
|
resources.srcDir file('src/itest/resources')
|
|
}
|
|
}
|
|
|
|
task integrationTest(type: Test) {
|
|
testClassesDirs = sourceSets.integrationTest.output.classesDirs
|
|
classpath = sourceSets.integrationTest.runtimeClasspath
|
|
}
|
|
|
|
tasks.withType(Test) {
|
|
testLogging {
|
|
exceptionFormat = 'full'
|
|
}
|
|
include "**/*Test.*"
|
|
include "**/*Spec.*"
|
|
if (!project.hasProperty("allTests")) {
|
|
useJUnit {
|
|
excludeCategories 'com.hierynomus.sshj.test.SlowTests'
|
|
excludeCategories 'com.hierynomus.sshj.test.KnownFailingTests'
|
|
}
|
|
}
|
|
|
|
afterSuite { descriptor, result ->
|
|
if (descriptor.className != null) {
|
|
def indicator = "\u001B[32m✓\u001b[0m"
|
|
if (result.failedTestCount > 0) {
|
|
indicator = "\u001B[31m✘\u001b[0m"
|
|
}
|
|
logger.lifecycle("$indicator Test ${descriptor.name}; Executed: ${result.testCount}/\u001B[32m${result.successfulTestCount}\u001B[0m/\u001B[31m${result.failedTestCount}\u001B[0m")
|
|
}
|
|
}
|
|
}
|
|
|
|
project.tasks.compileGroovy.onlyIf { false }
|
|
|
|
github {
|
|
user 'hierynomus'
|
|
license 'Apache'
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
maven(MavenPublication) {
|
|
from(components.java)
|
|
}
|
|
}
|
|
}
|
|
|
|
project.signing {
|
|
required { project.gradle.taskGraph.hasTask("release") }
|
|
sign publishing.publications.maven
|
|
|
|
if (project.hasProperty("signingKeyId") || project.hasProperty("signingKey")) {
|
|
def signingKeyId = project.findProperty("signingKeyId")
|
|
def signingKey = project.findProperty("signingKey")
|
|
def signingPassword = project.findProperty("signingPassword")
|
|
if (signingKeyId) {
|
|
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
|
|
} else if (signingKey) {
|
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
|
}
|
|
}
|
|
}
|
|
|
|
project.plugins.withType(MavenPublishPlugin).all {
|
|
PublishingExtension publishing = project.extensions.getByType(PublishingExtension)
|
|
publishing.publications.withType(MavenPublication).all { mavenPublication ->
|
|
mavenPublication.pom {
|
|
name = "${project.name}"
|
|
description = 'SSHv2 library for Java'
|
|
inceptionYear = '2009'
|
|
url = "https://github.com/hierynomus/${project.name}"
|
|
licenses {
|
|
license {
|
|
name = "The Apache License, Version 2.0"
|
|
url = "https://www.apache.org/licenses/LICENSE-2.0"
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id = "hierynomus"
|
|
name = "Jeroen van Erp"
|
|
email = "jeroen@hierynomus.com"
|
|
}
|
|
developer {
|
|
id = "shikhar"
|
|
name = "Shikhar Bhushan"
|
|
email = "shikhar@schmizz.net"
|
|
url = "http://schmizz.net"
|
|
roles = ["Previous Lead developer"]
|
|
}
|
|
developer {
|
|
id = "iterate"
|
|
name = "David Kocher"
|
|
email = "dkocher@iterate.ch"
|
|
organization = "iterate GmbH"
|
|
organizationUrl = "https://iterate.ch"
|
|
roles = ["Developer"]
|
|
}
|
|
}
|
|
scm {
|
|
url = "https://github.com/hierynomus/${project.name}"
|
|
connection = "scm:git@github.com:hierynomus/${project.name}.git"
|
|
developerConnection = "scm:git@github.com:hierynomus/${project.name}.git"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
nexusPublishing {
|
|
repositories {
|
|
sonatype() //sonatypeUsername and sonatypePassword properties are used automatically
|
|
}
|
|
|
|
connectTimeout = Duration.ofMinutes(3)
|
|
clientTimeout = Duration.ofMinutes(3)
|
|
}
|
|
|
|
jacocoTestReport {
|
|
reports {
|
|
xml.enabled true
|
|
html.enabled true
|
|
}
|
|
}
|
|
|
|
task forkedUploadRelease(type: GradleBuild) {
|
|
buildFile = project.buildFile
|
|
tasks = ["clean", "publishToSonatype", "closeAndReleaseSonatypeStagingRepository"]
|
|
}
|
|
|
|
project.tasks.release.dependsOn([project.tasks.integrationTest, project.tasks.build])
|
|
project.tasks.release.finalizedBy(project.tasks.forkedUploadRelease)
|
|
project.tasks.jacocoTestReport.dependsOn(project.tasks.test)
|
|
project.tasks.check.dependsOn(project.tasks.jacocoTestReport)
|