Skip to content

Commit 8c0699a

Browse files
committed
Updated Dockerfile for CentOS and generate SSH host keys
1 parent 2892432 commit 8c0699a

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

docker/src/main/resources/brooklyn/entity/container/docker/SshdDockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ RUN type apt-get ; \
3838
mkdir /var/run/sshd ; \
3939
chmod 600 /var/run/sshd ;
4040

41+
# create host keys if absent
42+
RUN if [ -f "/etc/ssh/ssh_host_dsa_key" -a -f "/etc/ssh/ssh_host_rsa_key" ] ; then \
43+
echo "SSH host private keys already exists" ; \
44+
else \
45+
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa ; \
46+
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa ; \
47+
fi
48+
4149
# configure sshd to allow login
4250
RUN sed -i.bk 's/PermitRootLogin.*$/PermitRootLogin yes/g' /etc/ssh/sshd_config ; \
4351
echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config

docker/src/main/resources/brooklyn/entity/container/docker/centos/Dockerfile

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17-
# sshd
18-
#
19-
# VERSION 0.0.2
20-
21-
FROM centos
22-
MAINTAINER Cloudsoft "brooklyn@cloudsoftcorp.com"
23-
24-
# install packages
25-
RUN yum -y groupinstall 'Development Tools'
26-
RUN yum -y install sudo openssh-server openssh-clients openssl-devel
27-
28-
# setup root account
29-
RUN ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key && ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key && sed -i "s/#UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config && sed -i "s/UsePAM.*/UsePAM no/g" /etc/ssh/sshd_config
30-
RUN echo 'root:${entity.password}' | chpasswd
31-
32-
# install sshd
33-
RUN chkconfig sshd on
34-
RUN service sshd start
35-
36-
EXPOSE 22
17+
# VERSION 0.0.3
3718

38-
CMD [ "/usr/sbin/sshd", "-D" ]
19+
FROM centos:6.6
20+
MAINTAINER Cloudsoft "brooklyn@cloudsoftcorp.com"

0 commit comments

Comments
 (0)