Skip to content

FLINK-37953: Add OBF password obfuscation support for SSL configurations #26677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion flink-filesystems/flink-azure-fs-hadoop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ under the License.
<properties>
<fs.azure.sdk.version>1.16.0</fs.azure.sdk.version>
<fs.jackson.core.version>2.9.4</fs.jackson.core.version>
<jetty.version>9.3.24.v20180605</jetty.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ This project bundles the following dependencies under the Apache Software Licens
- org.apache.httpcomponents:httpcore:4.4.14
- org.codehaus.jackson:jackson-core-asl:1.9.13
- org.codehaus.jackson:jackson-mapper-asl:1.9.14.jdk17-redhat-00001
- org.eclipse.jetty:jetty-util-ajax:9.3.24.v20180605
- org.eclipse.jetty:jetty-util:9.3.24.v20180605
- org.eclipse.jetty:jetty-util-ajax:9.4.56.v20240826
- org.eclipse.jetty:jetty-util:9.4.56.v20240826
- org.wildfly.openssl:wildfly-openssl:1.0.7.Final

This project bundles the following dependencies under the MIT (https://opensource.org/licenses/MIT)
Expand Down
8 changes: 8 additions & 0 deletions flink-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,14 @@ under the License.
<artifactId>mockito-subclass</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
<scope>compile</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import org.apache.flink.shaded.netty4.io.netty.handler.ssl.SslProvider;
import org.apache.flink.shaded.netty4.io.netty.handler.ssl.util.FingerprintTrustManagerFactory;

import org.eclipse.jetty.util.security.Password;

import javax.annotation.Nullable;
import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;
Expand Down Expand Up @@ -303,7 +305,7 @@ private static KeyManagerFactory getKeyManagerFactory(

KeyStore keyStore = KeyStore.getInstance(keystoreType);
try (InputStream keyStoreFile = Files.newInputStream(new File(keystoreFilePath).toPath())) {
keyStore.load(keyStoreFile, keystorePassword.toCharArray());
keyStore.load(keyStoreFile, SSLUtils.decryptPassword(keystorePassword).toCharArray());
}

final KeyManagerFactory kmf;
Expand All @@ -312,11 +314,18 @@ private static KeyManagerFactory getKeyManagerFactory(
} else {
kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
}
kmf.init(keyStore, certPassword.toCharArray());
kmf.init(keyStore, SSLUtils.decryptPassword(certPassword).toCharArray());

return kmf;
}

private static String decryptPassword(String certPassword) {
if (certPassword.startsWith("OBF:")) {
return new Password(certPassword).toString();
}
return certPassword;
}

/**
* Creates the SSL Context for internal SSL, if internal SSL is configured. For internal SSL,
* the client and server side configuration are identical, because of mutual authentication.
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ under the License.
-->
<minikdc.version>3.2.4</minikdc.version>
<hive.version>2.3.10</hive.version>
<jetty.version>9.4.56.v20240826</jetty.version>
<orc.version>1.5.6</orc.version>
<japicmp.referenceVersion>2.0.0</japicmp.referenceVersion>
<japicmp.outputDir>tools/japicmp-output</japicmp.outputDir>
Expand Down