我一直在用头撞墙。我最近将 Tomcat 从 6.0.18 升级到 6.0.37,以修复安全团队的一些漏洞。除 CAC 登录功能外,一切正常。这些配置在 6.0.18 中工作正常但不适用于 6.0.37(给出 HTTP500 错误) 当用户使用 CAC 登录时,站点提示要求提供 CAC 证书,在用户选择他们的证书后,它会让用户登录。
基本上,站点从 CAC 获取证书并使用 LDAP 进行身份验证以从 LDAP 检索用户名。该应用程序使用用户名对用户进行身份验证并登录。
它需要访问/process.jsp 才能对用户名进行身份验证。但是在 web.xml 中它被设置为 (protected page)
请帮我指明正确的方向。我真的很感激。
我只是不明白为什么它在 Tomcat 6.0.37 中不起作用。 Tomcat 6.0.37 有没有需要设置的新配置
下面是 server.xml 文件中 Connector 和 JNDIRealm 的配置:
<Connector port="443"
maxHTTPHeaderSize="8192"
allowUnsafeLegacyRenegotiation="true"
protocol="org.apache.coyote.http11.Http11Protocol"
SSLEnabled="true"
enableLookups="false"
disableUploadTimeout="true"
acceptCount="200"
maxThreads="150"
scheme="https"
secure="true"
keystoreFile="C:\Tomcat 6.0\cert\xxxx.keystore"
keystorePass="changeit"
truststoreFile="D:\Sun\SDK\jdk\jre\lib\security\cacerts"
truststorePass="changeit"
clientAuth="false"
sslProtocol="TLS"
ciphers="xxxxxxxxx"
address="0.0.0.0"/>
<Realm className="org.apache.catalina.realm.JNDIRealm"
connectionURL="ldap://xxx.xx.xx.xxx/"
alternateURL="ldap://xxx.xx.xx.xxx/"
connectionName="CN=xxxxxx,OU=xxxx Accounts,OU=xxxxx,DC=xxxx,DC=xxxx,DC=local" connectionPassword="MyPassword"
authentication="simple"
referrals="follow"
userSubtree="true"
userBase="OU=xxxxx,DC=xxxx,DC=dhhq,DC=local"
userRoleName="xxx"
userSearch="(altSecurityIdentities={0})" roleBase="CN=xxxxxxx,OU=xxxxxx,OU=Accounts,DC=xxxx,DC=xxxx,DC=local" roleSubtree="true"
roleName="cn"
roleSearch="(member={0})" />
web.xml 安全配置:
<security-constraint>
<web-resource-collection>
<web-resource-name>Myapp</web-resource-name>
<url-pattern>/process.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>User</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>TOMCATLDAP</realm-name>
</login-config>
<security-role>
<role-name>User</role-name>
</security-role>
最佳答案
我终于找到了解决这个问题的方法,但它并不完美......来自 web.xml 的安全约束为:
<security-constraint>
<web-resource-collection>
<web-resource-name>Myapp</web-resource-name>
<!--url-pattern>/process.jsp</url-pattern-->
</web-resource-collection>
<auth-constraint>
<role-name>User</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
它保护触发智能卡从 AD 获取用户名的 process.jsp 页面,然后 process.jsp 可以让用户登录。我这几天遇到的根本原因是 process.jsp 无法访问,这是为什么当用户名无法到达 process.jsp 时身份验证会终止。但是,如果我从( protected 页面)中取出 process.jsp,则智能卡不会触发,也根本没有用户名。
我所做的是设置 clientAuth="true"以便在每次访问/点击网站页面时触发智能卡,这样无论是否需要,用户名总是返回;我还从中删除了 process.jsp,以便用户名可以访问 process.jsp 并神奇地让用户登录。它起作用了!现在的问题是每次点击网站都会触发智能卡,这很烦人。
有谁知道为什么即使通过了智能卡身份验证也无法访问 protected 页面?(这是针对 Tomcat 6.0.37;在 6.0.18 上没问题,不确定是错误还是安全修复...)或你能建议更好的解决方法吗...
谢谢! 安
关于Tomcat 6.0.37 无法从 LDAP 检索用户名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19938040/