Skip to content

Commit

Permalink
Show ssl keystore expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
turboFei committed Dec 25, 2024
1 parent 5841e32 commit 1707a96
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ abstract class TBinaryFrontendService(name: String)
s"${FRONTEND_SSL_KEYSTORE_PASSWORD.key} not configured for SSL connection")
}

getKeyStoreExpirationTime() match {
case Some(expiration) =>
info(
s"SSL Serve KeyStore will expire after: ${Utils.getDateFromTimestamp(expiration)}")
case _ =>
}

getServerSSLSocket(
keyStorePath.get,
keyStorePassword.get,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ object MetricsConstants {
final private val THRIFT_BINARY_CONN = KYUUBI + "thrift.binary.connection."
final private val REST_CONN = KYUUBI + "rest.connection."

final val SSL_CERT_EXPIRATION = KYUUBI + "ssl.cert.expiration"

final val CONN_OPEN: String = CONN + "opened"
final val CONN_FAIL: String = CONN + "failed"
final val CONN_TOTAL: String = CONN + "total"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import java.util.Base64

import org.apache.hadoop.conf.Configuration

import org.apache.kyuubi.KyuubiSQLException
import org.apache.kyuubi.{KyuubiSQLException, Utils}
import org.apache.kyuubi.cli.Handle
import org.apache.kyuubi.config.KyuubiConf
import org.apache.kyuubi.config.KyuubiConf.KYUUBI_SERVER_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE
import org.apache.kyuubi.config.KyuubiReservedKeys._
import org.apache.kyuubi.ha.client.{KyuubiServiceDiscovery, ServiceDiscovery}
import org.apache.kyuubi.metrics.{MetricsConstants, MetricsSystem}
import org.apache.kyuubi.metrics.MetricsConstants._
import org.apache.kyuubi.metrics.MetricsSystem
import org.apache.kyuubi.service.{Serverable, Service, TBinaryFrontendService}
import org.apache.kyuubi.service.TFrontendService.{CURRENT_SERVER_CONTEXT, FeServiceServerContext, OK_STATUS}
import org.apache.kyuubi.session.KyuubiSessionImpl
Expand Down Expand Up @@ -122,4 +122,19 @@ final class KyuubiTBinaryFrontendService(
resp.setStatus(notSupportTokenErrorStatus)
resp
}

override def start(): Unit = {
super.start()
getKeyStoreExpirationTime() match {
case Some(expiration) =>
info(s"SSL Serve KeyStore will expire at: ${Utils.getDateFromTimestamp(expiration)}")
MetricsSystem.tracing { ms =>
ms.registerGauge(
MetricsConstants.SSL_CERT_EXPIRATION,
expiration - System.currentTimeMillis(),
0L)
}
case None =>
}
}
}

0 comments on commit 1707a96

Please sign in to comment.