[Bug] Hive query on Paimon table fails with 'Proxy user is not supported' when Kerberos proxy user is used
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- authentication
Hướng nghiên cứu
Bắt đầu với paimon-common/src/main/java/org/apache/paimon/security/KerberosLoginProvider.java và kiểm tra doLogin(), đặc biệt là nhánh proxy-user và cách xử lý UGI hiện có. Xây dựng Hive connector bằng lệnh Maven được cung cấp, sau đó xác minh rằng truy vấn HiveServer2 sử dụng Kerberos proxy-user không còn thất bại với “Proxy user is not supported” trong khi việc ủy quyền vẫn được áp dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Search before asking
- I searched in the issues and found nothing similar.
Paimon version
1.3.1
Compute Engine
paimon-hive-connector-3.1, flink-1.17.1
Minimal reproduce step
labels: bug, hive, kerberos
Describe the bug
When a Paimon table is written through Flink and then queried from Hive via HiveServer2, the query fails with:
SELECT * FROM paimon_sink LIMIT 1;
Error: Error while compiling statement: FAILED: UnsupportedOperationException Proxy user is not supported (state=42000,code=40000)
Environment
- Paimon version: 1.3.1
- Hive connector:
paimon-hive-connector-3.1 - Hive access mode: HiveServer2 (JDBC / Beeline) with proxy user (
hive.server2.proxy.user=bdwh) - Kerberos: enabled
Root cause analysis
The error is thrown from org.apache.paimon.security.KerberosLoginProvider:
public void doLogin() throws IOException {
if (principal != null) {
LOG.info(
"Attempting to login to KDC using principal: {} keytab: {}", principal, keytab);
UserGroupInformation.loginUserFromKeytab(principal, keytab);
LOG.info("Successfully logged into KDC");
} else if (!isProxyUser(UserGroupInformation.getCurrentUser())) {
LOG.info("Attempting to load user's ticket cache");
UserGroupInformation.loginUserFromSubject(null);
LOG.info("Loaded user's ticket cache successfully");
} else {
throwProxyUserNotSupported();
}
}
The Kerberos login logic currently has three branches:
principalis non-null ->UserGroupInformation.loginUserFromKeytab(principal, keytab)(the Spark / Flink way).principalis null and the current user is not a proxy user ->UserGroupInformation.loginUserFromSubject(null)(load the ticket cache).principalis null and the current user is a proxy user -> throwsProxy user is not supported.
The problem is that Hive cannot log into Kerberos the same way Spark does — Hive does not support passing --keytab directly. Instead, an already-Kerberos-authenticated HiveServer2 acts as a proxy on behalf of the business user, with the caller specifying hive.server2.proxy.user=bdwh (e.g. via Beeline).
In this scenario, principal is null and the current UGI is a proxy user, so Paimon falls into branch 3 and throws Proxy user is not supported, which makes the whole query fail before it can even read the Paimon table.
Proposed fix
For the proxy-user case, Paimon should do nothing (the Kerberos credentials are already provided by the HiveServer2 delegation / proxy mechanism) instead of throwing.
public void doLogin() throws IOException {
if (principal != null) {
LOG.info(
"Attempting to login to KDC using principal: {} keytab: {}", principal, keytab);
UserGroupInformation.loginUserFromKeytab(principal, keytab);
LOG.info("Successfully logged into KDC");
} else if (!isProxyUser(UserGroupInformation.getCurrentUser())) {
LOG.info("Attempting to load user's ticket cache");
UserGroupInformation.loginUserFromSubject(null);
LOG.info("Loaded user's ticket cache successfully");
} else {
// Proxy user: do nothing, credentials are provided by HiveServer2 proxy.
// throwProxyUserNotSupported();
}
}
Note: an earlier attempt replaced the throw with UserGroupInformation.loginUserFromSubject(null), but that can cause TGT issues; the final fix is to simply do nothing for proxy users.
Verification
After applying the fix and rebuilding the Hive connector:
mvn -DskipTests -Dspotless.check.skip=true clean package -pl paimon-hive -am
# produces: paimon-hive-connector-3.1-1.3.1.jar
The query succeeds:
0: jdbc:hive2://dmc014011.venus.sohurdc.com:1> SELECT count(*) FROM paimon_sink LIMIT 1;
+---------+
| _c0 |
+---------+
| 154046 |
+---------+
1 row selected (75.586 seconds)
Ranger authorization also works as expected (the proxy user still needs the required privileges):
SELECT * FROM paimon_sink LIMIT 1;
Error: Error while compiling statement: FAILED: HiveAccessControlException Permission denied: user [bdwh] does not have [SELECT] privilege on [bdwh/paimon_sink/*] (state=42000,code=40000)
Expected behavior
When Kerberos proxy user is used (as in HiveServer2), Paimon should not throw Proxy user is not supported and should allow queries to proceed.
Additional context
Related code reference: paimon-common/src/main/java/org/apache/paimon/security/KerberosLoginProvider.java
What doesn't meet your expectations?
FAILED: UnsupportedOperationException Proxy user is not supported
Anything else?
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Ngôn ngữ chính
- Java
- Star
- 3.4k
- Fork
- 1.4k
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 448
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/paimon
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
apache/paimon#10332 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/paimon#9006 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] FileIndexFormat.Reader leaks input stream when construction fails with a runtime exceptionCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Bitmap benchmarks do not close seekable input streamsCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/paimon
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
navikt/mock-oauth2-server#1129 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Blockly] historic state medianĐang mởbug main ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
openhab/openhab-webui#4600 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
`DeepSeekChatModel` streaming returns no content when chunks have no `id`Có thể đã có người làm @lejuho đã nhận hôm nay. Đang mởstatus: waiting-for-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
spring-projects/spring-ai#7214 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
QuiltMC/update-quilt-meta#28 ·
-
awaiting triage Documentation P3
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày