Skip to content

Commit

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

private const val DEFAULT_ROOT_FOLDER = "/tmp"
const val DEFAULT_ROOT_FOLDER = "/tmp"
private const val PKCS_12 = "PKCS12"
private const val X509 = "X.509"
private val RANDOM: Random = SecureRandom()
Expand Down Expand Up @@ -255,6 +255,20 @@ object SSLCertificateUtils {
)
}

fun keyStoreFromClientCertificate(
certString: String,
keyString: String,
keyStorePassword: String,
): URI {
return keyStoreFromClientCertificate(
certString,
keyString,
keyStorePassword,
FileSystems.getDefault(),
DEFAULT_ROOT_FOLDER,
)
}

fun keyStoreFromClientCertificate(
certString: String,
keyString: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ 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 @@ -218,9 +219,7 @@ class MySqlSourceConfigurationFactory @Inject constructor(val featureFlags: Set<
buildKeyStore("trust") {
SSLCertificateUtils.keyStoreFromCertificate(
sslData.caCertificate,
password,
FileSystems.getDefault(),
directory = "",
password
)
}
extraJdbcProperties[TRUST_KEY_STORE_URL] = caCertKeyStoreUrl.toString()
Expand All @@ -237,8 +236,7 @@ class MySqlSourceConfigurationFactory @Inject constructor(val featureFlags: Set<
SSLCertificateUtils.keyStoreFromClientCertificate(
sslData.clientCertificate,
sslData.clientKey,
password,
directory = ""
password
)
}
extraJdbcProperties[CLIENT_KEY_STORE_URL] = clientCertKeyStoreUrl.toString()
Expand Down

0 comments on commit 062ff87

Please sign in to comment.