Skip to content

Commit e87d263

Browse files
committed
RANGER-5455: Move Kerberos related scripts to base image
1 parent de9303f commit e87d263

3 files changed

Lines changed: 71 additions & 0 deletions

File tree

docker/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ COPY docker/create_users_and_groups.sh ${RANGER_SCRIPTS}
5656
RUN chmod +x /home/ranger/scripts/create_users_and_groups.sh && \
5757
./home/ranger/scripts/create_users_and_groups.sh
5858

59+
# Create opensearch user and group
60+
RUN groupadd -g 3002 opensearch && \
61+
useradd -u 3002 -g opensearch -G hadoop -s /bin/bash opensearch
62+
63+
# copy kerberos utility scripts
64+
COPY docker/krb/* ${RANGER_SCRIPTS}
65+
RUN chmod 755 ${RANGER_SCRIPTS}/wait_for_keytab.sh && \
66+
chmod 755 ${RANGER_SCRIPTS}/wait_for_testusers_keytab.sh
67+
5968
# change ownerships
6069
RUN chown -R ranger:ranger /home/ranger /opt/ranger
6170

docker/krb/wait_for_keytab.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
RETRY_COUNT="${KEYTAB_RETRY_COUNT:-5}"
20+
KEYTABS_DIR=/etc/keytabs
21+
22+
KEYTAB=${KEYTABS_DIR}/$1
23+
24+
for i in {1..RETRY_COUNT}; do
25+
if [ -f ${KEYTAB} ]
26+
then
27+
break
28+
else
29+
echo [INFO] "Waiting for keytab ${KEYTAB}.."
30+
sleep 5
31+
fi
32+
done
33+
34+
if [ -f ${KEYTAB} ]
35+
then
36+
echo "[INFO] Found keytab ${KEYTAB}"
37+
exit 0
38+
else
39+
echo "[ERROR] Keytab not found: ${KEYTAB}"
40+
exit 1
41+
fi
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
${RANGER_SCRIPTS}/wait_for_keytab.sh testuser1.keytab
20+
${RANGER_SCRIPTS}/wait_for_keytab.sh testuser2.keytab
21+
${RANGER_SCRIPTS}/wait_for_keytab.sh testuser3.keytab

0 commit comments

Comments
 (0)