Skip to content

Commit ae9f814

Browse files
committed
RANGER-5373: update HBase container for Kerberos authentication - apache#5
1 parent 3a93709 commit ae9f814

21 files changed

+132
-64
lines changed

dev-support/ranger-docker/Dockerfile.ranger-hadoop

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ COPY ./downloads/hadoop-${HADOOP_VERSION}.tar.gz /home/ranger/dist/
3131
COPY ./scripts/ranger-hadoop-setup.sh /home/ranger/scripts/
3232
COPY ./scripts/ranger-hadoop.sh /home/ranger/scripts/
3333
COPY ./scripts/ranger-hadoop-mkdir.sh /home/ranger/scripts/
34+
COPY ./scripts/ranger-hadoop-healthcheck.sh /home/ranger/scripts/
3435
COPY ./scripts/ranger-hdfs-plugin-install.properties /home/ranger/scripts/
3536
COPY ./scripts/ranger-yarn-plugin-install.properties /home/ranger/scripts/
3637
COPY ./scripts/core-site.xml /home/ranger/scripts/
@@ -49,6 +50,9 @@ RUN tar xvfz /home/ranger/dist/hadoop-${HADOOP_VERSION}.tar.gz --directory=/opt/
4950
rm -f /home/ranger/dist/ranger-${YARN_PLUGIN_VERSION}-yarn-plugin.tar.gz && \
5051
cp -f /home/ranger/scripts/ranger-yarn-plugin-install.properties /opt/ranger/ranger-yarn-plugin/install.properties && \
5152
chmod 744 ${RANGER_SCRIPTS}/ranger-hadoop-setup.sh ${RANGER_SCRIPTS}/ranger-hadoop.sh ${RANGER_SCRIPTS}/ranger-hadoop-mkdir.sh && \
53+
useradd -g hadoop -ms /bin/bash healthcheck && \
54+
chmod 744 ${RANGER_SCRIPTS}/ranger-hadoop-healthcheck.sh && \
55+
chown healthcheck:hadoop ${RANGER_SCRIPTS}/ranger-hadoop-healthcheck.sh && \
5256
apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y krb5-user && mkdir -p /etc/keytabs && \
5357
chown hdfs:hadoop ${RANGER_SCRIPTS}/ranger-hadoop-mkdir.sh
5458

dev-support/ranger-docker/Dockerfile.ranger-hbase

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ COPY ./scripts/ranger-hbase-setup.sh /home/ranger/scripts/
3030
COPY ./scripts/ranger-hbase.sh /home/ranger/scripts/
3131
COPY ./scripts/ranger-hbase-plugin-install.properties /home/ranger/scripts/
3232
COPY ./scripts/hbase-site.xml /home/ranger/scripts/
33+
COPY ./scripts/core-site.xml /home/ranger/scripts/
3334

3435
RUN tar xvfz /home/ranger/dist/hbase-${HBASE_VERSION}-bin.tar.gz --directory=/opt/ && \
3536
ln -s /opt/hbase-${HBASE_VERSION} /opt/hbase && \

dev-support/ranger-docker/config/kdc/krb5.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[libdefaults]
22
default_realm = EXAMPLE.COM
3+
dns_canonicalize_hostname = false
34
dns_lookup_kdc = false
45
dns_lookup_realm = false
56
ticket_lifetime = 24h

dev-support/ranger-docker/docker-compose.ranger-hadoop.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ services:
2424
ranger:
2525
condition: service_started
2626
healthcheck:
27-
test: ["CMD-SHELL", "kinit -kt /opt/hadoop/keytabs/healthcheck.keytab healthcheck/ranger-hadoop[email protected] && hdfs dfs -ls /hbase > /dev/null"]
28-
interval: 1m30s
27+
test: 'su -c "/home/ranger/scripts/ranger-hadoop-healthcheck.sh" healthcheck'
28+
interval: 15s
2929
timeout: 10s
3030
retries: 30
31-
start_period: 40s
31+
start_period: 1m30s
3232
environment:
3333
- HADOOP_VERSION
3434
- HDFS_PLUGIN_VERSION

dev-support/ranger-docker/docker-compose.ranger-kdc.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

