brooklyn.entity.container.docker.SshdDockerfile Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brooklyn-clocker-docker Show documentation
Show all versions of brooklyn-clocker-docker Show documentation
Clocker Brooklyn entities and locations for Docker integration.
[#ftl]
#
# Copyright 2014-2015 by Cloudsoft Corporation Limited
#
# Licensed 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.
#
# sshd
#
# VERSION 0.0.4
FROM ${fullyQualifiedImageName}
MAINTAINER Cloudsoft "[email protected]"
# setup locale
RUN type locale-gen ; if [ "$?" -eq "0" ] ; then locale-gen en_US.UTF-8 ; fi
# setup root account
RUN echo 'root:${entity.password}' | chpasswd
# install sshd
RUN type apt-get ; \
if [ "$?" -eq "0" ] ; then \
apt-get update ; \
apt-get install -y openssh-server ; \
else \
yum -y install openssh-server ; \
fi ; \
mkdir /var/run/sshd ; \
chmod 600 /var/run/sshd ;
# configure sshd to allow login
RUN sed -i.bk 's/PermitRootLogin.*$/PermitRootLogin yes/g' /etc/ssh/sshd_config ; \
echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
EXPOSE 22
CMD [ "/usr/sbin/sshd", "-D" ]