-
Notifications
You must be signed in to change notification settings - Fork 34
[DCOS-40151] Added Sentry to Kerberized Hive image #397
base: sh-dcos-39050
Are you sure you want to change the base?
Changes from all commits
642d666
c20fcc7
05349aa
ccbd2a7
0ff9e96
fa014d0
a786737
c16194b
f6ab334
c44421e
bba9a8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
FROM cdh5-hive | ||
|
||
ENV SENTRY_VERSION 1.5.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question. Do we ever want to use the non kerberized Hive? If not, we could just drop this all into a single Dockerfile. |
||
ENV SENTRY_HOME /usr/local/sentry | ||
|
||
# download sentry | ||
RUN curl -L http://archive.cloudera.com/cdh${CDH_VERSION}/cdh/${CDH_VERSION}/sentry-${SENTRY_VERSION}-cdh${CDH_EXACT_VERSION}.tar.gz \ | ||
| tar -xzC /usr/local && \ | ||
cd /usr/local && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be |
||
ln -s apache-sentry-${SENTRY_VERSION}-cdh${CDH_EXACT_VERSION}-bin/ sentry | ||
|
||
# copy kerberized hadoop config files | ||
ADD templates/core-site.xml.template $HADOOP_PREFIX/etc/hadoop/core-site.xml.template | ||
ADD templates/hdfs-site.xml.template $HADOOP_PREFIX/etc/hadoop/hdfs-site.xml.template | ||
|
@@ -9,6 +18,14 @@ ADD templates/yarn-site.xml.template $HADOOP_PREFIX/etc/hadoop/yarn-site.xml.tem | |
ADD templates/hive-site.xml.template /opt/files/ | ||
ADD templates/hive-site.xml.template $HIVE_CONF/hive-site.xml.template | ||
|
||
# sentry config files | ||
ADD templates/sentry-site.xml.hive-client.template /usr/local/hive/conf/sentry-site.xml.template | ||
ADD templates/sentry-site.xml.server.template /usr/local/sentry/conf/sentry-site.xml.template | ||
|
||
# hive / sentry test script | ||
ADD scripts/grant-hive-privileges.sh /etc/grant-hive-privileges.sh | ||
RUN chmod 700 /etc/grant-hive-privileges.sh | ||
|
||
# krb5.conf | ||
ADD conf/krb5.conf /etc/ | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
[ | ||
"hostname", | ||
"IS", | ||
"10.0.0.114" | ||
"1.2.3.4" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this used at all? |
||
] | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
export HADOOP_HOME=/usr/local/hadoop | ||
|
||
# Create a user "alice" since Sentry authorization relies on the Linux user and group information | ||
/usr/sbin/useradd alice | ||
|
||
# Grant permissions to user “alice” | ||
echo "Grant permissions to user alice ..." | ||
kdestroy | ||
kinit -k -t /usr/local/hadoop/etc/hadoop/hdfs.keytab hive/${HOSTNAME}@LOCAL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this have to be the |
||
cat <<EOF >grant_alice.sql | ||
CREATE ROLE test_role; | ||
GRANT ROLE test_role to GROUP alice; | ||
GRANT ROLE test_role to GROUP root; | ||
GRANT ALL on DATABASE default to ROLE test_role WITH GRANT OPTION; | ||
EOF | ||
/usr/local/hive/bin/beeline -u "jdbc:hive2://localhost:10000/default;principal=hive/${HOSTNAME}@LOCAL" -f grant_alice.sql | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this port ( |
||
|
||
# Log back in as hdfs | ||
kdestroy | ||
kinit -k -t /usr/local/hadoop/etc/hadoop/hdfs.keytab hdfs@LOCAL |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<configuration> | ||
<property> | ||
<name>sentry.hive.provider</name> | ||
<value>org.apache.sentry.provider.file.HadoopGroupResourceAuthorizationProvider</value> | ||
</property> | ||
<property> | ||
<name>sentry.hive.server</name> | ||
<value>server1</value> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this name specified? |
||
</property> | ||
<property> | ||
<name>sentry.service.client.server.rpc-port</name> | ||
<value>8038</value> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this port mapped to the Marathon JSON requirements somewhere too? |
||
</property> | ||
<property> | ||
<name>sentry.service.client.server.rpc-address</name> | ||
<value>localhost</value> | ||
</property> | ||
|
||
<!-- Properties required for setting the DB provider --> | ||
<property> | ||
<name>sentry.hive.provider.backend</name> | ||
<value>org.apache.sentry.provider.db.SimpleDBProviderBackend</value> | ||
</property> | ||
<property> | ||
<name>sentry.service.server.principal</name> | ||
<value>sentry/{{HOSTNAME}}@LOCAL</value> | ||
</property> | ||
<property> | ||
<name>sentry.metastore.service.users</name> | ||
<value>hive</value> | ||
</property> | ||
</configuration> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<configuration> | ||
<property> | ||
<name>sentry.hive.server</name> | ||
<value>server1</value> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is |
||
</property> | ||
<property> | ||
<name>sentry.store.jdbc.url</name> | ||
<value>jdbc:derby:;databaseName=metastore_db;create=true</value> | ||
</property> | ||
<property> | ||
<name>sentry.service.server.principal</name> | ||
<value>sentry/{{HOSTNAME}}@LOCAL</value> | ||
</property> | ||
<property> | ||
<name>sentry.service.server.keytab</name> | ||
<value>/usr/local/hadoop/etc/hadoop/hdfs.keytab</value> | ||
</property> | ||
<property> | ||
<name>sentry.service.admin.group</name> | ||
<value>hive</value> | ||
</property> | ||
<property> | ||
<name>sentry.service.allow.connect</name> | ||
<value>hive</value> | ||
</property> | ||
<property> | ||
<name>sentry.store.jdbc.user</name> | ||
<value>sentry</value> | ||
</property> | ||
<property> | ||
<name>sentry.store.jdbc.password</name> | ||
<value>test</value> | ||
</property> | ||
</configuration> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in the
if
block?