dev-support/ranger-docker/docker-compose.ranger-ozone.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ services:
22
datanode:
33
image: ${OZONE_RUNNER_IMAGE}:${OZONE_RUNNER_VERSION}
44
container_name: ozone-datanode
5+
hostname: datanode.rangernw
56
volumes:
67
- ./downloads/ozone-${OZONE_VERSION}:/opt/hadoop
78
networks:
@@ -24,7 +25,7 @@ services:
2425
- OZONE_PLUGIN_VERSION=${OZONE_PLUGIN_VERSION}
2526
image: ranger-ozone:latest
2627
container_name: ozone-om
27-
hostname: om
28+
hostname: om.rangernw
2829
volumes:
2930
- ./downloads/ozone-${OZONE_VERSION}:/opt/hadoop
3031
- ./dist/ranger-${OZONE_PLUGIN_VERSION}-ozone-plugin:/opt/hadoop/ranger-ozone-plugin
@@ -50,7 +51,7 @@ services:
5051
scm:
5152
image: ${OZONE_RUNNER_IMAGE}:${OZONE_RUNNER_VERSION}
5253
container_name: ozone-scm
53-
hostname: scm
54+
hostname: scm.rangernw
5455
volumes:
5556
- ./downloads/ozone-${OZONE_VERSION}:/opt/hadoop
5657
networks:

dev-support/ranger-docker/docker-compose.ranger.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ services:
1919
ports:
2020
- "6080:6080"
2121
depends_on:
22+
ranger-kdc:
23+
condition: service_started
2224
ranger-zk:
2325
condition: service_started
2426
ranger-db:
@@ -33,6 +35,26 @@ services:
3335
command:
3436
- /home/ranger/scripts/ranger.sh
3537

38+
ranger-kdc:
39+
build:
40+
context: .
41+
dockerfile: Dockerfile.ranger-kdc
42+
args:
43+
- REALM=${KERBEROS_REALM}
44+
- KDC_HOST=${KERBEROS_KDC_HOST}
45+
- MASTER_PASSWORD=${KERBEROS_MASTER_PASSWORD}
46+
- ADMIN_PRINCIPAL=${KERBEROS_ADMIN_PRINCIPAL}
47+
- ADMIN_PASSWORD=${KERBEROS_ADMIN_PASSWORD}
48+
image: ranger-kdc:latest
49+
container_name: ranger-kdc
50+
hostname: ranger-kdc.rangernw
51+
networks:
52+
- ranger
53+
ports:
54+
- "88:88"
55+
- "88:88/udp"
56+
- "749:749"
57+
3658
ranger-db:
3759
extends:
3860
service: ${RANGER_DB_TYPE}
@@ -48,8 +70,6 @@ services:
4870
image: ranger-zk
4971
container_name: ranger-zk
5072
hostname: ranger-zk.rangernw
51-
volumes:
52-
- ./config/kdc/keytabs:/etc/keytabs
5373
networks:
5474
- ranger
5575
ports:
@@ -67,8 +87,6 @@ services:
6787
image: ranger-solr
6888
container_name: ranger-solr
6989
hostname: ranger-solr.rangernw
70-
volumes:
71-
- ./config/kdc/keytabs:/etc/keytabs
7290
networks:
7391
- ranger
7492
ports:

dev-support/ranger-docker/scripts/core-site.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<configuration>
33
<property>
44
<name>fs.defaultFS</name>
5-
<value>hdfs://ranger-hadoop:9000</value>
5+
<value>hdfs://ranger-hadoop.rangernw:9000</value>
66
</property>
77
<property>
88
<name>hadoop.security.authentication</name>

dev-support/ranger-docker/scripts/create-ranger-services.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def service_not_exists(service):
1515

