Skip to content

Commit

Permalink
Merge pull request #2694 from atlanhq/revert-2693-cve-fix-ms
Browse files Browse the repository at this point in the history
Revert "CVE fix Metastore"
  • Loading branch information
sumandas0 authored Dec 21, 2023
2 parents bb7a619 + d318910 commit 36a3972
Show file tree
Hide file tree
Showing 243 changed files with 36,589 additions and 13 deletions.
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ RUN apt-get update \
netcat \
curl \
&& cd / \
&& mkdir /opt/ranger-atlas-plugin \
&& export MAVEN_OPTS="-Xms2g -Xmx2g" \
&& export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" \
&& tar -xzvf /apache-atlas-3.0.0-SNAPSHOT-server.tar.gz -C /opt \
Expand All @@ -56,12 +57,22 @@ COPY atlas-hub/repair_index.py /opt/apache-atlas/bin/
RUN chmod +x /opt/apache-atlas/bin/repair_index.py

COPY atlas-hub/atlas_start.py.patch atlas-hub/atlas_config.py.patch /opt/apache-atlas/bin/
COPY atlas-hub/pre-conf/ranger/lib/ /opt/apache-atlas/libext/
COPY atlas-hub/pre-conf/ranger/install/conf.templates/enable/ /opt/apache-atlas/conf/
COPY atlas-hub/pre-conf/atlas-log4j.xml /opt/apache-atlas/conf/
COPY atlas-hub/pre-conf/atlas-log4j2.xml /opt/apache-atlas/conf/
COPY atlas-hub/pre-conf/atlas-auth/ /opt/apache-atlas/conf/
COPY atlas-hub/pre-conf/ranger/ /opt/ranger-atlas-plugin/
COPY atlas-hub/env_change.sh /

RUN curl https://repo1.maven.org/maven2/org/jolokia/jolokia-jvm/1.6.2/jolokia-jvm-1.6.2-agent.jar -o /opt/apache-atlas/libext/jolokia-jvm-agent.jar

RUN cd /opt/apache-atlas/bin \
&& sed "s~ATLAS_INSTALL_DIR~/opt/apache-atlas~g" /opt/ranger-atlas-plugin/install.properties > /tmp/install.properties \
&& cp /tmp/install.properties /opt/ranger-atlas-plugin/install.properties \
&& chmod +x /env_change.sh
# && patch -b -f < atlas_start.py.patch \
# && patch -b -f < atlas_config.py.patch \

RUN cd /opt/apache-atlas/bin \
&& ./atlas_start.py -setup || true

Expand Down
77 changes: 77 additions & 0 deletions addons/falcon-bridge-shim/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>apache-atlas</artifactId>
<groupId>org.apache.atlas</groupId>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<artifactId>falcon-bridge-shim</artifactId>
<description>Apache Atlas Falcon Bridge Shim Module</description>
<name>Apache Atlas Falcon Bridge Shim</name>
<packaging>jar</packaging>

<dependencies>
<!-- Logging -->
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-plugin-classloader</artifactId>
</dependency>

<dependency>
<groupId>org.apache.falcon</groupId>
<artifactId>falcon-common</artifactId>
<version>${falcon.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.spark</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
/**
* 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.
*/

package org.apache.atlas.falcon.service;


import org.apache.atlas.plugin.classloader.AtlasPluginClassLoader;
import org.apache.falcon.FalconException;
import org.apache.falcon.entity.store.ConfigurationStore;
import org.apache.falcon.entity.v0.Entity;
import org.apache.falcon.service.ConfigurationChangeListener;
import org.apache.falcon.service.FalconService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Falcon hook used for atlas entity registration.
*/
public class AtlasService implements FalconService, ConfigurationChangeListener {
private static final Logger LOG = LoggerFactory.getLogger(AtlasService.class);

private static final String ATLAS_PLUGIN_TYPE = "falcon";
private static final String ATLAS_FALCON_HOOK_IMPL_CLASSNAME = "org.apache.atlas.falcon.service.AtlasService";

private AtlasPluginClassLoader atlasPluginClassLoader = null;
private FalconService falconServiceImpl = null;
private ConfigurationChangeListener configChangeListenerImpl = null;

public AtlasService() {
this.initialize();
}

@Override
public String getName() {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.getName()");
}

String ret = null;

try {
activatePluginClassLoader();
ret = falconServiceImpl.getName();
} finally {
deactivatePluginClassLoader();
}

if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.getName()");
}

return ret;
}

@Override
public void init() throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.init()");
}

try {
activatePluginClassLoader();

ConfigurationStore.get().registerListener(this);

falconServiceImpl.init();
} finally {
deactivatePluginClassLoader();
}

if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.init()");
}
}

@Override
public void destroy() throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.destroy()");
}

try {
activatePluginClassLoader();

ConfigurationStore.get().unregisterListener(this);

falconServiceImpl.destroy();
} finally {
deactivatePluginClassLoader();
}

if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.destroy()");
}
}

@Override
public void onAdd(Entity entity) throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onAdd({})", entity);
}

try {
activatePluginClassLoader();
configChangeListenerImpl.onAdd(entity);
} finally {
deactivatePluginClassLoader();
}

if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onAdd({})", entity);
}
}

@Override
public void onRemove(Entity entity) throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onRemove({})", entity);
}

try {
activatePluginClassLoader();
configChangeListenerImpl.onRemove(entity);
} finally {
deactivatePluginClassLoader();
}

if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onRemove({})", entity);
}
}

@Override
public void onChange(Entity entity, Entity entity1) throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onChange({}, {})", entity, entity1);
}

try {
activatePluginClassLoader();
configChangeListenerImpl.onChange(entity, entity1);
} finally {
deactivatePluginClassLoader();
}

if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onChange({}, {})", entity, entity1);
}
}

@Override
public void onReload(Entity entity) throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onReload({})", entity);
}

try {
activatePluginClassLoader();
configChangeListenerImpl.onReload(entity);
} finally {
deactivatePluginClassLoader();
}

if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onReload({})", entity);
}
}

private void initialize() {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.initialize()");
}

try {
atlasPluginClassLoader = AtlasPluginClassLoader.getInstance(ATLAS_PLUGIN_TYPE, this.getClass());

Class<?> cls = Class.forName(ATLAS_FALCON_HOOK_IMPL_CLASSNAME, true, atlasPluginClassLoader);

activatePluginClassLoader();

Object atlasService = cls.newInstance();

falconServiceImpl = (FalconService) atlasService;
configChangeListenerImpl = (ConfigurationChangeListener) atlasService;
} catch (Exception excp) {
LOG.error("Error instantiating Atlas hook implementation", excp);
} finally {
deactivatePluginClassLoader();
}

if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.initialize()");
}
}

private void activatePluginClassLoader() {
if (atlasPluginClassLoader != null) {
atlasPluginClassLoader.activate();
}
}

private void deactivatePluginClassLoader() {
if (atlasPluginClassLoader != null) {
atlasPluginClassLoader.deactivate();
}
}
}
Loading

0 comments on commit 36a3972

Please sign in to comment.