hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bor...@apache.org
Subject svn commit: r990228 - in /hadoop/hdfs/trunk: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java src/webapps/hdfs/dfshealth.jsp
Date Fri, 27 Aug 2010 18:49:02 GMT
Author: boryas
Date: Fri Aug 27 18:49:01 2010
New Revision: 990228

URL: http://svn.apache.org/viewvc?rev=990228&view=rev
Log:
HDFS-1356.  Provide information as to whether or not security is enabled on web interface
for NameNode

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java
    hadoop/hdfs/trunk/src/webapps/hdfs/dfshealth.jsp

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=990228&r1=990227&r2=990228&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Fri Aug 27 18:49:01 2010
@@ -116,6 +116,9 @@ Trunk (unreleased changes)
     HDFS-1318. Add JMX interface for read access to namenode and datanode
     web UI information. (Tanping Wang via suresh).
 
+    HDFS-1356.  Provide information as to whether or not security is 
+    enabled on web interface for NameNode (boryas)
+
   OPTIMIZATIONS
 
     HDFS-1140. Speedup INode.getPathComponents. (Dmytro Molkov via shv)

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java?rev=990228&r1=990227&r2=990228&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
(original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
Fri Aug 27 18:49:01 2010
@@ -59,6 +59,18 @@ class NamenodeJspHelper {
       return "";
     return "Safe mode is ON. <em>" + fsn.getSafeModeTip() + "</em><br>";
   }
+  
+  /**
+   * returns security mode of the cluster (namenode)
+   * @return "on" if security is on, and "off" otherwise
+   */
+  static String getSecurityModeText() {  
+    if(UserGroupInformation.isSecurityEnabled()) {
+      return "Security is <em>ON</em> <br>";
+    } else {
+      return "Security is <em>OFF</em> <br>";
+    }
+  }
 
   static String getInodeLimitText(FSNamesystem fsn) {
     long inodes = fsn.dir.totalInodes();

Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java?rev=990228&r1=990227&r2=990228&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java
(original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java
Fri Aug 27 18:49:01 2010
@@ -24,12 +24,13 @@ import java.io.IOException;
 
 import javax.servlet.http.HttpServletRequest;
 
-import junit.framework.Assert;
-
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdfs.DFSConfigKeys;
 import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -60,5 +61,20 @@ public class TestNameNodeJspHelper {
     //tokenString returned must be null because security is disabled
     Assert.assertEquals(null, tokenString);
   }
-
+  
+  @Test
+  public void  tesSecurityModeText() {
+    conf.set(DFSConfigKeys.HADOOP_SECURITY_AUTHENTICATION, "kerberos");
+    UserGroupInformation.setConfiguration(conf);
+    String securityOnOff = NamenodeJspHelper.getSecurityModeText();
+    Assert.assertTrue("security mode doesn't match. Should be ON", 
+        securityOnOff.contains("ON"));
+    //Security is enabled
+    conf.set(DFSConfigKeys.HADOOP_SECURITY_AUTHENTICATION, "simple");
+    UserGroupInformation.setConfiguration(conf);
+    
+    securityOnOff = NamenodeJspHelper.getSecurityModeText();
+    Assert.assertTrue("security mode doesn't match. Should be OFF", 
+        securityOnOff.contains("OFF"));
+  }
 }

Modified: hadoop/hdfs/trunk/src/webapps/hdfs/dfshealth.jsp
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/webapps/hdfs/dfshealth.jsp?rev=990228&r1=990227&r2=990228&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/webapps/hdfs/dfshealth.jsp (original)
+++ hadoop/hdfs/trunk/src/webapps/hdfs/dfshealth.jsp Fri Aug 27 18:49:01 2010
@@ -47,6 +47,7 @@
 
 <hr>
 <h3>Cluster Summary</h3>
+<b> <%= NamenodeJspHelper.getSecurityModeText()%> </b>
 <b> <%= NamenodeJspHelper.getSafeModeText(fsn)%> </b>
 <b> <%= NamenodeJspHelper.getInodeLimitText(fsn)%> </b>
 <a class="warning" href="/corrupt_files.jsp" title="List corrupt files">



Mime
View raw message