Compare commits
3
Commits
0.5.1
..
6b798f3046
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b798f3046
|
||
|
|
4037ac9ddc
|
||
|
|
b4a97845ca
|
@@ -10,7 +10,6 @@ import java.util.concurrent.TimeUnit
|
|||||||
import java.util.concurrent.TimeoutException
|
import java.util.concurrent.TimeoutException
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
import javax.net.ssl.TrustManagerFactory
|
import javax.net.ssl.TrustManagerFactory
|
||||||
import javax.net.ssl.X509ExtendedTrustManager
|
|
||||||
import javax.net.ssl.X509TrustManager
|
import javax.net.ssl.X509TrustManager
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import io.netty.util.concurrent.Future as NettyFuture
|
import io.netty.util.concurrent.Future as NettyFuture
|
||||||
@@ -75,25 +74,13 @@ class RemoteBuildCacheClient(private val profile: Configuration.Profile) : AutoC
|
|||||||
)
|
)
|
||||||
profile.tlsTruststore?.let { trustStore ->
|
profile.tlsTruststore?.let { trustStore ->
|
||||||
if (!trustStore.verifyServerCertificate) {
|
if (!trustStore.verifyServerCertificate) {
|
||||||
trustManager(object : X509ExtendedTrustManager() {
|
trustManager(object : X509TrustManager {
|
||||||
override fun checkClientTrusted(certChain: Array<out X509Certificate>, p1: String?) {
|
override fun checkClientTrusted(certChain: Array<out X509Certificate>, p1: String?) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun checkClientTrusted(certChain: Array<out X509Certificate>, p1: String?, socket: java.net.Socket) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkClientTrusted(certChain: Array<out X509Certificate>, p1: String?, engine: javax.net.ssl.SSLEngine) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkServerTrusted(certChain: Array<out X509Certificate>, p1: String?) {
|
override fun checkServerTrusted(certChain: Array<out X509Certificate>, p1: String?) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun checkServerTrusted(certChain: Array<out X509Certificate>, p1: String?, socket: java.net.Socket) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkServerTrusted(certChain: Array<out X509Certificate>, p1: String?, engine: javax.net.ssl.SSLEngine) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getAcceptedIssuers() = null
|
override fun getAcceptedIssuers() = null
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import java.security.cert.X509Certificate
|
|||||||
import java.util.EnumSet
|
import java.util.EnumSet
|
||||||
import java.util.ServiceLoader
|
import java.util.ServiceLoader
|
||||||
import javax.net.ssl.TrustManagerFactory
|
import javax.net.ssl.TrustManagerFactory
|
||||||
import javax.net.ssl.X509ExtendedTrustManager
|
|
||||||
import javax.net.ssl.X509TrustManager
|
import javax.net.ssl.X509TrustManager
|
||||||
import net.woggioni.jwo.JWO
|
import net.woggioni.jwo.JWO
|
||||||
import net.woggioni.jwo.Tuple2
|
import net.woggioni.jwo.Tuple2
|
||||||
@@ -125,7 +124,7 @@ object RBCS {
|
|||||||
return keystore
|
return keystore
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getTrustManager(trustStore: KeyStore?, certificateRevocationEnabled: Boolean): X509ExtendedTrustManager {
|
fun getTrustManager(trustStore: KeyStore?, certificateRevocationEnabled: Boolean): X509TrustManager {
|
||||||
return if (trustStore != null) {
|
return if (trustStore != null) {
|
||||||
val certificateFactory = CertificateFactory.getInstance("X.509")
|
val certificateFactory = CertificateFactory.getInstance("X.509")
|
||||||
val validator = CertPathValidator.getInstance("PKIX").apply {
|
val validator = CertPathValidator.getInstance("PKIX").apply {
|
||||||
@@ -137,7 +136,7 @@ object RBCS {
|
|||||||
val params = PKIXParameters(trustStore).apply {
|
val params = PKIXParameters(trustStore).apply {
|
||||||
isRevocationEnabled = certificateRevocationEnabled
|
isRevocationEnabled = certificateRevocationEnabled
|
||||||
}
|
}
|
||||||
object : X509ExtendedTrustManager() {
|
object : X509TrustManager {
|
||||||
override fun checkClientTrusted(chain: Array<out X509Certificate>, authType: String) {
|
override fun checkClientTrusted(chain: Array<out X509Certificate>, authType: String) {
|
||||||
val clientCertificateChain = certificateFactory.generateCertPath(chain.toList())
|
val clientCertificateChain = certificateFactory.generateCertPath(chain.toList())
|
||||||
try {
|
try {
|
||||||
@@ -147,26 +146,10 @@ object RBCS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun checkClientTrusted(chain: Array<out X509Certificate>, authType: String, socket: java.net.Socket) {
|
|
||||||
checkClientTrusted(chain, authType)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkClientTrusted(chain: Array<out X509Certificate>, authType: String, engine: javax.net.ssl.SSLEngine) {
|
|
||||||
checkClientTrusted(chain, authType)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkServerTrusted(chain: Array<out X509Certificate>, authType: String) {
|
override fun checkServerTrusted(chain: Array<out X509Certificate>, authType: String) {
|
||||||
throw NotImplementedError()
|
throw NotImplementedError()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun checkServerTrusted(chain: Array<out X509Certificate>, authType: String, socket: java.net.Socket) {
|
|
||||||
checkServerTrusted(chain, authType)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkServerTrusted(chain: Array<out X509Certificate>, authType: String, engine: javax.net.ssl.SSLEngine) {
|
|
||||||
checkServerTrusted(chain, authType)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val acceptedIssuers = trustStore.aliases().asSequence()
|
private val acceptedIssuers = trustStore.aliases().asSequence()
|
||||||
.filter(trustStore::isCertificateEntry)
|
.filter(trustStore::isCertificateEntry)
|
||||||
.map(trustStore::getCertificate)
|
.map(trustStore::getCertificate)
|
||||||
@@ -178,8 +161,8 @@ object RBCS {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
|
val trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
|
||||||
trustManagerFactory.trustManagers.asSequence().filter { it is X509ExtendedTrustManager }
|
trustManagerFactory.trustManagers.asSequence().filter { it is X509TrustManager }
|
||||||
.single() as X509ExtendedTrustManager
|
.single() as X509TrustManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
|
// mavenLocal {
|
||||||
|
// content {
|
||||||
|
// includeGroup 'net.woggioni.gradle'
|
||||||
|
// includeGroup 'net.woggioni.gradle.lombok'
|
||||||
|
// includeGroup 'net.woggioni.gradle.finalguard'
|
||||||
|
// }
|
||||||
|
// }
|
||||||
maven {
|
maven {
|
||||||
url = getProperty('gitea.maven.url')
|
url = getProperty('gitea.maven.url')
|
||||||
}
|
}
|
||||||
@@ -19,6 +26,8 @@ dependencyResolutionManagement {
|
|||||||
versionCatalogs {
|
versionCatalogs {
|
||||||
catalog {
|
catalog {
|
||||||
from group: 'com.lys', name: 'lys-catalog', version: getProperty('lys.version')
|
from group: 'com.lys', name: 'lys-catalog', version: getProperty('lys.version')
|
||||||
|
// version('my-gradle-plugins', '2026.06.09')
|
||||||
|
version('netty', '4.2.14.Final')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user