Skip to content

Commit

Permalink
mysql use ssl tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohansong committed Dec 24, 2024
1 parent 062ff87 commit 76d0b1d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ private val log = KotlinLogging.logger {}
*/
object SSLCertificateUtils {

const val DEFAULT_ROOT_FOLDER = "/tmp"
private const val DEFAULT_ROOT_DIR = "/tmp"

private const val PKCS_12 = "PKCS12"
private const val X509 = "X.509"
private val RANDOM: Random = SecureRandom()
Expand Down Expand Up @@ -109,7 +110,7 @@ object SSLCertificateUtils {
fromPEMString(certString),
keyStorePassword,
FileSystems.getDefault(),
DEFAULT_ROOT_FOLDER
""
)
}

Expand Down Expand Up @@ -259,21 +260,7 @@ object SSLCertificateUtils {
certString: String,
keyString: String,
keyStorePassword: String,
): URI {
return keyStoreFromClientCertificate(
certString,
keyString,
keyStorePassword,
FileSystems.getDefault(),
DEFAULT_ROOT_FOLDER,
)
}

fun keyStoreFromClientCertificate(
certString: String,
keyString: String,
keyStorePassword: String,
directory: String
directory: String = DEFAULT_ROOT_DIR,
): URI {
return keyStoreFromClientCertificate(
certString,
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-mysql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ application {
airbyteBulkConnector {
core = 'extract'
toolkits = ['extract-jdbc', 'extract-cdc']
cdk = '0.234'
cdk = 'local'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import io.airbyte.cdk.command.JdbcSourceConfiguration
import io.airbyte.cdk.command.SourceConfiguration
import io.airbyte.cdk.command.SourceConfigurationFactory
import io.airbyte.cdk.jdbc.SSLCertificateUtils
import io.airbyte.cdk.jdbc.SSLCertificateUtils.DEFAULT_ROOT_FOLDER
import io.airbyte.cdk.ssh.SshConnectionOptions
import io.airbyte.cdk.ssh.SshNoTunnelMethod
import io.airbyte.cdk.ssh.SshTunnelMethodConfiguration
Expand Down Expand Up @@ -234,9 +233,9 @@ class MySqlSourceConfigurationFactory @Inject constructor(val featureFlags: Set<
val clientCertKeyStoreUrl: URL =
buildKeyStore("client") {
SSLCertificateUtils.keyStoreFromClientCertificate(
sslData.clientCertificate,
sslData.clientKey,
password
certString=sslData.clientCertificate,
keyString=sslData.clientKey,
keyStorePassword=password
)
}
extraJdbcProperties[CLIENT_KEY_STORE_URL] = clientCertKeyStoreUrl.toString()
Expand Down

0 comments on commit 76d0b1d

Please sign in to comment.