1616
hdfs = RangerService({'name': 'dev_hdfs', 'type': 'hdfs',
1717
'configs': {'username': 'hdfs', 'password': 'hdfs',
18-
'fs.default.name': 'hdfs://ranger-hadoop:9000',
18+
'fs.default.name': 'hdfs://ranger-hadoop.rangernw:9000',
1919
'hadoop.security.authentication': 'simple',
2020
'hadoop.security.authorization': 'true',
2121
'policy.download.auth.users': 'hdfs',
@@ -26,7 +26,7 @@ def service_not_exists(service):
2626
hive = RangerService({'name': 'dev_hive', 'type': 'hive',
2727
'configs': {'username': 'hive', 'password': 'hive',
2828
'jdbc.driverClassName': 'org.apache.hive.jdbc.HiveDriver',
29-
'jdbc.url': 'jdbc:hive2://ranger-hive:10000',
29+
'jdbc.url': 'jdbc:hive2://ranger-hive.rangernw:10000',
3030
'hadoop.security.authorization': 'true',
3131
'policy.download.auth.users': 'hive',
3232
'tag.download.auth.users': 'hive',
@@ -42,15 +42,15 @@ def service_not_exists(service):
4242
'ranger.plugin.kafka.policy.refresh.synchronous':'true'}})
4343

4444
knox = RangerService({'name': 'dev_knox', 'type': 'knox',
45-
'configs': {'username': 'knox', 'password': 'knox', 'knox.url': 'https://ranger-knox:8443',
45+
'configs': {'username': 'knox', 'password': 'knox', 'knox.url': 'https://ranger-knox.rangernw:8443',
4646
'policy.download.auth.users': 'knox',
4747
'tag.download.auth.users': 'knox',
4848
'userstore.download.auth.users': 'knox',
4949
'ranger.plugin.knox.policy.refresh.synchronous':'true'}})
5050

5151
yarn = RangerService({'name': 'dev_yarn', 'type': 'yarn',
5252
'configs': {'username': 'yarn', 'password': 'yarn',
53-
'yarn.url': 'http://ranger-hadoop:8088',
53+
'yarn.url': 'http://ranger-hadoop.rangernw:8088',
5454
'policy.download.auth.users': 'yarn',
5555
'tag.download.auth.users': 'yarn',
5656
'userstore.download.auth.users': 'yarn',
@@ -62,7 +62,7 @@ def service_not_exists(service):
6262
'hbase.security.authentication': 'simple',
6363
'hadoop.security.authorization': 'true',
6464
'hbase.zookeeper.property.clientPort': '2181',
65-
'hbase.zookeeper.quorum': 'ranger-zk',
65+
'hbase.zookeeper.quorum': 'ranger-zk.rangernw',
6666
'zookeeper.znode.parent': '/hbase',
6767
'policy.download.auth.users': 'hbase',
6868
'tag.download.auth.users': 'hbase',
@@ -71,7 +71,7 @@ def service_not_exists(service):
7171

7272
kms = RangerService({'name': 'dev_kms', 'type': 'kms',
7373
'configs': {'username': 'keyadmin', 'password': 'rangerR0cks!',
74-
'provider': 'http://ranger-kms:9292',
74+
'provider': 'http://ranger-kms.rangernw:9292',
7575
'policy.download.auth.users': 'rangerkms',
7676
'tag.download.auth.users': 'rangerkms',
7777
'userstore.download.auth.users': 'rangerkms',
@@ -83,7 +83,7 @@ def service_not_exists(service):
8383
'username': 'trino',
8484
'password': 'trino',
8585
'jdbc.driverClassName': 'io.trino.jdbc.TrinoDriver',
86-
'jdbc.url': 'jdbc:trino://ranger-trino:8080',
86+
'jdbc.url': 'jdbc:trino://ranger-trino.rangernw:8080',
8787
'policy.download.auth.users': 'trino',
8888
'tag.download.auth.users': 'trino',
8989
'userstore.download.auth.users': 'trino',

dev-support/ranger-docker/scripts/hbase-site.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,32 @@
4949
<name>hbase.zookeeper.quorum</name>
5050
<value>ranger-zk.rangernw</value>
5151
</property>
52+
<property>
53+
<name>hbase.security.authentication</name>
54+
<value>kerberos</value>
55+
</property>
56+
<property>
57+
<name>hbase.security.authorization</name>
58+
<value>true</value>
59+
</property>
60+
<property>
61+
<name>hbase.master.kerberos.principal</name>
62+
<value>hbase/[email protected]</value>
63+
</property>
64+
<property>
65+
<name>hbase.master.keytab.file</name>
66+
<value>/opt/hbase/keytabs/hbase.keytab</value>
67+
</property>
68+
<property>
69+
<name>hbase.regionserver.kerberos.principal</name>
70+
<value>hbase/[email protected]</value>
71+
</property>
72+
<property>
73+
<name>hbase.regionserver.keytab.file</name>
74+
<value>/opt/hbase/keytabs/hbase.keytab</value>
75+
</property>
76+
<property>
77+
<name>hbase.coprocessor.region.classes</name>
78+
<value>org.apache.hadoop.hbase.security.token.TokenProvider</value>
79+
</property>
5280
</configuration>

0 commit comments

Comments
 (0)