Author: jing9 Date: Mon Dec 23 18:28:09 2013 New Revision: 1553168 URL: http://svn.apache.org/r1553168 Log: HDFS-5690. Merge change r1553167 from trunk.
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/SecureDataNodeStarter.java Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1553168&r1=1553167&r2=1553168&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Mon Dec 23 18:28:09 2013 @@ -246,6 +246,9 @@ Release 2.4.0 - UNRELEASED HDFS-5691. Fix typo in ShortCircuitLocalRead document. (Akira Ajisaka via suresh) + HDFS-5690. DataNode fails to start in secure mode when dfs.http.policy equals to + HTTP_ONLY. (Haohui Mai via jing9) + Release 2.3.0 - UNRELEASED INCOMPATIBLE CHANGES Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/SecureDataNodeStarter.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/SecureDataNodeStarter.java?rev=1553168&r1=1553167&r2=1553168&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/SecureDataNodeStarter.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/SecureDataNodeStarter.java Mon Dec 23 18:28:09 2013 @@ -87,6 +87,7 @@ public class SecureDataNodeStarter imple public static SecureResources getSecureResources(Configuration conf) throws Exception { HttpConfig.Policy policy = DFSUtil.getHttpPolicy(conf); + boolean isSecure = UserGroupInformation.isSecurityEnabled(); // Obtain secure port for data streaming to datanode InetSocketAddress streamingAddr = DataNode.getStreamingAddr(conf); @@ -106,6 +107,11 @@ public class SecureDataNodeStarter imple + ss.getLocalPort()); } + if (ss.getLocalPort() > 1023 && isSecure) { + throw new RuntimeException( + "Cannot start secure datanode with unprivileged RPC ports"); + } + System.err.println("Opened streaming server at " + streamingAddr); // Bind a port for the web server. The code intends to bind HTTP server to @@ -126,9 +132,9 @@ public class SecureDataNodeStarter imple System.err.println("Successfully obtained privileged resources (streaming port = " + ss + " ) (http listener port = " + listener.getConnection() +")"); - if ((ss.getLocalPort() > 1023 || listener.getPort() > 1023) && - UserGroupInformation.isSecurityEnabled()) { - throw new RuntimeException("Cannot start secure datanode with unprivileged ports"); + if (listener.getPort() > 1023 && isSecure) { + throw new RuntimeException( + "Cannot start secure datanode with unprivileged HTTP ports"); } System.err.println("Opened info server at " + infoSocAddr); }