You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by sn...@apache.org on 2014/12/10 00:42:26 UTC

[1/7] incubator-ranger git commit: ARGUS-158: added support for SSLv2Hello protocol

Repository: incubator-ranger
Updated Branches:
  refs/heads/ranger-0.4 02d0f71d9 -> e88740f5f


ARGUS-158: added support for SSLv2Hello protocol


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/80b3e1ba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/80b3e1ba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/80b3e1ba

Branch: refs/heads/ranger-0.4
Commit: 80b3e1ba30b679c5070cdde908e5e6391192e47f
Parents: 02d0f71
Author: sneethiraj <sn...@apache.org>
Authored: Wed Nov 12 17:01:42 2014 -0500
Committer: sneethiraj <sn...@apache.org>
Committed: Sun Dec 7 01:12:13 2014 -0500

----------------------------------------------------------------------
 .../src/main/java/com/xasecure/server/tomcat/EmbededServer.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/80b3e1ba/embededwebserver/src/main/java/com/xasecure/server/tomcat/EmbededServer.java
----------------------------------------------------------------------
diff --git a/embededwebserver/src/main/java/com/xasecure/server/tomcat/EmbededServer.java b/embededwebserver/src/main/java/com/xasecure/server/tomcat/EmbededServer.java
index fd014e7..9298a45 100644
--- a/embededwebserver/src/main/java/com/xasecure/server/tomcat/EmbededServer.java
+++ b/embededwebserver/src/main/java/com/xasecure/server/tomcat/EmbededServer.java
@@ -112,7 +112,7 @@ public class EmbededServer {
 			ssl.setAttribute("keystorePass", getConfig("https.attrib.keystorePass"));
 			ssl.setAttribute("keystoreFile",  getConfig("https.attrib.keystoreFile")) ;
 			
-			String enabledProtocols = "TLSv1, TLSv1.1, TLSv1.2" ;
+			String enabledProtocols = "SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2" ;
 			ssl.setAttribute("sslEnabledProtocols", enabledProtocols ) ;
 			
 			server.getService().addConnector(ssl); 


[2/7] incubator-ranger git commit: Argus-180-Ranger lookup for hadoop repository fails when wire encryption is on

Posted by sn...@apache.org.
Argus-180-Ranger lookup for hadoop repository fails when wire encryption
is on


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/57b8dbd4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/57b8dbd4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/57b8dbd4

Branch: refs/heads/ranger-0.4
Commit: 57b8dbd436ee8edc7f014aa4b516c25b1ed973b0
Parents: 80b3e1b
Author: rmani <rm...@hortonworks.com>
Authored: Wed Nov 12 22:45:25 2014 -0800
Committer: sneethiraj <sn...@apache.org>
Committed: Sun Dec 7 01:12:46 2014 -0500

----------------------------------------------------------------------
 .../java/com/xasecure/hadoop/client/config/HadoopClassLoader.java | 3 +++
 .../com/xasecure/hadoop/client/config/HadoopConfigHolder.java     | 1 +
 security-admin/src/main/resources/resourcenamemap.properties      | 1 +
 3 files changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/57b8dbd4/lookup-client/src/main/java/com/xasecure/hadoop/client/config/HadoopClassLoader.java
----------------------------------------------------------------------
diff --git a/lookup-client/src/main/java/com/xasecure/hadoop/client/config/HadoopClassLoader.java b/lookup-client/src/main/java/com/xasecure/hadoop/client/config/HadoopClassLoader.java
index 7142bfa..214ff4d 100644
--- a/lookup-client/src/main/java/com/xasecure/hadoop/client/config/HadoopClassLoader.java
+++ b/lookup-client/src/main/java/com/xasecure/hadoop/client/config/HadoopClassLoader.java
@@ -84,6 +84,9 @@ public class HadoopClassLoader extends ClassLoader {
 				for(Object keyobj : prop.keySet()) {
 					String key = (String)keyobj;
 					String val = prop.getProperty(key) ;
+					if (HadoopConfigHolder.HADOOP_RPC_PROTECTION.equals(key) && (val == null || val.trim().isEmpty()))  {
+						continue;
+					}
 					out.println("<property><name>" + key.trim() + "</name><value>" + val + "</value></property>") ;
 				}
 				out.println("</configuration>") ;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/57b8dbd4/lookup-client/src/main/java/com/xasecure/hadoop/client/config/HadoopConfigHolder.java
----------------------------------------------------------------------
diff --git a/lookup-client/src/main/java/com/xasecure/hadoop/client/config/HadoopConfigHolder.java b/lookup-client/src/main/java/com/xasecure/hadoop/client/config/HadoopConfigHolder.java
index 6702954..b1bd62b 100644
--- a/lookup-client/src/main/java/com/xasecure/hadoop/client/config/HadoopConfigHolder.java
+++ b/lookup-client/src/main/java/com/xasecure/hadoop/client/config/HadoopConfigHolder.java
@@ -41,6 +41,7 @@ public class HadoopConfigHolder  {
 	public static final String XASECURE_LOGIN_PASSWORD = "password" ;
 	public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication";
 	public static final String HADOOP_SECURITY_AUTHENTICATION_METHOD = "kerberos";
+	public static final String HADOOP_RPC_PROTECTION = "hadoop.rpc.protection";
 	
 
 	private static boolean initialized = false ;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/57b8dbd4/security-admin/src/main/resources/resourcenamemap.properties
----------------------------------------------------------------------
diff --git a/security-admin/src/main/resources/resourcenamemap.properties b/security-admin/src/main/resources/resourcenamemap.properties
index e87a663..d9b4d71 100644
--- a/security-admin/src/main/resources/resourcenamemap.properties
+++ b/security-admin/src/main/resources/resourcenamemap.properties
@@ -17,6 +17,7 @@ fs.default.name=core-site.xml
 hadoop.security.authentication=core-site.xml
 hadoop.security.authorization=core-site.xml
 hadoop.security.auth_to_local=core-site.xml
+hadoop.rpc.protection=core-site.xml
 dfs.datanode.kerberos.principal=hdfs-site.xml
 dfs.namenode.kerberos.principal=hdfs-site.xml
 dfs.secondary.namenode.kerberos.principal=hdfs-site.xml


[3/7] incubator-ranger git commit: ARGUS-182: updated date field format in the audit record saved to HDFS file, to enable easier loading into Hive. Also revised the name of the JSON keys to make it easier to read/understand and also to save few bytes per

Posted by sn...@apache.org.
ARGUS-182: updated date field format in the audit record saved to HDFS
file, to enable easier loading into Hive. Also revised the name of the
JSON keys to make it easier to read/understand and also to save few
bytes per record.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/0895239f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/0895239f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/0895239f

Branch: refs/heads/ranger-0.4
Commit: 0895239f088e7a0903edfbab11029f3840006ae1
Parents: 57b8dbd
Author: Madhan Neethiraj <ma...@apache.org>
Authored: Wed Nov 12 23:14:37 2014 -0800
Committer: sneethiraj <sn...@apache.org>
Committed: Sun Dec 7 01:13:21 2014 -0500

----------------------------------------------------------------------
 .../xasecure/audit/model/AuditEventBase.java    | 37 ++++++++++++++++++--
 .../xasecure/audit/model/HBaseAuditEvent.java   | 10 +++++-
 .../xasecure/audit/model/HdfsAuditEvent.java    |  5 +++
 .../xasecure/audit/model/HiveAuditEvent.java    |  6 ++++
 .../xasecure/audit/model/KnoxAuditEvent.java    |  7 +++-
 .../xasecure/audit/model/StormAuditEvent.java   |  7 +++-
 .../com/xasecure/audit/provider/MiscUtil.java   |  2 +-
 7 files changed, 68 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java b/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java
index 4fd56be..be066de 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java
@@ -20,10 +20,10 @@
  package com.xasecure.audit.model;
 
 import java.util.Date;
-import java.util.UUID;
 
-import com.xasecure.audit.dao.DaoManager;
+import com.google.gson.annotations.SerializedName;  
 
+import com.xasecure.audit.dao.DaoManager;
 
 
 public abstract class AuditEventBase {
@@ -33,22 +33,55 @@ public abstract class AuditEventBase {
 	protected static final int MAX_REQUEST_DATA_FIELD_SIZE = 1800 ;
 
 	
+	@SerializedName("agent")  
 	protected String agentId        = null;
+
+	@SerializedName("reqUser")  
 	protected String user           = null;
+
+	@SerializedName("evtTime")  
 	protected Date   eventTime      = new Date();
+
+	@SerializedName("policy")  
 	protected long   policyId       = 0;
+
+	@SerializedName("access")  
 	protected String accessType     = null;
+
+	@SerializedName("result")  
 	protected short  accessResult   = 0; // 0 - DENIED; 1 - ALLOWED; HTTP return code 
+
+	@SerializedName("reason")  
 	protected String resultReason   = null;
+
+	@SerializedName("enforcer")  
 	protected String aclEnforcer    = null;
+
+	@SerializedName("repoType")  
 	protected int    repositoryType = 0;
+
+	@SerializedName("repo")  
 	protected String repositoryName = null;
+
+	@SerializedName("sess")  
 	protected String sessionId      = null;
+
+	@SerializedName("cliType")  
 	protected String clientType     = null;
+
+	@SerializedName("cliIP")  
 	protected String clientIP       = null;
+
+	@SerializedName("action")  
 	protected String action         = null;
+
+	@SerializedName("agentHost")  
 	protected String agentHostname  = null;
+
+	@SerializedName("logType")  
 	protected String logType        = null;
+
+	@SerializedName("id")  
 	protected String eventId        = null;
 
 	protected AuditEventBase() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
index 47cf2a0..4a35ea4 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
@@ -17,16 +17,24 @@
  * under the License.
  */
 
- package com.xasecure.audit.model;
+package com.xasecure.audit.model;
 
 import java.util.Date;
 
+import com.google.gson.annotations.SerializedName;  
+
 import com.xasecure.audit.dao.DaoManager;
 import com.xasecure.audit.entity.XXHBaseAuditEvent;
 
+
 public class HBaseAuditEvent extends AuditEventBase {
+	@SerializedName("resource")  
 	protected String resourcePath;
+
+	@SerializedName("resType")  
 	protected String resourceType;
+
+	@SerializedName("reqData")  
 	protected String requestData;
 
 	public HBaseAuditEvent() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
index 80f906b..b9a6870 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
@@ -21,11 +21,16 @@
 
 import java.util.Date;
 
+import com.google.gson.annotations.SerializedName;  
+
 import com.xasecure.audit.dao.DaoManager;
 import com.xasecure.audit.entity.XXHdfsAuditEvent;
 
 public class HdfsAuditEvent extends AuditEventBase {
+	@SerializedName("resource")  
 	protected String resourcePath;
+
+	@SerializedName("resType")  
 	protected String resourceType;
 
 	public HdfsAuditEvent() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
index 261c804..5765bed 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
@@ -21,12 +21,18 @@
 
 import java.util.Date;
 
+import com.google.gson.annotations.SerializedName;  
 import com.xasecure.audit.dao.DaoManager;
 import com.xasecure.audit.entity.XXHiveAuditEvent;
 
 public class HiveAuditEvent extends AuditEventBase {
+	@SerializedName("resource")  
 	protected String resourcePath;
+
+	@SerializedName("resType")  
 	protected String resourceType;
+
+	@SerializedName("reqData")  
 	protected String requestData;
 
 	public HiveAuditEvent() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
index 545de1c..dd18057 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
@@ -1,6 +1,6 @@
 package com.xasecure.audit.model;
 
-
+import com.google.gson.annotations.SerializedName;  
 import com.xasecure.audit.dao.DaoManager;
 import com.xasecure.audit.entity.XXKnoxAuditEvent;
 
@@ -22,8 +22,13 @@ import com.xasecure.audit.entity.XXKnoxAuditEvent;
  */
 
 public class KnoxAuditEvent extends AuditEventBase {
+	@SerializedName("resource")  
 	protected String resourcePath;
+
+	@SerializedName("resType")  
 	protected String resourceType;
+
+	@SerializedName("reqData")  
 	protected String requestData;
 
 	public KnoxAuditEvent() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
index 0dfcc39..f911068 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
@@ -1,6 +1,6 @@
 package com.xasecure.audit.model;
 
-
+import com.google.gson.annotations.SerializedName;  
 import com.xasecure.audit.dao.DaoManager;
 import com.xasecure.audit.entity.XXStormAuditEvent;
 
@@ -22,8 +22,13 @@ import com.xasecure.audit.entity.XXStormAuditEvent;
  */
 
 public class StormAuditEvent extends AuditEventBase {
+	@SerializedName("resource")  
 	protected String resourcePath;
+
+	@SerializedName("resType")  
 	protected String resourceType;
+
+	@SerializedName("reqData")  
 	protected String requestData;
 
 	public StormAuditEvent() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/provider/MiscUtil.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/MiscUtil.java b/agents-audit/src/main/java/com/xasecure/audit/provider/MiscUtil.java
index 54341dd..872420e 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/provider/MiscUtil.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/provider/MiscUtil.java
@@ -47,7 +47,7 @@ public class MiscUtil {
 
 	static {
 		try {
-			sGsonBuilder = new GsonBuilder().setDateFormat("yyyyMMdd-HH:mm:ss.SSS-Z").create();
+			sGsonBuilder = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss.SSS").create();
 		} catch(Throwable excp) {
 			LogLog.warn("failed to create GsonBuilder object. stringigy() will return obj.toString(), instead of Json", excp);
 		}


[6/7] incubator-ranger git commit: ARGUS-185: optimize database transaction usage in admin web application

Posted by sn...@apache.org.
ARGUS-185: optimize database transaction usage in admin web application


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/b0416423
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/b0416423
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/b0416423

Branch: refs/heads/ranger-0.4
Commit: b0416423a849f6f276d8100fbc915a95f42acee9
Parents: 487d1bf
Author: Madhan Neethiraj <ma...@apache.org>
Authored: Mon Nov 17 11:58:38 2014 -0800
Committer: sneethiraj <sn...@apache.org>
Committed: Sun Dec 7 01:17:10 2014 -0500

----------------------------------------------------------------------
 security-admin/src/main/java/com/xasecure/biz/AssetMgr.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/b0416423/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java b/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
index a96dab9..521cea7 100644
--- a/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
+++ b/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
@@ -2170,7 +2170,7 @@ public class AssetMgr extends AssetMgrBase {
 			final XXPolicyExportAudit xXPolicyExportAudit) {
 		TransactionTemplate txTemplate = new TransactionTemplate(txManager);
 		txTemplate
-				.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
+				.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
 		XXPolicyExportAudit policyExportAudit = (XXPolicyExportAudit) txTemplate
 				.execute(new TransactionCallback<Object>() {
 					public Object doInTransaction(TransactionStatus status) {


[7/7] incubator-ranger git commit: ARGUS-186: Updated usersync service for better handling of failures in sending users/groups to policy admin.

Posted by sn...@apache.org.
ARGUS-186: Updated usersync service for better handling of failures in
sending users/groups to policy admin.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/e88740f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/e88740f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/e88740f5

Branch: refs/heads/ranger-0.4
Commit: e88740f5f8f3615bc115e9c17bc35a1a269bf7e9
Parents: b041642
Author: Madhan Neethiraj <ma...@apache.org>
Authored: Tue Nov 18 13:54:18 2014 -0800
Committer: sneethiraj <sn...@apache.org>
Committed: Sun Dec 7 01:18:12 2014 -0500

----------------------------------------------------------------------
 .../com/xasecure/usergroupsync/UserGroupSync.java    | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e88740f5/ugsync/src/main/java/com/xasecure/usergroupsync/UserGroupSync.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/com/xasecure/usergroupsync/UserGroupSync.java b/ugsync/src/main/java/com/xasecure/usergroupsync/UserGroupSync.java
index 6456a96..81643da 100644
--- a/ugsync/src/main/java/com/xasecure/usergroupsync/UserGroupSync.java
+++ b/ugsync/src/main/java/com/xasecure/usergroupsync/UserGroupSync.java
@@ -19,13 +19,10 @@
 
  package com.xasecure.usergroupsync;
 
-import java.util.List;
 
 import org.apache.log4j.Logger;
 
 import com.xasecure.unixusersync.config.UserGroupSyncConfig;
-import com.xasecure.unixusersync.process.PolicyMgrUserGroupBuilder;
-import com.xasecure.unixusersync.process.UnixUserGroupBuilder;
 
 public class UserGroupSync implements Runnable {
 	
@@ -77,6 +74,8 @@ public class UserGroupSync implements Runnable {
 				}
 			}
 
+			boolean forceSync = false;
+
 			while (! shutdownFlag ) {
 				try {
 					Thread.sleep(sleepTimeBetweenCycleInMillis);
@@ -85,12 +84,14 @@ public class UserGroupSync implements Runnable {
 				}
 
 				try {
-					syncUserGroup() ;
+					syncUserGroup(forceSync) ;
+
+					forceSync = false;
 				}
 				catch(Throwable t) {
 					LOG.error("Failed to synchronize UserGroup information. Error details: ", t) ;
 
-					System.exit(1);
+					forceSync = true;  // force sync to the destination in the next attempt
 				}
 			}
 		
@@ -103,11 +104,11 @@ public class UserGroupSync implements Runnable {
 		}
 	}
 	
-	private void syncUserGroup() throws Throwable {
+	private void syncUserGroup(boolean forceSync) throws Throwable {
 		UserGroupSyncConfig config = UserGroupSyncConfig.getInstance() ;
 
 		if (config.isUserSyncEnabled()) {
-			if (ugSource.isChanged()) {
+			if (forceSync || ugSource.isChanged()) {
 				LOG.info("Begin: update user/group from source==>sink");
 				ugSource.updateSink(ugSink);
 				LOG.info("End: update user/group from source==>sink");


[4/7] incubator-ranger git commit: ARGUS-180:Added ability to specify hadoop.rpc.protection in HDFS repo page

Posted by sn...@apache.org.
ARGUS-180:Added ability to specify hadoop.rpc.protection in HDFS repo page

Signed-off-by: sneethiraj <sn...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/c75662e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/c75662e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/c75662e8

Branch: refs/heads/ranger-0.4
Commit: c75662e8ff1100f613dc7410c529b2d203bb5db8
Parents: 0895239
Author: vperiasamy <vp...@hortonworks.com>
Authored: Thu Nov 13 04:58:53 2014 -0500
Committer: sneethiraj <sn...@apache.org>
Committed: Sun Dec 7 01:13:46 2014 -0500

----------------------------------------------------------------------
 security-admin/src/main/webapp/scripts/models/VXAsset.js     | 1 +
 .../src/main/webapp/scripts/views/asset/AssetForm.js         | 8 +++++++-
 .../src/main/webapp/templates/asset/AssetForm_tmpl.html      | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/c75662e8/security-admin/src/main/webapp/scripts/models/VXAsset.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/models/VXAsset.js b/security-admin/src/main/webapp/scripts/models/VXAsset.js
index 1d66fe6..685d7fd 100644
--- a/security-admin/src/main/webapp/scripts/models/VXAsset.js
+++ b/security-admin/src/main/webapp/scripts/models/VXAsset.js
@@ -103,6 +103,7 @@ define(function(require){
 			datanode : "dfs.datanode.kerberos.principal",
 			namenode : "dfs.namenode.kerberos.principal",
 			secNamenode : "dfs.secondary.namenode.kerberos.principal",
+			hadoopRpcProtection : "hadoop.rpc.protection",
 			//hive
 			driverClassName : "jdbc.driverClassName",
 			url	: "jdbc.url",

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/c75662e8/security-admin/src/main/webapp/scripts/views/asset/AssetForm.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/asset/AssetForm.js b/security-admin/src/main/webapp/scripts/views/asset/AssetForm.js
index 51e5ac3..0db1aa3 100644
--- a/security-admin/src/main/webapp/scripts/views/asset/AssetForm.js
+++ b/security-admin/src/main/webapp/scripts/views/asset/AssetForm.js
@@ -128,6 +128,11 @@ define(function(require){
 					fieldClass : "hdfs",
 					editorAttrs :{'class':'stretchTextInput'}
 				},
+				hadoopRpcProtection : {
+					title		: this.model.propertiesNameMap.hadoopRpcProtection,//'hadoop.rpc.protection',
+					fieldClass : "hdfs",
+					editorAttrs :{'class':'stretchTextInput'}
+				},
 				driverClassName : {
 					fieldClass : "hive",
 					title : this.model.propertiesNameMap.driverClassName,//'xalogin.jdbc.driverClassName'
@@ -231,7 +236,7 @@ define(function(require){
 			switch(parseInt(this.model.get('assetType'))){
 				case XAEnums.AssetType.ASSET_HDFS.value :
 					attrs = ['userName','passwordKeytabfile','fsDefaultName' ,'authorization', 'authentication', 'auth_to_local', 'datanode', 'namenode', 'secNamenode',
-								'commonnameforcertificate'];
+					         'hadoopRpcProtection', 'commonnameforcertificate'];
 					break;
 				case XAEnums.AssetType.ASSET_HIVE.value :
 					attrs = ['userName','passwordKeytabfile','driverClassName', 'url','commonnameforcertificate'];
@@ -304,6 +309,7 @@ define(function(require){
 					this.fields.datanode.$el.hide();
 					this.fields.namenode.$el.hide();
 					this.fields.secNamenode.$el.hide();
+					this.fields.hadoopRpcProtection.$el.hide();
 					this.fields.rpcEngine.$el.hide();
 					this.fields.rpcProtection.$el.hide();
 					this.fields.commonnameforcertificate.$el.hide();

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/c75662e8/security-admin/src/main/webapp/templates/asset/AssetForm_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/asset/AssetForm_tmpl.html b/security-admin/src/main/webapp/templates/asset/AssetForm_tmpl.html
index f860056..3e24abc 100644
--- a/security-admin/src/main/webapp/templates/asset/AssetForm_tmpl.html
+++ b/security-admin/src/main/webapp/templates/asset/AssetForm_tmpl.html
@@ -38,6 +38,7 @@
 		<div class="" data-fields="datanode"></div>
 		<div class="" data-fields="namenode"></div>
 		<div class="" data-fields="secNamenode"></div>
+		<div class="" data-fields="hadoopRpcProtection"></div>
 		<div class="" data-fields="driverClassName"></div>
 		<div class="" data-fields="url"></div>
 		<div class="" data-fields="masterKerberos"></div>


[5/7] incubator-ranger git commit: ARGUS-183:Fix for search policies API failing in Oracle

Posted by sn...@apache.org.
ARGUS-183:Fix for search policies API failing in Oracle

Signed-off-by: sneethiraj <sn...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/487d1bfb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/487d1bfb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/487d1bfb

Branch: refs/heads/ranger-0.4
Commit: 487d1bfbb9c546a834dad7c7550eba0c4190de8c
Parents: c75662e
Author: vperiasamy <vp...@hortonworks.com>
Authored: Thu Nov 13 18:34:11 2014 -0500
Committer: sneethiraj <sn...@apache.org>
Committed: Sun Dec 7 01:16:14 2014 -0500

----------------------------------------------------------------------
 .../main/java/com/xasecure/biz/XABizUtil.java   | 36 +++++++++++++++++
 .../java/com/xasecure/common/AppConstants.java  | 42 ++++++++++++++++++++
 .../com/xasecure/common/SearchCriteria.java     | 12 ++++++
 .../main/java/com/xasecure/rest/AssetREST.java  |  2 +-
 4 files changed, 91 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/487d1bfb/security-admin/src/main/java/com/xasecure/biz/XABizUtil.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/biz/XABizUtil.java b/security-admin/src/main/java/com/xasecure/biz/XABizUtil.java
index 6dc21a4..5a071c4 100644
--- a/security-admin/src/main/java/com/xasecure/biz/XABizUtil.java
+++ b/security-admin/src/main/java/com/xasecure/biz/XABizUtil.java
@@ -1277,4 +1277,40 @@ public class XABizUtil {
 			daoManager.getXXTrxLog().create(xTrxLog);
 		}
 	}
+
+	public static int getDBFlavor() {
+
+		String dbFlavor = "";
+		boolean dbFlavorPropFound = true;
+
+		dbFlavor = PropertiesUtil.getProperty("xa.db.flavor");
+		if (dbFlavor == null || dbFlavor.trim().isEmpty()) {
+			dbFlavor = PropertiesUtil.getProperty("jdbc.dialect");
+			dbFlavorPropFound = false;
+		}
+
+		if (dbFlavor != null && !dbFlavor.trim().isEmpty()) {
+			if (dbFlavorPropFound) {
+				if ("MYSQL".equalsIgnoreCase(dbFlavor)) {
+					return AppConstants.DB_FLAVOR_MYSQL;
+				} else if ("ORACLE".equalsIgnoreCase(dbFlavor)) {
+					return AppConstants.DB_FLAVOR_ORACLE;
+				} else {
+					return AppConstants.DB_FLAVOR_UNKNOWN;
+				}
+			} else {
+				if (dbFlavor.toUpperCase().contains("MYSQL")) {
+					return AppConstants.DB_FLAVOR_MYSQL;
+				} else if (dbFlavor.toUpperCase().contains("ORACLE")) {
+					return AppConstants.DB_FLAVOR_ORACLE;
+				} else {
+					return AppConstants.DB_FLAVOR_UNKNOWN;
+				}
+			}
+		} else {
+			logger.error("Property : xa.db.flavor or jdbc.dialect, not found");
+			return AppConstants.DB_FLAVOR_UNKNOWN;
+		}
+	}
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/487d1bfb/security-admin/src/main/java/com/xasecure/common/AppConstants.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/AppConstants.java b/security-admin/src/main/java/com/xasecure/common/AppConstants.java
index 86ba6da..c4e5991 100644
--- a/security-admin/src/main/java/com/xasecure/common/AppConstants.java
+++ b/security-admin/src/main/java/com/xasecure/common/AppConstants.java
@@ -351,6 +351,22 @@ public class AppConstants extends XACommonEnums {
 	 */
 	public static final int XAPermType_MAX = 31;
 
+	/***************************************************************
+	 * Enum values for DatabaseFavor
+	 **************************************************************/
+	/**
+	 * DB Favor Unknown
+	 */
+	public static final int DB_FLAVOR_UNKNOWN = 0;
+	/**
+	 * DB Favor MySql
+	 */
+	public static final int DB_FLAVOR_MYSQL = 1;
+	/**
+	 * DB Favor Oracle
+	 */
+	public static final int DB_FLAVOR_ORACLE = 2;
+
 
 	/***************************************************************
 	 * Enum values for ClassTypes
@@ -908,5 +924,31 @@ public class AppConstants extends XACommonEnums {
 		return 0;
 	}
 
+	static public int getEnumFor_DatabaseFlavor(String label) {
+		if (label == null) {
+			return DB_FLAVOR_UNKNOWN; // DB_FLAVOR_UNKNOWN
+		}
+		if ("MYSQL".equalsIgnoreCase(label)) {
+			return DB_FLAVOR_MYSQL; // DB_FLAVOR_MYSQL
+		}
+		if ("ORACLE".equalsIgnoreCase(label)) {
+			return DB_FLAVOR_ORACLE; // DB_FLAVOR_ORACLE
+		}
+		return DB_FLAVOR_UNKNOWN;
+	}
+
+	static public String getLabelFor_DatabaseFlavor(int elementValue) {
+		if (elementValue == DB_FLAVOR_UNKNOWN) {
+			return "UNKNOWN"; // Unknown
+		}
+		if (elementValue == DB_FLAVOR_MYSQL) {
+			return "MYSQL"; // MYSQL
+		}
+		if (elementValue == DB_FLAVOR_ORACLE) {
+			return "ORACLE"; // ORACLE
+		}
+		return null;
+	}
+
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/487d1bfb/security-admin/src/main/java/com/xasecure/common/SearchCriteria.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/SearchCriteria.java b/security-admin/src/main/java/com/xasecure/common/SearchCriteria.java
index bb85fe4..c1df00f 100644
--- a/security-admin/src/main/java/com/xasecure/common/SearchCriteria.java
+++ b/security-admin/src/main/java/com/xasecure/common/SearchCriteria.java
@@ -28,8 +28,13 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.log4j.Logger;
+
+import com.xasecure.biz.XABizUtil;
+
 
 public class SearchCriteria {
+	Logger logger = Logger.getLogger(SearchCriteria.class);
 
 	int startIndex = 0;
 	int maxRows = Integer.MAX_VALUE;
@@ -182,6 +187,13 @@ public class SearchCriteria {
 	 *            the isDistinct to set
 	 */
 	public void setDistinct(boolean isDistinct) {
+
+		int dbFlavor = XABizUtil.getDBFlavor();
+		if (isDistinct && dbFlavor == AppConstants.DB_FLAVOR_ORACLE) {
+			isDistinct = false;
+			logger.debug("Database flavor is `ORACLE` so ignoring DISTINCT "
+					+ "clause from select statement.");
+		}
 		this.isDistinct = isDistinct;
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/487d1bfb/security-admin/src/main/java/com/xasecure/rest/AssetREST.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/rest/AssetREST.java b/security-admin/src/main/java/com/xasecure/rest/AssetREST.java
index e187a78..2662409 100644
--- a/security-admin/src/main/java/com/xasecure/rest/AssetREST.java
+++ b/security-admin/src/main/java/com/xasecure/rest/AssetREST.java
@@ -334,7 +334,7 @@ public class AssetREST {
 		// searchUtil.addSearchGroup(searchCriteria, outerGroup);
 		//
 		// }
-		//searchCriteria.setDistinct(true);
+		searchCriteria.setDistinct(true);
 
 		return assetMgr.searchXResources(searchCriteria);
 	}