Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Integration with Apache Sentry involves the development of three main modules:

CDAP Sentry Binding

CDAP Sentry Model

The CDAP Sentry Model defines the CDAP entities for whom access needs to be authorized via Apache Sentry. It will based off of the Sentry Generic Authorization Model. The CDAP Sentry Model will have the following components:

CDAPAuthorizable

This interface defines the CDAP entities that need to be authorized. It must implement Authorizable.

Code Block
themeConfluence
languagejava
titleCDAPAuthorizable
firstline1
/**
 * This interface represents an authorizable resource in the CDAP component.
 */
public interface CDAPAuthorizable extends Authorizable {

  public enum AuthorizableType {
	Instance,
    Namespace,
    Artifact,
    Application,
    Program,
    Dataset,
    Stream,
	Stream_View
  };
  AuthorizableType getAuthzType();
}

The CDAPAuthorizable interface will have to be implemented for each authorizable entity defined by the AuthorizableType enum above.

CDAPAction and CDAPActionFactory

These classes will implement BitFieldAction and BitFieldActionFactory to define the types of actions on CDAP entities. These classes also allow you to define implies relationships between actions.

TODO: Think about ALL, ADMIN_ALL

Code Block
themeConfluence
languagejava
titleCDAPActions
firstline1
linenumberstrue
public class CDAPActionConstants {
  public static final String READ = "read";
  public static final String EXECUTE = "execute";
  public static final String WRITE = "write";
  public static final String ADMIN = "admin";
  public static final String ALL = "all"; // this is read + write + execute
  public static final String ADMIN_ALL = "admin_all"; // this is read + write + execute + admin
}

Sentry Policy Engine

Resource URIs

Using the above authorizable model, resource URIs for CDAP entities in the Sentry Policy Engine will be as follows:

ACL management (either using CDAP CLI or via external systems like Sentry CLI or Hue)

Design Scribble:

To integrate with CDAP we will need implementation of the following modules.

Main modules:

  • Binding: Authorization checks happen here

  • Model: Define what are the objects in your system that you want to control access and define the granularity

  • Policy engine: Define how you want to evaluate policies. For example: Wildcards?

Model:

 

Action:
Sentry has an interface which defines an Action:
We can use abstract class BitFieldAction and define action for CDAP entities. Since, we need different action for different entities we will have to define them separately:

 

Binding:

Here we will bind CDAP to SentryGenericServiceClient and to the operations on the client.

Code Block
languagejava
titleSentryAuthorizer
public class SentryAuthorizer implements Authorizer {

    void grant(EntityId entity, Principal Principal, Set<Action> actions){
		// do grant operation on sentry client with needed mapping/conversion
	}

    void grant(EntityId entity, Principal Principal, Set<Action> actions){
		// do grant operation on sentry client with needed mapping/conversion
	}

    void revoke(EntityId entity, Principal Principal, Set<Action> actions){
		// do grant operation on sentry client with needed mapping/conversion
	}

    void revoke(EntityId entity, Principal Principal){
		// do revoke operation on sentry client with needed mapping/conversion
	}

    void revoke(EntityId entity){
		// do revoke operation on sentry client with needed mapping/conversion
	}
 	void checkAuthorized(Principal Principal, Entity entity, Action action) throws AuthorizationException{
		// do authorization check operation on sentry client with needed mapping/conversion
	}
 
	private SentryGenericServiceClient getClient() throws Exception {
	  return SentryGenericServiceClientFactory.create(conf); // create sentry client from Configuration 
	}
}

...

Here we will bind CDAP to SentryGenericServiceClient and to the operations on the client.

Code Block
languagejava
titleSentryAuthorizer
public class SentryAuthorizer implements Authorizer {

    void grant(EntityId entity, Principal Principal, Set<Action> actions){
		// do grant operation on sentry client with needed mapping/conversion
	}

    void grant(EntityId entity, Principal Principal, Set<Action> actions){
		// do grant operation on sentry client with needed mapping/conversion
	}

    void revoke(EntityId entity, Principal Principal, Set<Action> actions){
		// do grant operation on sentry client with needed mapping/conversion
	}

    void revoke(EntityId entity, Principal Principal){
		// do revoke operation on sentry client with needed mapping/conversion
	}

    void revoke(EntityId entity){
		// do revoke operation on sentry client with needed mapping/conversion
	}
 	void checkAuthorized(Principal Principal, Entity entity, Action action) throws AuthorizationException{
		// do authorization check operation on sentry client with needed mapping/conversion
	}
 
	private SentryGenericServiceClient getClient() throws Exception {
	  return SentryGenericServiceClientFactory.create(conf); // create sentry client from Configuration 
	}
}

 

CDAP Sentry Model

The CDAP Sentry Model defines the CDAP entities for whom access needs to be authorized via Apache Sentry. It will based off of the Sentry Generic Authorization Model. The CDAP Sentry Model will have the following components:

CDAPAuthorizable

This interface defines the CDAP entities that need to be authorized. It must implement Authorizable.

Code Block
themeConfluence
languagejava
titleCDAPAuthorizable
firstline1
/**
 * This interface represents an authorizable resource in the CDAP component.
 */
public interface CDAPAuthorizable extends Authorizable {

  public enum AuthorizableType {
	Instance,
    Namespace,
    Artifact,
    Application,
    Program,
    Dataset,
    Stream,
	Stream_View
  };
  AuthorizableType getAuthzType();
}

The CDAPAuthorizable interface will have to be implemented for each authorizable entity defined by the AuthorizableType enum above.

CDAPAction and CDAPActionFactory

These classes will implement BitFieldAction and BitFieldActionFactory to define the types of actions on CDAP entities. These classes also allow you to define implies relationships between actions.

TODO: Think about ALL, ADMIN_ALL

Code Block
themeConfluence
languagejava
titleCDAPActions
firstline1
linenumberstrue
public class CDAPActionConstants {
  public static final String READ = "read";
  public static final String EXECUTE = "execute";
  public static final String WRITE = "write";
  public static final String ADMIN = "admin";
  public static final String ALL = "all"; // this is read + write + execute
  public static final String ADMIN_ALL = "admin_all"; // this is read + write + execute + admin
}

Sentry Policy Engine

Resource URIs

Using the above authorizable model, resource URIs for CDAP entities in the Sentry Policy Engine will be as follows:

ACL management (either using CDAP CLI or via external systems like Sentry CLI or Hue)

Design Scribble:

To integrate with CDAP we will need implementation of the following modules.

Main modules:

  • Binding: Authorization checks happen here

  • Model: Define what are the objects in your system that you want to control access and define the granularity

  • Policy engine: Define how you want to evaluate policies. For example: Wildcards?

Model:

 

Action:
Sentry has an interface which defines an Action:
We can use abstract class BitFieldAction and define action for CDAP entities. Since, we need different action for different entities we will have to define them separately:

 

Binding:

Policy:

//TODO

 

Will have to whitelist the cdap user for the Sentry Service.

...