我配置了使用kerberos的hadoop,一切工作正常,我可以浏览hdfs,提交作业等。但是失败的http web身份验证。使用Kerberos的Hadoop Web身份验证
我在cdh3u2中使用hadoop-0.20.2,它支持HTTP SPNEGO。在核心的site.xml
HTTP认证的相关配置如下:
<!-- HTTP web-consoles Authentication -->
<property>
<name>hadoop.http.filter.initializers</name>
<value>org.apache.hadoop.security.AuthenticationFilterInitializer</value>
</property>
<property>
<name>hadoop.http.authentication.type</name>
<value>kerberos</value>
</property>
<property>
<name>hadoop.http.authentication.token.validity</name>
<value>36000</value>
</property>
<property>
<name>hadoop.http.authentication.signature.secret.file</name>
<value>/home/hadoop/hadoop/conf/http-secret-file</value>
</property>
<property>
<name>hadoop.http.authentication.cookie.domain</name>
<value></value>
</property>
<property>
<name>hadoop.http.authentication.simple.anonymous.allowed</name>
<value>false</value>
</property>
<property>
<name>hadoop.http.authentication.kerberos.principal</name>
<value>HTTP/[email protected]</value>
</property>
<property>
<name>hadoop.http.authentication.kerberos.keytab</name>
<value>/home/hadoop/hadoop/conf/http.keytab</value>
</property>
</configuration>
在启动时,HTTP认证成功。
2011-11-15 15:43:59,106 INFO org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler: Initialized, principal [HTTP/[email protected]] from keytab [/home/hadoop/hadoop/conf/http.keytab]
外观到代码后,我发现AuthenticationFilter的doFilter时会变空的道理,因此,认证开始(下面的代码),但在HttpServletRequest的授权为空,所以,我每次重装我的页面时,一个日志出现。
2011-11-15 15:47:52,190 WARN org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler: SPNEGO starting
// org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler
public AuthenticationToken authenticate(HttpServletRequest request, final HttpServletResponse response)
throws IOException, AuthenticationException {
AuthenticationToken token = null;
String authorization = request.getHeader(KerberosAuthenticator.AUTHORIZATION);
if (authorization == null || !authorization.startsWith(KerberosAuthenticator.NEGOTIATE)) {
response.setHeader(KerberosAuthenticator.WWW_AUTHENTICATE, KerberosAuthenticator.NEGOTIATE);
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
if (authorization == null) {
LOG.warn("SPNEGO starting");
} else {
LOG.warn("'" + KerberosAuthenticator.AUTHORIZATION + "' does not start with '" +
KerberosAuthenticator.NEGOTIATE + "' : {}", authorization);
}
是否有任何配置错误,或者只是我的浏览器不支持SPNEGO。我在Ubuntu 11.04中使用Chrome v16。
有没有人有线索来帮我弄明白?
谢谢。
对于Chrome浏览器,是的,我正在使用--auth-server-whitelist,但没有成功。为了您的使用卷曲的建议,最后,我看到授权。谢谢。 –
@Eric你真的帮了我很多,我在--auth-server-whitelist中添加了url,但是使用ip:port来访问namenode,这就是为什么没有发现授权的原因。感谢您让我在hadoop之外思考,专注于浏览器。 –