From 524868c632b23385145d140e5e6abab82cda50cf Mon Sep 17 00:00:00 2001 From: Shaun Smekel Date: Fri, 5 Aug 2016 07:44:42 +1000 Subject: Add dockerfiles for keystone fernet This adds the docker aspects of fernet key bootstrapping as well as distributed key rotation. - Bootstrapping is handled in the same way as keystone bootstrap. - A new keystone-fernet and keystone-ssh container is created to allow the nodes to communicate with each other (taken from nova-ssh). - The keystone-fernet is a keystone container with crontab installed. This will handle key rotations through keystone-manage and trigger an rsync to push new tokens to other nodes. The Ansible component is implemented in: https://review.openstack.org/#/c/349366 Change-Id: Id610e00e8c63c7f1bc0974c0aa1b3f44c18e1019 Partially-Implements: blueprint keystone-fernet-token Partially-Implements: blueprint third-party-plugin-support --- docker/keystone/keystone-ssh/Dockerfile.j2 | 21 +++++++++++++++++++++ docker/keystone/keystone-ssh/extend_start.sh | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 docker/keystone/keystone-ssh/Dockerfile.j2 create mode 100644 docker/keystone/keystone-ssh/extend_start.sh (limited to 'docker/keystone/keystone-ssh') diff --git a/docker/keystone/keystone-ssh/Dockerfile.j2 b/docker/keystone/keystone-ssh/Dockerfile.j2 new file mode 100644 index 000000000..2f5389742 --- /dev/null +++ b/docker/keystone/keystone-ssh/Dockerfile.j2 @@ -0,0 +1,21 @@ +FROM {{ namespace }}/{{ image_prefix }}keystone-base:{{ tag }} +MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + +{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} + {% set keystone_ssh_packages = ['openssh-server'] %} +{% elif base_distro in ['ubuntu', 'debian'] %} + {% set keystone_ssh_packages = ['openssh-server'] %} + +RUN mkdir -p /var/run/sshd \ + && chmod 0755 /var/run/sshd + +{% endif %} +{{ macros.install_packages(keystone_ssh_packages | customizable("packages")) }} + +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start + +{% block keystone_ssh_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} diff --git a/docker/keystone/keystone-ssh/extend_start.sh b/docker/keystone/keystone-ssh/extend_start.sh new file mode 100644 index 000000000..23744cead --- /dev/null +++ b/docker/keystone/keystone-ssh/extend_start.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [[ ! -L /dev/log ]]; then + ln -sf /var/lib/kolla/heka/log /dev/log +fi + +SSH_HOST_KEY_TYPES=( "rsa" "dsa" "ecdsa" "ed25519" ) + +for key_type in ${SSH_HOST_KEY_TYPES[@]}; do + KEY_PATH=/etc/ssh/ssh_host_${key_type}_key + if [[ ! -f "${KEY_PATH}" ]]; then + ssh-keygen -q -t ${key_type} -f ${KEY_PATH} -N "" + fi +done + +mkdir -p /var/lib/keystone/.ssh + +if [[ $(stat -c %U:%G /var/lib/keystone/.ssh) != "keystone:keystone" ]]; then + sudo chown keystone: /var/lib/keystone/.ssh +fi -- cgit v1.2.3