AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1063875
Accepted
Daniel Sandberg
Daniel Sandberg
Asked: 2021-05-18 11:03:50 +0800 CST2021-05-18 11:03:50 +0800 CST 2021-05-18 11:03:50 +0800 CST

Tomcat 9.0.46 的解决方法(错误 65308) - JNDIRealm 中的 NPE

  • 772

在 Tomcat 9.0.46 中使用 JNDIRealm/ActiveDirectory 时有人遇到过 NPE 错误并有解决方法吗?

语境

我不得不从 9.0.43 升级,因为在启用 keep-alive/re-use 时套接字输入流被损坏(并混淆了请求主体)的并发错误。日志中充满了“解析 HTTP 请求标头时出错”和“HTTP 方法名称必须是令牌 000x000x000x000x000x...”等。升级到 9.0.46 后,此问题已解决,但现在我们的 ActiveDirectory 登录已损坏。

日志

17-May-2021 14:31:49.405 INFO [Catalina-tomcat-workers-thread7] org.apache.catalina.realm.JNDIRealm.authenticate Exception performing authentication. Retrying...
    java.lang.NullPointerException
            at org.apache.catalina.realm.JNDIRealm.doAttributeValueEscaping(JNDIRealm.java:2884)
            at org.apache.catalina.realm.JNDIRealm.getRoles(JNDIRealm.java:1892)
            at org.apache.catalina.realm.JNDIRealm.authenticate(JNDIRealm.java:1350)
            at org.apache.catalina.realm.JNDIRealm.authenticate(JNDIRealm.java:1232)
            at org.apache.catalina.realm.CombinedRealm.authenticate(CombinedRealm.java:191)
            at org.apache.catalina.realm.CombinedRealm.authenticate(CombinedRealm.java:191)
            at org.apache.catalina.realm.LockOutRealm.authenticate(LockOutRealm.java:154)
            at org.apache.catalina.authenticator.BasicAuthenticator.doAuthenticate(BasicAuthenticator.java:101)
            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:632)

漏洞

根据错误报告(https://bz.apache.org/bugzilla/show_bug.cgi?id=65308),userRoleAttribute为空/null存在问题。估计再过 3-4 周就不会发布了。

Tomcat 文档(https://tomcat.apache.org/tomcat-9.0-doc/realm-howto.html#JNDIRealm)说:

roleSearch - the LDAP search filter for selecting role entries.
It optionally includes pattern replacements "{0}" for the distinguished name and/or "{1}" for the username and/or "{2}" for an attribute from user's directory entry, of the authenticated user.
Use userRoleAttribute to specify the name of the attribute that provides the value for "{2}".

我没有在 roleSearch 属性中使用“{2}”,所以我不需要设置userRoleAttribute。尽管如此,我还是尝试将其设置为非空,但无济于事。

在他们发布 9.0.47 之前,我需要一个解决方法。有接盘侠吗?

tomcat active-directory bug
  • 1 1 个回答
  • 468 Views

1 个回答

  • Voted
  1. Best Answer
    Piotr P. Karwasz
    2021-05-19T22:33:15+08:002021-05-19T22:33:15+08:00

    由于您已经完成了寻找补丁的繁重工作,因此最简单的“解决方法”是修补受该错误影响的类。

    你只需要:

    1. 下载补丁JNDIRealm.java文件,
    2. 针对 Tomcat 的 jar 编译它:
    javac -cp '/path/to/tomcat/lib/*:/path/to/tomcat/bin/*' JNDIRealm.java
    
    1. 将生成的类文件放入$CATALINA_BASE/lib/org/apache/catalina/realm. 由于通用加载器的配置方式,类文件将覆盖catalina.jar.
    • 1

相关问题

  • jvm性能调优技巧/资源?

  • 使 Jakarta 连接器与 IIS 一起工作时出现问题

  • 如何禁用tomcat缓存?我遇到了奇怪的静态文件问题

  • Hudson 无法在 tomcat5 中启动

  • Tomcat 6 HTTP 日志滚动和清除

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve