Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Default ignored files
/shelf/
.idea
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
.idea
*.iml
37 changes: 37 additions & 0 deletions centos-8/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM centos:8
MAINTAINER Iuliana Cosmina "iuliana@cloudsoft.io"

# CONTAINER_SERVICE_VERSION_BELOW
LABEL version="2.0.0-SNAPSHOT"

# setup root account with temporary password (optionally overridden in docker-entrypoint.sh)
RUN echo 'root:p4ssw0rd' | chpasswd

# install sshd and other frequently used packages
RUN yum -y install openssh-server which sudo; \
mkdir /var/run/sshd ; \
chmod 600 /var/run/sshd

# create host keys if absent
RUN if [ -f "/etc/ssh/ssh_host_dsa_key" -a -f "/etc/ssh/ssh_host_rsa_key" ] ; then \
echo "SSH host private keys already exists" ; \
else \
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa ; \
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa ; \
fi

# 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; \
echo 'RSAAuthentication 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 || true

COPY docker-entrypoint.sh /
RUN chmod 700 /docker-entrypoint.sh

EXPOSE 22

ENTRYPOINT ["/docker-entrypoint.sh"]
52 changes: 52 additions & 0 deletions centos-8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
#
# Inspired by https://github.com/kwart/dockerfiles/tree/master/alpine-ext

set -e

echo
echo "Starting CentOS 8 with SSH server"
echo "=============================================="
echo
echo "User 'root' config"
echo "BROOKLYN_ROOT_PASSWORD ${BROOKLYN_ROOT_PASSWORD:+*****}"
echo "BROOKLYN_ROOT_AUTHORIZED_KEY ${BROOKLYN_ROOT_AUTHORIZED_KEY:0:20}"

if [ ! -f "/root/SSH_INITIALIZED_MARKER" ]; then
echo
echo "Configuring SSH"

touch /root/SSH_INITIALIZED_MARKER

# set root password
if [ -n "$BROOKLYN_ROOT_PASSWORD" ]; then
echo
echo "Changing root's password"
echo "root:$BROOKLYN_ROOT_PASSWORD" | chpasswd
elif [ -n "$BROOKLYN_ROOT_AUTHORIZED_KEY" ]; then
echo "Generating and changing root's password"
PWPASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1)
echo "root:$PWPASS" | chpasswd
else
echo "Not changing root password"
fi;

# set root's authorized_keys
if [ -n "$BROOKLYN_ROOT_AUTHORIZED_KEY" ]; then
echo
echo "Adding entry to /root/.ssh/authorized_keys"
mkdir -p /root/.ssh
chmod 700 /root/.ssh/
echo "$BROOKLYN_ROOT_AUTHORIZED_KEY" | tee /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
else
echo "Not adding authorized ssh key"
fi

else
echo
echo "Marked file /root/SSH_INITIALIZED_MARKER exists, so skipping initialisation"
fi

# Run sshd
/usr/sbin/sshd -D
13 changes: 12 additions & 1 deletion ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ubuntu:18.04
MAINTAINER Andrew Kennedy "grkvlt@apache.org"
MAINTAINER Iuliana Cosmina "iuliana@cloudsoft.io"

# CONTAINER_SERVICE_VERSION_BELOW
LABEL version="2.0.0-SNAPSHOT"
Expand All @@ -12,6 +12,7 @@ RUN echo 'root:p4ssw0rd' | chpasswd

# install sshd
RUN apt-get update ; \
apt-get install -y --no-install-recommends apt-utils ;\
apt-get install -y openssh-server sudo; \
mkdir /var/run/sshd ; \
chmod 600 /var/run/sshd
Expand All @@ -34,6 +35,16 @@ RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so
COPY docker-entrypoint.sh /
RUN chmod 700 /docker-entrypoint.sh

# Needed to support install of PostgreSQL 12 and MySQL 5.7
RUN which curl || apt -y install curl
RUN export DEBIAN_FRONTEND=noninteractive
RUN echo exit 0 > /usr/sbin/policy-rc.d
RUN apt-get install -y openssh-server netbase perl libnuma1 psmisc locales locales-all libxslt1.1
RUN ln -fs /usr/share/zoneinfo/Europe/Dublin /etc/localtime
RUN apt-get install -y tzdata
RUN dpkg-reconfigure --frontend noninteractive tzdata
RUN echo "$(date)" >> /tmp/image.info

EXPOSE 22

ENTRYPOINT ["/docker-entrypoint.sh"]