Skip to content

Commit

Permalink
Fix SSL issue (#16412)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush-shah committed May 27, 2024
1 parent 61bb409 commit 2b536a2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_conn(self) -> OpenMetadataConnection:
extra = conn.extra_dejson if conn.get_extra() else {}
verify_ssl = extra.get("verifySSL") or self.default_verify_ssl
ssl_config = (
ValidateSslClientConfig(certificatePath=extra["sslConfig"])
ValidateSslClientConfig(caCertificate=extra["sslConfig"])
if extra.get("sslConfig")
else self.default_ssl_config
)
Expand Down
2 changes: 1 addition & 1 deletion ingestion/src/metadata/utils/ssl_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def ignore_ssl_init(_: Optional[SslConfig]) -> bool:

@ssl_verification_registry.add(VerifySSL.validate.value)
def validate_ssl_init(ssl_config: Optional[SslConfig]) -> str:
return ssl_config.__root__.certificatePath
return ssl_config.__root__.caCertificate.get_secret_value()


def get_verify_ssl_fn(verify_ssl: VerifySSL) -> Callable:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.dropwizard.db.DataSourceFactory;
import io.dropwizard.health.conf.HealthConfiguration;
import io.federecio.dropwizard.swagger.SwaggerBundleConfiguration;
import java.util.LinkedHashMap;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import lombok.Getter;
Expand Down Expand Up @@ -66,6 +67,20 @@ public class OpenMetadataApplicationConfig extends Configuration {
@JsonProperty("pipelineServiceClientConfiguration")
private PipelineServiceClientConfiguration pipelineServiceClientConfiguration;

private static final String CERTIFICATE_PATH = "certificatePath";

public PipelineServiceClientConfiguration getPipelineServiceClientConfiguration() {

LinkedHashMap<String, String> temporarySSLConfig =
(LinkedHashMap<String, String>) pipelineServiceClientConfiguration.getSslConfig();
if (temporarySSLConfig != null && temporarySSLConfig.containsKey(CERTIFICATE_PATH)) {
temporarySSLConfig.put("caCertificate", temporarySSLConfig.get(CERTIFICATE_PATH));
temporarySSLConfig.remove(CERTIFICATE_PATH);
}
pipelineServiceClientConfiguration.setSslConfig(temporarySSLConfig);
return pipelineServiceClientConfiguration;
}

@JsonProperty("migrationConfiguration")
@NotNull
private MigrationConfiguration migrationConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"type": "object",
"javaType": "org.openmetadata.schema.security.ssl.ValidateSSLClientConfig",
"properties": {
"certificatePath": {
"caCertificate": {
"title": "Certificate Path",
"description": "CA certificate path. E.g., /path/to/public.cert. Will be used if Verify SSL is set to `validate`.",
"type": "string"
Expand Down Expand Up @@ -264,7 +264,7 @@
"type": "object",
"javaType": "org.openmetadata.schema.security.ssl.ValidateSSLClientConfig",
"properties": {
"certificatePath": {
"caCertificate": {
"description": "CA certificate path. E.g., /path/to/public.cert. Will be used if Verify SSL is set to `validate`.",
"type": "string"
}
Expand Down

0 comments on commit 2b536a2

Please sign in to comment.