hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1449820 - in /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift: ThriftServer.java ThriftServerRunner.java
Date Mon, 25 Feb 2013 19:22:31 GMT
Author: tedyu
Date: Mon Feb 25 19:22:31 2013
New Revision: 1449820

URL: http://svn.apache.org/r1449820
Log:
HBASE-7915 Secure ThriftServer needs to login before calling HBaseHandler (Arpit)


Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java?rev=1449820&r1=1449819&r2=1449820&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
Mon Feb 25 19:22:31 2013
@@ -31,9 +31,12 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.thrift.ThriftServerRunner.ImplType;
 import org.apache.hadoop.hbase.util.InfoServer;
+import org.apache.hadoop.hbase.util.Strings;
 import org.apache.hadoop.hbase.util.VersionInfo;
+import org.apache.hadoop.net.DNS;
 import org.apache.hadoop.util.Shell.ExitCodeException;
 
 /**
@@ -88,6 +91,16 @@ public class ThriftServer {
    */
    void doMain(final String[] args) throws Exception {
      processOptions(args);
+     
+     // login the server principal (if using secure Hadoop)
+     if (User.isSecurityEnabled() && User.isHBaseSecurityEnabled(conf)) {
+       String machineName = Strings.domainNamePointerToHostName(
+         DNS.getDefaultHost(conf.get("hbase.thrift.dns.interface", "default"),
+           conf.get("hbase.thrift.dns.nameserver", "default")));
+       User.login(conf, "hbase.thrift.keytab.file",
+           "hbase.thrift.kerberos.principal", machineName);
+     }
+     
      serverRunner = new ThriftServerRunner(conf);
 
      // Put up info server.

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java?rev=1449820&r1=1449819&r2=1449820&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
Mon Feb 25 19:22:31 2013
@@ -67,7 +67,6 @@ import org.apache.hadoop.hbase.filter.Fi
 import org.apache.hadoop.hbase.filter.ParseFilter;
 import org.apache.hadoop.hbase.filter.PrefixFilter;
 import org.apache.hadoop.hbase.filter.WhileMatchFilter;
-import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.thrift.CallQueue.Call;
 import org.apache.hadoop.hbase.thrift.generated.AlreadyExists;
 import org.apache.hadoop.hbase.thrift.generated.BatchMutation;
@@ -81,10 +80,7 @@ import org.apache.hadoop.hbase.thrift.ge
 import org.apache.hadoop.hbase.thrift.generated.TRegionInfo;
 import org.apache.hadoop.hbase.thrift.generated.TRowResult;
 import org.apache.hadoop.hbase.thrift.generated.TScan;
-import org.apache.hadoop.hbase.util.Addressing;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.Strings;
-import org.apache.hadoop.net.DNS;
 import org.apache.thrift.TException;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TCompactProtocol;
@@ -368,14 +364,7 @@ public class ThriftServerRunner implemen
           tserver.getClass().getName());
     }
 
-    // login the server principal (if using secure Hadoop)
-    if (User.isSecurityEnabled() && User.isHBaseSecurityEnabled(conf)) {
-      String machineName = Strings.domainNamePointerToHostName(
-        DNS.getDefaultHost(conf.get("hbase.thrift.dns.interface", "default"),
-          conf.get("hbase.thrift.dns.nameserver", "default")));
-      User.login(conf, "hbase.thrift.keytab.file",
-          "hbase.thrift.kerberos.principal", machineName);
-    }
+   
 
     registerFilters(conf);
   }



Mime
View raw message