forked from apache/airflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Kerberos Auth for PrestoHook (apache#10488)
- Loading branch information
Showing
27 changed files
with
775 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,16 +17,52 @@ | |
--- | ||
version: "2.2" | ||
services: | ||
kerberos: | ||
image: apache/airflow:krb5-kdc-server-2020.08.28 | ||
hostname: kerberos | ||
kdc-server-example-com: | ||
image: apache/airflow:krb5-kdc-server-2020.10.08 | ||
hostname: krb5-kdc-server-example-com | ||
domainname: example.com | ||
networks: | ||
example.com: | ||
ipv4_address: 10.5.0.2 | ||
|
||
volumes: | ||
- kerberos-keytabs:/root/kerberos-keytabs | ||
- /dev/urandom:/dev/random # Required to get non-blocking entropy source | ||
|
||
environment: | ||
- KRB5_TRACE=/dev/stderr | ||
- POST_BOOTSTRAP_COMMAND= | ||
/opt/kerberos-utils/create_admin.sh alice alice; | ||
/opt/kerberos-utils/create_client.sh bob bob /root/kerberos-keytabs/airflow.keytab; | ||
/opt/kerberos-utils/create_service.sh krb5-machine-example-com airflow | ||
/root/kerberos-keytabs/airflow.keytab; | ||
/opt/kerberos-utils/create_service.sh presto HTTP /root/kerberos-keytabs/presto.keytab; | ||
|
||
|
||
airflow: | ||
hostname: krb5-machine-example-com | ||
domainname: example.com | ||
networks: | ||
example.com: | ||
ipv4_address: 10.5.0.1 | ||
default: {} | ||
|
||
depends_on: | ||
- kerberos | ||
- kdc-server-example-com | ||
volumes: | ||
- kerberos-keytabs:/root/kerberos-keytabs | ||
- ../dockerfiles/krb5-kdc-server/krb5.conf:/etc/krb5.conf:ro | ||
environment: | ||
- INTEGRATION_KERBEROS=true | ||
- KRB5_CONFIG=/etc/krb5.conf | ||
- KRB5_KTNAME=/etc/airflow.keytab | ||
- KRB5_KTNAME=/root/kerberos-keytabs/airflow.keytab | ||
- KRB5_TRACE=/dev/stderr | ||
- AIRFLOW__KERBEROS__KEYTAB=/root/kerberos-keytabs/airflow.keytab | ||
- [email protected] | ||
|
||
volumes: | ||
kerberos-keytabs: | ||
|
||
networks: | ||
example.com: | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,55 @@ | ||
# Dockerfile - kdc-server | ||
# | ||
# 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. | ||
|
||
FROM debian:buster-slim | ||
# see docker-compose.yml | ||
|
||
ARG AIRFLOW_KRB5KDCSERVER_VERSION | ||
ARG COMMIT_SHA | ||
FROM centos:7 | ||
|
||
# environment variables | ||
ENV DEBIAN_FRONTEND noninteractive | ||
# build environment | ||
WORKDIR /root/ | ||
|
||
# Kerberos server | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
dumb-init \ | ||
ntp \ | ||
python-dev \ | ||
python-pip \ | ||
python-wheel \ | ||
python-setuptools \ | ||
python-pkg-resources \ | ||
krb5-admin-server \ | ||
krb5-kdc \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& mkdir -p /var/log/supervisord/ | ||
# Dev stuff | ||
RUN yum -y install curl wget | ||
|
||
RUN mkdir /app/ | ||
# python | ||
RUN curl "https://bootstrap.pypa.io/get-pip.py" -o /tmp/get-pip.py && \ | ||
python /tmp/get-pip.py && \ | ||
rm /tmp/get-pip.py | ||
|
||
# Supervisord | ||
RUN pip install supervisor==3.3.4 | ||
|
||
COPY ./krb-conf/server/kdc.conf /etc/krb5kdc/kdc.conf | ||
COPY ./krb-conf/server/kadm5.acl /etc/krb5kdc/kadm5.acl | ||
COPY ./krb-conf/client/krb5.conf /etc/krb5.conf | ||
COPY ./start_kdc.sh /entrypoint | ||
# supervisord | ||
COPY ./supervisord.conf /etc/supervisord.conf | ||
|
||
WORKDIR /app | ||
RUN pip install supervisor==3.3.3 && \ | ||
mkdir -p /var/log/supervisord/ | ||
|
||
# kerberos server | ||
RUN yum -y install ntp krb5-server krb5-libs | ||
|
||
# kerberos server configuration | ||
ENV KRB5_CONFIG=/etc/krb5.conf | ||
ENV KRB5_KDC_PROFILE=/var/kerberos/krb5kdc/kdc.conf | ||
RUN mkdir -pv /var/kerberos/krb5kdc/ | ||
COPY kdc.conf /var/kerberos/krb5kdc/kdc.conf | ||
COPY kadm5.acl /var/kerberos/krb5kdc/kadm5.acl | ||
COPY krb5.conf /etc/krb5.conf | ||
RUN mkdir -pv /var/log/kerberos/ && \ | ||
touch /var/log/kerberos/kadmin.log && \ | ||
touch /var/log/kerberos/krb5lib.log && \ | ||
touch /var/log/kerberos/krb5.log && \ | ||
kdb5_util -r EXAMPLE.COM -P krb5 create -s | ||
|
||
# kerberos utils | ||
COPY utils /opt/kerberos-utils/ | ||
|
||
# supervisord configuration | ||
COPY supervisord.conf /etc/supervisord.conf | ||
|
||
# entrypoint | ||
COPY entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
LABEL org.apache.airflow.component="krb5-kdc-server" | ||
LABEL org.apache.airflow.airflow_krb5_kdc_server.version="${AIRFLOW_KRB5KDCSERVER_VERSION}" | ||
LABEL org.apache.airflow.krb5-kdc-server.core.version="krb5" | ||
LABEL org.apache.airflow.airflow_bats.version="${AIRFLOW_KRB5KDCSERVER_VERSION}" | ||
LABEL org.apache.airflow.commit_sha="${COMMIT_SHA}" | ||
LABEL maintainer="Apache Airflow Community <[email protected]>" | ||
|
||
RUN chmod a+x /entrypoint | ||
|
||
EXPOSE 88 | ||
# when container is starting | ||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/entrypoint"] | ||
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# | ||
#!/bin/bash | ||
|
||
# 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 | ||
|
@@ -15,4 +16,14 @@ | |
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
*/[email protected] * | ||
|
||
set -xeuo pipefail | ||
|
||
( | ||
export | ||
sleep 2; | ||
if [[ -v POST_BOOTSTRAP_COMMAND ]]; then | ||
bash -c "$POST_BOOTSTRAP_COMMAND" | ||
fi | ||
) & | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# /var/kerberos/krb5kdc/kadm5.acl -- Kerberos V5 general configuration. | ||
# | ||
# This file is the access control list for krb5 administration. | ||
# When this file is edited run /etc/init.d/krb5-admin-server restart to activate | ||
# One common way to set up Kerberos administration is to allow any principal | ||
# ending in /admin is given full administrative rights. | ||
# To enable this, uncomment the following line: | ||
*/[email protected] * |
Oops, something went wrong.