Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public class EmbeddedServiceDefsUtil {
private static final Logger LOG = LoggerFactory.getLogger(EmbeddedServiceDefsUtil.class);


// following servicedef list should be reviewed/updated whenever a new embedded service-def is added
public static final String DEFAULT_BOOTSTRAP_SERVICEDEF_LIST = "tag,hdfs,hbase,hive,kms,knox,storm,yarn,kafka,solr,atlas,nifi,nifi-registry,sqoop,kylin,elasticsearch,presto,trino,ozone,kudu,schema-registry,nestedstructure";
// following servicedef list should be reviewed/updated whenever a new embedded service-def is added
public static final String DEFAULT_BOOTSTRAP_SERVICEDEF_LIST = "tag,hdfs,hbase,hive,kms,knox,storm,yarn,kafka,solr,atlas,nifi,nifi-registry,sqoop,kylin,elasticsearch,presto,trino,ozone,kudu,schema-registry,nestedstructure,s3";
private static final String PROPERTY_SUPPORTED_SERVICE_DEFS = "ranger.supportedcomponents";
private Set<String> supportedServiceDefs;
public static final String EMBEDDED_SERVICEDEF_TAG_NAME = "tag";
Expand All @@ -75,6 +75,7 @@ public class EmbeddedServiceDefsUtil {
public static final String EMBEDDED_SERVICEDEF_OZONE_NAME = "ozone";
public static final String EMBEDDED_SERVICEDEF_KUDU_NAME = "kudu";
public static final String EMBEDDED_SERVICEDEF_NESTEDSTRUCTURE_NAME = "nestedstructure";
public static final String EMBEDDED_SERVICEDEF_S3_NAME = "s3";

public static final String PROPERTY_CREATE_EMBEDDED_SERVICE_DEFS = "ranger.service.store.create.embedded.service-defs";

Expand All @@ -94,6 +95,7 @@ public class EmbeddedServiceDefsUtil {
public static final String TRINO_IMPL_CLASS_NAME = "org.apache.ranger.services.trino.RangerServiceTrino";
public static final String OZONE_IMPL_CLASS_NAME = "org.apache.ranger.services.ozone.RangerServiceOzone";
public static final String KUDU_IMPL_CLASS_NAME = "org.apache.ranger.services.kudu.RangerServiceKudu";
public static final String S3_IMPL_CLASS_NAME = "org.apache.ranger.services.s3.RangerServiceS3";

private static EmbeddedServiceDefsUtil instance = new EmbeddedServiceDefsUtil();

Expand Down Expand Up @@ -121,6 +123,7 @@ public class EmbeddedServiceDefsUtil {
private RangerServiceDef ozoneServiceDef;
private RangerServiceDef kuduServiceDef;
private RangerServiceDef nestedStructureServiveDef;
private RangerServiceDef s3ServiceDef;

private RangerServiceDef tagServiceDef;

Expand Down Expand Up @@ -171,6 +174,7 @@ public void init(ServiceStore store) {
ozoneServiceDef = getOrCreateServiceDef(store, EMBEDDED_SERVICEDEF_OZONE_NAME);
kuduServiceDef = getOrCreateServiceDef(store, EMBEDDED_SERVICEDEF_KUDU_NAME);
nestedStructureServiveDef = getOrCreateServiceDef(store, EMBEDDED_SERVICEDEF_NESTEDSTRUCTURE_NAME);
s3ServiceDef = getOrCreateServiceDef(store, EMBEDDED_SERVICEDEF_S3_NAME);

// Ensure that tag service def is updated with access types of all service defs
store.updateTagServiceDefForAccessTypes();
Expand Down Expand Up @@ -260,6 +264,8 @@ public long getElasticsearchServiceDefId() {

public long getNestedStructureServiceDefId() { return getId(nestedStructureServiveDef); }

public long getS3ServiceDefId() { return getId(s3ServiceDef); }

public RangerServiceDef getEmbeddedServiceDef(String defType) throws Exception {
RangerServiceDef serviceDef=null;
if(StringUtils.isNotEmpty(defType)){
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"id": 202,
"name": "s3",
"displayName": "s3",
"implClass": "org.apache.ranger.services.s3.RangerServiceS3",
"label": "S3",
"description": "S3 Repository",
"guid": "b8290b7f-6f69-44a9-89cc-06b6975ea676",
"resources": [
{
"itemId": 1,
"name": "endpoint",
"type": "string",
"level": 10,
"mandatory": true,
"lookupSupported": true,
"recursiveSupported": false,
"excludesSupported": true,
"matcher": "org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher",
"matcherOptions": {
"wildCard": "true",
"ignoreCase": "false"
},
"label": "S3 Endpoint",
"description": "S3 Endpoint",
"isValidLeaf": false
},
{
"itemId": 2,
"name": "bucket",
"type": "string",
"level": 20,
"parent": "endpoint",
"mandatory": true,
"lookupSupported": true,
"recursiveSupported": false,
"excludesSupported": true,
"matcher": "org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher",
"matcherOptions": {
"wildCard": "true",
"ignoreCase": "false"
},
"label": "S3 Bucket",
"description": "S3 Bucket",
"isValidLeaf": true
},
{
"itemId": 3,
"name": "path",
"type": "string",
"level": 30,
"parent": "bucket",
"mandatory": true,
"lookupSupported": true,
"recursiveSupported": false,
"excludesSupported": true,
"matcher": "org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher",
"matcherOptions": {
"wildCard": "true",
"ignoreCase": "false"
},
"label": "S3 Path",
"description": "S3 Path",
"isValidLeaf": true
}
],
"accessTypes": [
{
"itemId": 1,
"name": "read",
"label": "Read"
},
{
"itemId": 2,
"name": "write",
"label": "Write"
}
],
"configs": [
{
"itemId": 1,
"name": "endpoint",
"type": "string",
"mandatory": true,
"label": "S3 Endpoint",
"description": "S3 Endpoint URL (e.g., s3://host:port)"
},
{
"itemId": 2,
"name": "accesskey",
"type": "string",
"mandatory": true,
"label": "Access Key",
"description": "AWS Access Key"
},
{
"itemId": 3,
"name": "password",
"type": "password",
"mandatory": true,
"label": "Secret Key",
"description": "AWS Secret Key"
},
{
"itemId": 4,
"name": "region",
"type": "string",
"mandatory": false,
"defaultValue": "eu-west-1",
"label": "AWS Region",
"description": "AWS Region (default: eu-west-1)"
}
],
"policyConditions": [
{
"itemId": 1,
"name": "ip-range",
"evaluator": "org.apache.ranger.plugin.conditionevaluator.RangerIpMatcher",
"label": "IP Address Range",
"description": "IP Address Range"
}
],
"dataMaskDef": {},
"rowFilterDef": {}
}

10 changes: 9 additions & 1 deletion dev-support/ranger-docker/scripts/create-ranger-services.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ def service_not_exists(service):
'ozone.om.http-address': 'http://om:9874',
'hadoop.security.authentication': 'simple'}})

services = [hdfs, yarn, hive, hbase, kafka, knox, kms, trino, ozone]
s3 = RangerService({'name': 'dev_s3',
'type': 's3',
'displayName': 'dev_s3',
'configs': {'endpoint': 's3://localhost:9000',
'accesskey': 'minioadmin',
'password': 'minioadmin',
'region': 'us-east-1'}})

services = [hdfs, yarn, hive, hbase, kafka, knox, kms, trino, ozone, s3]
for service in services:
try:
if service_not_exists(service):
Expand Down
35 changes: 35 additions & 0 deletions distro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,12 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.arenadata.ranger</groupId>
<artifactId>ranger-s3-plugin</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.arenadata.ranger</groupId>
<artifactId>ranger-schema-registry-plugin</artifactId>
Expand Down Expand Up @@ -997,6 +1003,35 @@
</plugins>
</build>
</profile>
<profile>
<id>ranger-s3-plugin</id>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${assembly.plugin.version}</version>
<configuration>
<finalName>ranger-${project.version}</finalName>
<outputDirectory>../target</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<skipAssembly>false</skipAssembly>
<descriptors>
<descriptor>src/main/assembly/plugin-s3.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ranger-schema-registry-plugin</id>
<build>
Expand Down
138 changes: 138 additions & 0 deletions distro/src/main/assembly/plugin-s3.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<assembly>
<id>s3-plugin</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>${project.parent.name}-${project.version}-s3-plugin</baseDirectory>
<includeBaseDirectory>true</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>io.arenadata.ranger:ranger-plugins-installer</include>
<include>io.arenadata.ranger:credentialbuilder</include>
</includes>
<binaries>
<outputDirectory>install/lib</outputDirectory>
<includeDependencies>true</includeDependencies>
<unpack>false</unpack>
<includes>
<include>com.fasterxml.woodstox:woodstox-core:jar:${fasterxml.woodstox.version}</include>
<include>com.kstruct:gethostname4j</include>
<include>com.sun.jersey:jersey-bundle</include>
<include>com.sun.jersey:jersey-core</include>
<include>com.sun.jersey:jersey-client</include>
<include>commons-cli:commons-cli</include>
<include>commons-collections:commons-collections</include>
<include>commons-configuration:commons-configuration:jar:${commons.configuration1.version}</include>
<include>commons-io:commons-io:jar:${commons.io.version}</include>
<include>commons-lang:commons-lang</include>
<include>commons-logging:commons-logging:jar:${commons.logging.version}</include>
<include>net.java.dev.jna:jna</include>
<include>net.java.dev.jna:jna-platform</include>
<include>org.apache.commons:commons-compress:jar:${commons.compress.version}</include>
<include>org.apache.commons:commons-configuration2:jar:${commons.configuration.version}</include>
<include>org.apache.commons:commons-lang3:jar:${commons.lang3.version}</include>
<include>org.apache.hadoop:hadoop-auth:jar:${hadoop.version}</include>
<include>org.apache.hadoop:hadoop-common:jar:${hadoop.version}</include>
<include>org.apache.hadoop.thirdparty:hadoop-shaded-guava:jar:${hadoop-shaded-guava.version}</include>
<include>org.codehaus.woodstox:stax2-api:jar:${codehaus.woodstox.stax2api.version}</include>
<include>org.slf4j:slf4j-api:jar:${slf4j-api.version}</include>
</includes>
</binaries>
</moduleSet>

<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>io.arenadata.ranger:ranger-plugins-audit</include>
<include>io.arenadata.ranger:ranger-plugins-cred</include>
<include>io.arenadata.ranger:ranger-plugins-common</include>
<include>io.arenadata.ranger:ranger-s3-plugin</include>
</includes>
<binaries>
<outputDirectory>lib</outputDirectory>
<includeDependencies>true</includeDependencies>
<unpack>false</unpack>
<directoryMode>755</directoryMode>
<fileMode>644</fileMode>
<includes>
<include>org.apache.commons:commons-configuration2:jar:${commons.configuration.version}</include>
<include>commons-configuration:commons-configuration:jar:${commons.configuration1.version}</include>
<include>org.apache.httpcomponents:httpmime:jar:${httpcomponents.httpmime.version}</include>
<include>org.apache.httpcomponents:httpclient:jar:${httpcomponents.httpclient.version}</include>
<include>org.apache.httpcomponents:httpcore:jar:${httpcomponents.httpcore.version}</include>
<include>com.sun.jersey:jersey-core</include>
<include>com.sun.jersey:jersey-client</include>
<include>com.sun.jersey:jersey-bundle</include>
<include>com.fasterxml.jackson.core:jackson-annotations:jar:${fasterxml.jackson.version}</include>
<include>com.fasterxml.jackson.core:jackson-core:jar:${fasterxml.jackson.version}</include>
<include>com.fasterxml.jackson.core:jackson-databind:jar:${fasterxml.jackson.version}</include>
<include>com.amazonaws:aws-java-sdk-s3</include>
<include>com.amazonaws:aws-java-sdk-core</include>
<include>com.amazonaws:aws-java-sdk-kms</include>
<include>com.amazonaws:jmespath-java</include>
<include>commons-lang:commons-lang</include>
<include>com.kstruct:gethostname4j</include>
<include>net.java.dev.jna:jna</include>
<include>net.java.dev.jna:jna-platform</include>
</includes>
</binaries>
</moduleSet>
</moduleSets>

<fileSets>
<fileSet>
<outputDirectory>install/conf.templates/enable</outputDirectory>
<directory>../plugin-s3/conf</directory>
<excludes>
<exclude>*.sh</exclude>
</excludes>
<fileMode>700</fileMode>
</fileSet>
<fileSet>
<outputDirectory></outputDirectory>
<directory>${project.build.outputDirectory}</directory>
<includes>
<include>version</include>
</includes>
<fileMode>444</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.parent.basedir}/agents-common/scripts/enable-agent.sh</source>
<outputDirectory></outputDirectory>
<destName>enable-s3-plugin.sh</destName>
<fileMode>755</fileMode>
</file>
<file>
<source>${project.parent.basedir}/agents-common/scripts/enable-agent.sh</source>
<outputDirectory></outputDirectory>
<destName>disable-s3-plugin.sh</destName>
<fileMode>755</fileMode>
</file>
<file>
<source>${project.parent.basedir}/security-admin/scripts/ranger_credential_helper.py</source>
<outputDirectory></outputDirectory>
<fileMode>755</fileMode>
</file>
</files>
</assembly>
Loading
Loading