add kerberos docker
This commit is contained in:
parent
17a5020391
commit
f3f5b2709b
40
kerberos/Dockerfile
Normal file
40
kerberos/Dockerfile
Normal file
@ -0,0 +1,40 @@
|
||||
FROM ubuntu:xenial
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
|
||||
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
|
||||
|
||||
RUN sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
|
||||
|
||||
RUN apt clean
|
||||
|
||||
RUN apt update
|
||||
|
||||
RUN apt install -y ntp python-dev python-pip python-wheel python-setuptools python-pkg-resources krb5-admin-server krb5-kdc
|
||||
|
||||
RUN apt install vim -y
|
||||
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN mkdir -p /var/log/supervisord/
|
||||
|
||||
RUN mkdir /app/
|
||||
|
||||
RUN pip install supervisor==4.2.4
|
||||
|
||||
COPY ./server/krb5.conf /etc/krb5kdc/kdc.conf
|
||||
|
||||
COPY ./server/kadm5.acl /etc/krb5kdc/kadm5.acl
|
||||
|
||||
COPY ./client/krb5.conf /etc/krb5.conf
|
||||
|
||||
COPY ./start.sh /app/start.sh
|
||||
|
||||
COPY ./supervisord.conf /etc/supervisord.conf
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
CMD ["/bin/bash", "/app/start.sh"]
|
||||
|
||||
|
18
kerberos/client/krb5.conf
Normal file
18
kerberos/client/krb5.conf
Normal file
@ -0,0 +1,18 @@
|
||||
[logging]
|
||||
default = FILE:/var/log/krb5libs.log
|
||||
kdc = FILE:/var/log/krb5kdc.log
|
||||
admin_server = FILE:/var/log/kadmind.log
|
||||
|
||||
[libdefaults]
|
||||
default_realm = HADOOP.COM
|
||||
dns_lookup_realm = false
|
||||
dns_lookup_kdc = false
|
||||
ticket_lifetime = 24h
|
||||
renew_lifetime = 7d
|
||||
forwardable = true
|
||||
|
||||
[realms]
|
||||
HADOOP.COM = {
|
||||
kdc = krb5-kdc-server:88
|
||||
admin_server = krb5-kdc-server
|
||||
}
|
7
kerberos/run.sh
Executable file
7
kerberos/run.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker stop kerberos
|
||||
|
||||
docker rm kerberos
|
||||
|
||||
docker run -d --name=kerberos kerberos:1.0.0
|
1
kerberos/server/kadm5.acl
Normal file
1
kerberos/server/kadm5.acl
Normal file
@ -0,0 +1 @@
|
||||
*/admin@HADOOP.COM *
|
14
kerberos/server/krb5.conf
Normal file
14
kerberos/server/krb5.conf
Normal file
@ -0,0 +1,14 @@
|
||||
[kdcdefaults]
|
||||
kdc_ports = 88
|
||||
kdc_tcp_ports = 88
|
||||
|
||||
[realms]
|
||||
HADOOP.COM = {
|
||||
#master_key_type = aes256-cts
|
||||
acl_file = /etc/krb5kdc/kadm5.acl
|
||||
dict_file = /usr/share/dict/words
|
||||
admin_keytab = /var/krb5kdc/kadm5.keytab
|
||||
max_renewable_life = 7d 0h 0m 0s
|
||||
supported_enctypes = aes256-cts:normal aes128-cts:normal des3-hmac-sha1:normal arcfour-hmac:normal des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal
|
||||
}
|
||||
|
30
kerberos/start.sh
Executable file
30
kerberos/start.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
FQDN="hadoop.com"
|
||||
ADMIN="admin"
|
||||
PASS="airflow"
|
||||
|
||||
KRB5_KTNAME=/etc/admin.keytab
|
||||
|
||||
cat /etc/hosts
|
||||
|
||||
echo "hostname: ${FQDN}"
|
||||
|
||||
# create kerberos database
|
||||
echo -e "${PASS}\n${PASS}" | kdb5_util create -s
|
||||
|
||||
# create admin
|
||||
echo -e "${PASS}\n${PASS}" | kadmin.local -q "addprinc ${ADMIN}/admin"
|
||||
|
||||
# create airflow
|
||||
echo -e "${PASS}\n${PASS}" | kadmin.local -q "addprinc -randkey airflow"
|
||||
|
||||
echo -e "${PASS}\n${PASS}" | kadmin.local -q "addprinc -randkey airflow/${FQDN}"
|
||||
|
||||
kadmin.local -q "ktadd -k ${KRB5_KTNAME} airflow"
|
||||
|
||||
kadmin.local -q "ktadd -k ${KRB5_KTNAME} airflow/${FQDN}"
|
||||
|
||||
|
||||
/usr/local/bin/supervisord -n -c /etc/supervisord.conf
|
||||
|
23
kerberos/supervisord.conf
Normal file
23
kerberos/supervisord.conf
Normal file
@ -0,0 +1,23 @@
|
||||
[supervisord]
|
||||
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
|
||||
logfile_maxbytes=50MB ; maximum size of logfile before rotation
|
||||
logfile_backups=10 ; number of backed up logfiles
|
||||
loglevel=error ; info, debug, warn, trace
|
||||
pidfile=/var/run/supervisord.pid ; pidfile location
|
||||
nodaemon=false ; run supervisord as a daemon
|
||||
minfds=1024 ; number of startup file descriptors
|
||||
minprocs=200 ; number of process descriptors
|
||||
user=root ; default user
|
||||
childlogdir=/var/log/supervisord/ ; where child log files will live
|
||||
|
||||
[program:krb5-kdc]
|
||||
command=service krb5-kdc start
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
[program:krb5-admin-server]
|
||||
command=service krb5-admin-server start
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
[supervisorctl]
|
Loading…
Reference in New Issue
Block a user