Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

java.lang.SecurityException: class "javax.servlet.FilterRegistration"'s s #1

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
de499c4
SENTRY-1196: Remove SNAPSHOT from branch-1.7.0 (Hao Hao, Reviewed by:…
haohaoc Apr 12, 2016
a0b9682
SENTRY-1195: Update change log for 1.7.0 release (Hao Hao, Reviewed b…
haohaoc Apr 12, 2016
6141aa5
SENTRY-1192: Add SQL upgrade script for 1.7.0. (Dapeng Sun, reviewed …
Apr 13, 2016
265f529
SENTRY-589: Enable dist for authorization V2 (Dapeng Sun, Reviewed by…
haohaoc Apr 13, 2016
d78fc2c
SENTRY-1173: Sentry TLP: Update pom.xml to new git location (Sravya T…
haohaoc Apr 16, 2016
39d38a5
SENTRY-1162: Add shell for Sentry Kafka integration (Ashish K Singh, …
haohaoc Apr 16, 2016
00951b4
SENTRY-1188: Fixes to get kerberos auth work. (Ashish K Singh, Review…
haohaoc Apr 16, 2016
9d175ce
SENTRY-1217: NPE for list_sentry_privileges_by_authorizable when acti…
haohaoc Apr 27, 2016
03d9f17
SENTRY-1198: Cherry-pick Sentry-589,1162,1188,1160,1217,1173 and upda…
haohaoc Apr 27, 2016
23d7272
SENTRY-1160: Enable dist for kafka-binding. (Dapeng Sun, reviewed by …
sundapeng Apr 13, 2016
0f6b31b
SENTRY-1121: Update Jetty version (Colm O hEigeartaigh, Reviewed by:S…
haohaoc May 2, 2016
40d387d
SENTRY-1234: JDO exception for list_sentry_privileges_by_authorizable…
haohaoc May 5, 2016
735543e
SENTRY-1227: Cherry-pick Sentry-1121, Sentry-1234 and updated the cha…
haohaoc Jun 2, 2016
88de717
Updating versions to 1.7.1
coheigea Dec 13, 2017
4022de1
SENTRY-2101 - Upgrade 1.7 branch to use libthrift 0.9.3. Colm O hEige…
coheigea Dec 18, 2017
c95c871
Updating year in NOTICE
coheigea Dec 18, 2017
81d094d
Adding release notes
coheigea Dec 18, 2017
e98bc77
Adding signing configuration
coheigea Dec 24, 2017
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
250 changes: 207 additions & 43 deletions CHANGELOG.txt

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions DISCLAIMER.txt

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@

================================================================================

The Apache Sentry (incubating) distribution includes the following sources/binaries.
The Apache Sentry distribution includes the following sources/binaries.
The use of these sources/binaries is subject to the terms and conditions of
their respective licenses.

Expand Down
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Apache Sentry
Copyright 2014 The Apache Software Foundation
Copyright 2017 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Expand Down
41 changes: 34 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ limitations under the License.

<groupId>org.apache.sentry</groupId>
<artifactId>sentry</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
<description>Sentry component</description>
<name>Sentry</name>
<packaging>pom</packaging>
Expand All @@ -43,9 +43,9 @@ limitations under the License.
</licenses>

<scm>
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-sentry.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-sentry.git</developerConnection>
<url>https://git-wip-us.apache.org/repos/asf/incubator-sentry</url>
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/sentry.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/sentry.git</developerConnection>
<url>https://git-wip-us.apache.org/repos/asf/sentry</url>
</scm>

<properties>
Expand Down Expand Up @@ -74,11 +74,11 @@ limitations under the License.
<hive.version>1.1.0</hive.version>
<jackson.version>1.8.8</jackson.version>
<jdo-api.version>3.0.1</jdo-api.version>
<jettyVersion>7.6.16.v20140903</jettyVersion>
<jettyVersion>8.1.19.v20160209</jettyVersion>
<joda-time.version>2.5</joda-time.version>
<junit.version>4.10</junit.version>
<libfb303.version>0.9.2</libfb303.version>
<libthrift.version>0.9.2</libthrift.version>
<libfb303.version>0.9.3</libfb303.version>
<libthrift.version>0.9.3</libthrift.version>
<log4j.version>1.2.16</log4j.version>
<maven.antrun.plugin.version>1.7</maven.antrun.plugin.version>
<maven.eclipse.plugin.version>2.9</maven.eclipse.plugin.version>
Expand Down Expand Up @@ -888,6 +888,33 @@ limitations under the License.
<buildtools.dir>${basedir}/../../build-tools</buildtools.dir>
</properties>
</profile>
<profile>
<id>sign-artifacts</id>
<activation>
<property>
<name>sign-artifacts</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

</profiles>

Expand Down
2 changes: 1 addition & 1 deletion sentry-binding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-binding</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-binding/sentry-binding-hive-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-binding</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-binding-hive-common</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-binding/sentry-binding-hive-v2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-binding</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-binding-hive-v2</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-binding/sentry-binding-hive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-binding</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-binding-hive</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-binding/sentry-binding-kafka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-binding</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-binding-kafka</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void configure(java.util.Map<String, ?> configs) {
}
LOG.info("Configuring Sentry KafkaAuthorizer: " + sentry_site);
final KafkaAuthBindingSingleton instance = KafkaAuthBindingSingleton.getInstance();
instance.configure(this.kafkaServiceInstanceName, this.requestorName, sentry_site);
instance.configure(this.kafkaServiceInstanceName, this.requestorName, sentry_site, configs);
this.binding = instance.getAuthBinding();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.sentry.kafka.binding;

import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -34,6 +35,8 @@
import kafka.network.RequestChannel;
import kafka.security.auth.Operation;
import kafka.security.auth.Resource;
import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.kafka.common.KafkaException;
import org.apache.kafka.common.security.auth.KafkaPrincipal;
import org.apache.sentry.SentryUserException;
Expand All @@ -55,6 +58,7 @@
import org.apache.sentry.provider.db.generic.service.thrift.TAuthorizable;
import org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege;
import org.apache.sentry.provider.db.generic.service.thrift.TSentryRole;
import org.apache.sentry.service.thrift.ServiceConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.Option;
Expand All @@ -64,25 +68,31 @@
import scala.collection.JavaConversions;
import scala.collection.immutable.Map;

import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION;

public class KafkaAuthBinding {

private static final Logger LOG = LoggerFactory.getLogger(KafkaAuthBinding.class);
private static final String COMPONENT_TYPE = AuthorizationComponent.KAFKA;
private static final String COMPONENT_NAME = COMPONENT_TYPE;

private static Boolean kerberosInit;

private final Configuration authConf;
private final AuthorizationProvider authProvider;
private final KafkaActionFactory actionFactory = KafkaActionFactory.getInstance();

private ProviderBackend providerBackend;
private String instanceName;
private String requestorName;
private java.util.Map<String, ?> kafkaConfigs;


public KafkaAuthBinding(String instanceName, String requestorName, Configuration authConf) throws Exception {
public KafkaAuthBinding(String instanceName, String requestorName, Configuration authConf, java.util.Map<String, ?> kafkaConfigs) throws Exception {
this.instanceName = instanceName;
this.requestorName = requestorName;
this.authConf = authConf;
this.kafkaConfigs = kafkaConfigs;
this.authProvider = createAuthProvider();
}

Expand Down Expand Up @@ -118,6 +128,28 @@ private AuthorizationProvider createAuthProvider() throws Exception {
+ providerBackendName);
}

// Initiate kerberos via UserGroupInformation if required
if (ServiceConstants.ServerConfig.SECURITY_MODE_KERBEROS.equals(authConf.get(ServiceConstants.ServerConfig.SECURITY_MODE))
&& kafkaConfigs != null) {
String keytabProp = kafkaConfigs.get(AuthzConfVars.AUTHZ_KEYTAB_FILE_NAME.getVar()).toString();
String principalProp = kafkaConfigs.get(AuthzConfVars.AUTHZ_PRINCIPAL_NAME.getVar()).toString();
if (keytabProp != null && principalProp != null) {
String actualHost = kafkaConfigs.get(AuthzConfVars.AUTHZ_PRINCIPAL_HOSTNAME.getVar()).toString();
if (actualHost != null) {
principalProp = SecurityUtil.getServerPrincipal(principalProp, actualHost);
}
initKerberos(keytabProp, principalProp);
} else {
LOG.debug("Could not initialize Kerberos.\n" +
AuthzConfVars.AUTHZ_KEYTAB_FILE_NAME.getVar() + " set to " + kafkaConfigs.get(AuthzConfVars.AUTHZ_KEYTAB_FILE_NAME.getVar()).toString() + "\n" +
AuthzConfVars.AUTHZ_PRINCIPAL_NAME.getVar() + " set to " + kafkaConfigs.get(AuthzConfVars.AUTHZ_PRINCIPAL_NAME.getVar()).toString());
}
} else {
LOG.debug("Could not initialize Kerberos as no kafka config provided. " +
AuthzConfVars.AUTHZ_KEYTAB_FILE_NAME.getVar() + " and " + AuthzConfVars.AUTHZ_PRINCIPAL_NAME.getVar() +
" are required configs to be able to initialize Kerberos");
}

// Instantiate the configured providerBackend
Constructor<?> providerBackendConstructor =
Class.forName(providerBackendName)
Expand Down Expand Up @@ -495,4 +527,36 @@ private String getName(RequestChannel.Session session) {
return principalName;
}
}

/**
* Initialize kerberos via UserGroupInformation. Will only attempt to login
* during the first request, subsequent calls will have no effect.
*/
private void initKerberos(String keytabFile, String principal) {
if (keytabFile == null || keytabFile.length() == 0) {
throw new IllegalArgumentException("keytabFile required because kerberos is enabled");
}
if (principal == null || principal.length() == 0) {
throw new IllegalArgumentException("principal required because kerberos is enabled");
}
synchronized (KafkaAuthBinding.class) {
if (kerberosInit == null) {
kerberosInit = new Boolean(true);
// let's avoid modifying the supplied configuration, just to be conservative
final Configuration ugiConf = new Configuration();
ugiConf.set(HADOOP_SECURITY_AUTHENTICATION, ServiceConstants.ServerConfig.SECURITY_MODE_KERBEROS);
UserGroupInformation.setConfiguration(ugiConf);
LOG.info(
"Attempting to acquire kerberos ticket with keytab: {}, principal: {} ",
keytabFile, principal);
try {
UserGroupInformation.loginUserFromKeytab(principal, keytabFile);
} catch (IOException ioe) {
throw new RuntimeException("Failed to login user with Principal: " + principal +
" and Keytab file: " + keytabFile, ioe);
}
LOG.info("Got Kerberos ticket");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;

import org.apache.sentry.kafka.conf.KafkaAuthConf;
import org.slf4j.Logger;
Expand Down Expand Up @@ -56,10 +57,10 @@ private KafkaAuthConf loadAuthzConf(String sentry_site) {
return kafkaAuthConf;
}

public void configure(String instanceName, String requestorName, String sentry_site) {
public void configure(String instanceName, String requestorName, String sentry_site, Map<String, ?> kafkaConfigs) {
try {
kafkaAuthConf = loadAuthzConf(sentry_site);
binding = new KafkaAuthBinding(instanceName, requestorName, kafkaAuthConf);
binding = new KafkaAuthBinding(instanceName, requestorName, kafkaAuthConf, kafkaConfigs);
log.info("KafkaAuthBinding created successfully");
} catch (Exception ex) {
log.error("Unable to create KafkaAuthBinding", ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class KafkaAuthConf extends Configuration {
public static final String KAFKA_SUPER_USERS = "kafka.superusers";
public static final String KAFKA_SERVICE_INSTANCE_NAME = "sentry.kafka.service.instance";
public static final String KAFKA_SERVICE_USER_NAME = "sentry.kafka.service.user.name";
public static final String KAFKA_PRINCIPAL_HOSTNAME = "sentry.kafka.principal.hostname";
public static final String KAFKA_PRINCIPAL_NAME = "sentry.kafka.kerberos.principal";
public static final String KAFKA_KEYTAB_FILE_NAME = "sentry.kafka.keytab.file";

/**
* Config setting definitions
Expand All @@ -40,7 +43,10 @@ public static enum AuthzConfVars {
AUTHZ_PROVIDER_BACKEND("sentry.kafka.provider.backend", SentryGenericProviderBackend.class.getName()),
AUTHZ_POLICY_ENGINE("sentry.kafka.policy.engine", SimpleKafkaPolicyEngine.class.getName()),
AUTHZ_INSTANCE_NAME(KAFKA_SERVICE_INSTANCE_NAME, "kafka"),
AUTHZ_SERVICE_USER_NAME(KAFKA_SERVICE_USER_NAME, "kafka");
AUTHZ_SERVICE_USER_NAME(KAFKA_SERVICE_USER_NAME, "kafka"),
AUTHZ_PRINCIPAL_HOSTNAME(KAFKA_PRINCIPAL_HOSTNAME, null),
AUTHZ_PRINCIPAL_NAME(KAFKA_PRINCIPAL_NAME, null),
AUTHZ_KEYTAB_FILE_NAME(KAFKA_KEYTAB_FILE_NAME, null);

private final String varName;
private final String defaultVal;
Expand Down
2 changes: 1 addition & 1 deletion sentry-binding/sentry-binding-solr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-binding</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-binding-solr</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-binding/sentry-binding-sqoop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-binding</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-binding-sqoop</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-core/sentry-core-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-core</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-core-common</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-core/sentry-core-model-db/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-core</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-core-model-db</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-core/sentry-core-model-indexer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-core</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-core-model-indexer</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-core/sentry-core-model-kafka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-core</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-core-model-kafka</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sentry-core/sentry-core-model-search/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-core</artifactId>
<version>1.7.0-incubating-SNAPSHOT</version>
<version>1.7.1</version>
</parent>

<artifactId>sentry-core-model-search</artifactId>
Expand Down
Loading