diff --git a/Dockerfile b/Dockerfile index 07d9293..d7afa3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM jumpserver/chen-base:20241212_102050 AS stage-build +FROM jumpserver/chen-base:20250708_060644 AS stage-build ENV LANG=en_US.UTF-8 WORKDIR /opt/chen/ diff --git a/Dockerfile-base b/Dockerfile-base index bd7ac1d..ee6d774 100644 --- a/Dockerfile-base +++ b/Dockerfile-base @@ -27,7 +27,7 @@ RUN set -ex \ && chmod 755 /usr/local/bin/check \ && rm -f check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz -ARG WISP_VERSION=v0.2.5 +ARG WISP_VERSION=v0.2.7 RUN set -ex \ && wget https://github.com/jumpserver/wisp/releases/download/${WISP_VERSION}/wisp-${WISP_VERSION}-linux-${TARGETARCH}.tar.gz \ && tar -xf wisp-${WISP_VERSION}-linux-${TARGETARCH}.tar.gz -C /usr/local/bin/ --strip-components=1 \ @@ -43,7 +43,7 @@ RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=che npm install # Install Maven dependencies -ARG MAVEN_VERSION=3.9.9 +ARG MAVEN_VERSION=3.9.10 ARG USER_HOME_DIR="/root" ARG BASE_URL=https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries ARG MAVEN_MIRROR=https://repo.maven.apache.org/maven2 diff --git a/backend/framework/src/main/java/org/jumpserver/chen/framework/console/QueryConsole.java b/backend/framework/src/main/java/org/jumpserver/chen/framework/console/QueryConsole.java index 4f252b7..ee11d62 100644 --- a/backend/framework/src/main/java/org/jumpserver/chen/framework/console/QueryConsole.java +++ b/backend/framework/src/main/java/org/jumpserver/chen/framework/console/QueryConsole.java @@ -36,6 +36,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; @Slf4j @@ -214,8 +215,14 @@ private void handleSQLChunk(QueryConsoleAction action) { */ private void handleSQLComplete() { try { + // 等待所有分段接收完成 - latch.await(); + boolean completed = latch.await(10, TimeUnit.SECONDS); // 超时10秒 + + if (!completed) { + this.getConsoleLogger().error("read sql message timeout!!"); + return; + } // 按照索引顺序合并所有分段 StringBuilder sqlBuilder = new StringBuilder(); diff --git a/backend/framework/src/main/java/org/jumpserver/chen/framework/datasource/base/BaseSQLActuator.java b/backend/framework/src/main/java/org/jumpserver/chen/framework/datasource/base/BaseSQLActuator.java index c17dd4a..74ef03c 100644 --- a/backend/framework/src/main/java/org/jumpserver/chen/framework/datasource/base/BaseSQLActuator.java +++ b/backend/framework/src/main/java/org/jumpserver/chen/framework/datasource/base/BaseSQLActuator.java @@ -168,6 +168,8 @@ private void executeStatement(SQLExecutePlan plan, Statement statement, SQLQuery fs.add(HexUtils.bytesToHex((byte[]) obj)); } else if (obj instanceof Blob) { fs.add(HexUtils.bytesToHex(((Blob) obj).getBytes(1, (int) ((Blob) obj).length()))); + } else if (obj!= null && obj.getClass().getSimpleName().equalsIgnoreCase("pgobject")) { + fs.add(obj.toString()); } else { fs.add(obj); } diff --git a/backend/modules/src/main/java/org.jumpserver.chen.modules/mysql/MysqlConnectionManager.java b/backend/modules/src/main/java/org.jumpserver.chen.modules/mysql/MysqlConnectionManager.java index 57fcc4a..595a6d1 100644 --- a/backend/modules/src/main/java/org.jumpserver.chen.modules/mysql/MysqlConnectionManager.java +++ b/backend/modules/src/main/java/org.jumpserver.chen.modules/mysql/MysqlConnectionManager.java @@ -7,7 +7,12 @@ import org.jumpserver.chen.framework.datasource.sql.SQL; import org.jumpserver.chen.modules.base.ssl.JKSGenerator; +import java.sql.Connection; import java.sql.SQLException; +import java.sql.Statement; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; import java.util.Properties; public class MysqlConnectionManager extends BaseConnectionManager { @@ -33,6 +38,34 @@ public void ping() throws SQLException { } + @Override + public Connection getConnection() throws SQLException { + var conn = super.getConnection(); + setTimeZone(conn); + return conn; + } + + @Override + public Connection getPhysicalConnection() throws SQLException { + var conn = super.getPhysicalConnection(); + setTimeZone(conn); + return conn; + } + + private void setTimeZone(Connection conn) throws SQLException { + ZoneId zoneId = ZoneId.systemDefault(); + + ZonedDateTime now = ZonedDateTime.now(zoneId); + ZoneOffset offset = now.getOffset(); + + String offsetStr = offset.toString(); + + try (Statement stmt = conn.createStatement()) { + stmt.execute("SET time_zone = '" + offsetStr + "'"); + } + } + + protected void setSSLProps(Properties props) { if (this.getConnectInfo().getOptions().get("useSSL") != null && (boolean) this.getConnectInfo().getOptions().get("useSSL")) {