Skip to content
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

frontend naming scan re fix #3138

Merged
merged 3 commits into from
Nov 27, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ class FlinkRedisSink(params: SerParams) extends RichSinkFunction[List[(String, S

if (params.redisSecureEnabled) {
System.setProperty("javax.net.ssl.trustStore", params.redisSecureTrustStorePath)
System.setProperty("javax.net.ssl.trustStorePassword", params.redisSecureTrustStorePassword)
System.setProperty("javax.net.ssl.trustStorePassword", params.redisSecureTrustStoreToken)
System.setProperty("javax.net.ssl.keyStoreType", "JKS")
System.setProperty("javax.net.ssl.keyStore", params.redisSecureTrustStorePath)
System.setProperty("javax.net.ssl.keyStorePassword", params.redisSecureTrustStorePassword)
System.setProperty("javax.net.ssl.keyStorePassword", params.redisSecureTrustStoreToken)
}
if (JedisPoolHolder.jedisPool == null) {
JedisPoolHolder.synchronized {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class FlinkRedisSource(params: SerParams)

if (params.redisSecureEnabled) {
System.setProperty("javax.net.ssl.trustStore", params.redisSecureTrustStorePath)
System.setProperty("javax.net.ssl.trustStorePassword", params.redisSecureTrustStorePassword)
System.setProperty("javax.net.ssl.trustStorePassword", params.redisSecureTrustStoreToken)
System.setProperty("javax.net.ssl.keyStoreType", "JKS")
System.setProperty("javax.net.ssl.keyStore", params.redisSecureTrustStorePath)
System.setProperty("javax.net.ssl.keyStorePassword", params.redisSecureTrustStorePassword)
System.setProperty("javax.net.ssl.keyStorePassword", params.redisSecureTrustStoreToken)
}

redisPool = new JedisPool(new JedisPoolConfig(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ object FrontEndApp extends Supportive with EncryptSupportive {
}
}
if (arguments.httpsEnabled) {
val serverContext = defineServerContext(arguments.httpsKeyStorePassword,
val serverContext = defineServerContext(arguments.httpsKeyStoreToken,
arguments.httpsKeyStorePath)
Http().bindAndHandle(route, arguments.interface, port = arguments.securePort,
connectionContext = serverContext)
Expand Down Expand Up @@ -293,9 +293,9 @@ object FrontEndApp extends Supportive with EncryptSupportive {
opt[String]('p', "httpsKeyStorePath")
.action((x, c) => c.copy(httpsKeyStorePath = x))
.text("https keyStore path")
opt[String]('w', "httpsKeyStorePassword")
.action((x, c) => c.copy(httpsKeyStorePassword = x))
.text("https keyStore password")
opt[String]('w', "httpsKeyStoreToken")
.action((x, c) => c.copy(httpsKeyStoreToken = x))
.text("https keyStore token")
opt[Boolean]('s', "redisSecureEnabled")
.action((x, c) => c.copy(redisSecureEnabled = x))
.text("redis secure enabled or not")
Expand All @@ -310,17 +310,17 @@ object FrontEndApp extends Supportive with EncryptSupportive {
.text("rediss trustStore password")
}

def defineServerContext(httpsKeyStorePassword: String,
def defineServerContext(httpsKeyStoreToken: String,
httpsKeyStorePath: String): ConnectionContext = {
val password = httpsKeyStorePassword.toCharArray
val token = httpsKeyStoreToken.toCharArray

val keyStore = KeyStore.getInstance("PKCS12")
val keystoreInputStream = new File(httpsKeyStorePath).toURI().toURL().openStream()
require(keystoreInputStream != null, "Keystore required!")
keyStore.load(keystoreInputStream, password)
keyStore.load(keystoreInputStream, token)

val keyManagerFactory = KeyManagerFactory.getInstance("SunX509")
keyManagerFactory.init(keyStore, password)
keyManagerFactory.init(keyStore, token)

val trustManagerFactory = TrustManagerFactory.getInstance("SunX509")
trustManagerFactory.init(keyStore)
Expand Down Expand Up @@ -350,7 +350,7 @@ case class FrontEndAppArguments(
tokenAcquireTimeout: Int = 100,
httpsEnabled: Boolean = false,
httpsKeyStorePath: String = null,
httpsKeyStorePassword: String = "1234qwer",
httpsKeyStoreToken: String = "1234qwer",
redisSecureEnabled: Boolean = false,
redissTrustStorePath: String = null,
redissTrustStoreToken: String = "1234qwer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SerParams(helper: ClusterServingHelper) extends Serializable {
val sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
val redisSecureEnabled = helper.redisSecureEnabled
val redisSecureTrustStorePath = helper.redisSecureTrustStorePath
val redisSecureTrustStorePassword = helper.redisSecureTrustStoreToken
val redisSecureTrustStoreToken = helper.redisSecureTrustStoreToken
var timerMode: Boolean = false
// println(s"loading params, time is ${sdf.format(lastModified)}")

Expand Down