From 49959f95ff42c08028bfcdecee23ce0a4b5146fe Mon Sep 17 00:00:00 2001 From: Aaron Myers Date: Fri, 5 Oct 2012 00:56:09 +0000 Subject: [PATCH] HDFS-3813. Log error message if security and WebHDFS are enabled but principal/keytab are not configured. Contributed by Stephen Chu. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1394341 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/namenode/NameNodeHttpServer.java | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 5dc3b6ed409..4b5d52c33e6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -31,6 +31,9 @@ Release 2.0.3-alpha - Unreleased HDFS-3916. libwebhdfs (C client) code cleanups. (Colin Patrick McCabe via eli) + HDFS-3813. Log error message if security and WebHDFS are enabled but + principal/keytab are not configured. (Stephen Chu via atm) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java index fe73c42e7b6..3488f074103 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java @@ -107,6 +107,10 @@ public class NameNodeHttpServer { DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL_KEY, SecurityUtil.getServerPrincipal(principalInConf, bindAddress.getHostName())); + } else if (UserGroupInformation.isSecurityEnabled()) { + LOG.error("WebHDFS and security are enabled, but configuration property '" + + DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL_KEY + + "' is not set."); } String httpKeytab = conf.get( DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY); @@ -117,6 +121,10 @@ public class NameNodeHttpServer { params.put( DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY, httpKeytab); + } else if (UserGroupInformation.isSecurityEnabled()) { + LOG.error("WebHDFS and security are enabled, but configuration property '" + + DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY + + "' is not set."); } return params; }