1
- # =============================================================================
2
- # jdeathe/centos-ssh
3
- #
4
- # CentOS-6 6.10 x86_64 - SCL/EPEL/IUS Repos. / Supervisor / OpenSSH.
5
- #
6
- # =============================================================================
7
1
FROM centos:centos6.10
8
2
3
+ ARG RELEASE_VERSION="1.10.0"
4
+
9
5
# -----------------------------------------------------------------------------
10
- # Base Install + Import the RPM GPG keys for Repositories
6
+ # - Import the RPM GPG keys for repositories
7
+ # - Base install of required packages
8
+ # - Install supervisord (used to run more than a single process)
9
+ # - Install supervisor-stdout to allow output of services started by
10
+ # supervisord to be easily inspected with "docker logs".
11
11
# -----------------------------------------------------------------------------
12
12
RUN rpm --rebuilddb \
13
13
&& rpm --import \
@@ -44,6 +44,11 @@ RUN rpm --rebuilddb \
44
44
policycoreutils \
45
45
sysvinit-tools \
46
46
&& yum clean all \
47
+ && easy_install \
48
+ 'supervisor == 3.3.5' \
49
+ 'supervisor-stdout == 0.1.1' \
50
+ && mkdir -p \
51
+ /var/log/supervisor/ \
47
52
&& find /usr/share \
48
53
-type f \
49
54
-regextype posix-extended \
@@ -55,44 +60,6 @@ RUN rpm --rebuilddb \
55
60
&& rm -rf /{root,tmp,var/cache/{ldconfig,yum}}/* \
56
61
&& > /etc/sysconfig/i18n
57
62
58
- # -----------------------------------------------------------------------------
59
- # Install supervisord (required to run more than a single process in a container)
60
- # Note: EPEL package lacks /usr/bin/pidproxy
61
- # We require supervisor-stdout to allow output of services started by
62
- # supervisord to be easily inspected with "docker logs".
63
- # -----------------------------------------------------------------------------
64
- RUN easy_install \
65
- 'supervisor == 3.3.4' \
66
- 'supervisor-stdout == 0.1.1' \
67
- && mkdir -p \
68
- /var/log/supervisor/
69
-
70
- # -----------------------------------------------------------------------------
71
- # UTC Timezone & Networking
72
- # -----------------------------------------------------------------------------
73
- RUN ln -sf \
74
- /usr/share/zoneinfo/UTC \
75
- /etc/localtime \
76
- && echo "NETWORKING=yes" > /etc/sysconfig/network
77
-
78
- # -----------------------------------------------------------------------------
79
- # Configure SSH for non-root public key authentication
80
- # -----------------------------------------------------------------------------
81
- RUN sed -i \
82
- -e 's~^PasswordAuthentication yes~PasswordAuthentication no~g' \
83
- -e 's~^#PermitRootLogin yes~PermitRootLogin no~g' \
84
- -e 's~^#UseDNS yes~UseDNS no~g' \
85
- -e 's~^\( .*\) /usr/libexec/openssh/sftp-server$~\1 internal-sftp~g' \
86
- /etc/ssh/sshd_config
87
-
88
- # -----------------------------------------------------------------------------
89
- # Enable the wheel sudoers group
90
- # -----------------------------------------------------------------------------
91
- RUN sed -i \
92
- -e 's~^# %wheel\t ALL=(ALL)\t ALL~%wheel\t ALL=(ALL) ALL~g' \
93
- -e 's~\( .*\) requiretty$~#\1 requiretty~' \
94
- /etc/sudoers
95
-
96
63
# -----------------------------------------------------------------------------
97
64
# Copy files into place
98
65
# -----------------------------------------------------------------------------
@@ -102,40 +69,38 @@ ADD src/usr/sbin \
102
69
/usr/sbin/
103
70
ADD src/opt/scmi \
104
71
/opt/scmi/
105
- ADD src/etc/systemd/system \
106
- /etc/systemd/system/
107
- ADD src/etc/services-config/ssh/authorized_keys \
108
- src/etc/services-config/ssh/sshd-bootstrap.conf \
109
- src/etc/services-config/ssh/sshd-bootstrap.env \
110
- /etc/services-config/ssh/
111
- ADD src/etc/services-config/supervisor/supervisord.conf \
112
- /etc/services-config/supervisor/
113
- ADD src/etc/services-config/supervisor/supervisord.d \
114
- /etc/services-config/supervisor/supervisord.d/
72
+ ADD src/etc \
73
+ /etc/
115
74
116
- RUN mkdir -p \
117
- /etc/supervisord.d/ \
118
- && cp -pf \
119
- /etc/ssh/sshd_config \
120
- /etc/services-config/ssh/ \
121
- && ln -sf \
122
- /etc/services-config/ssh/sshd_config \
75
+ # -----------------------------------------------------------------------------
76
+ # Provisioning
77
+ # - UTC Timezone
78
+ # - Networking
79
+ # - Configure SSH defaults for non-root public key authentication
80
+ # - Enable the wheel sudoers group
81
+ # - Replace placeholders with values in systemd service unit template
82
+ # - Set permissions
83
+ # -----------------------------------------------------------------------------
84
+ RUN ln -sf \
85
+ /usr/share/zoneinfo/UTC \
86
+ /etc/localtime \
87
+ && echo "NETWORKING=yes" \
88
+ > /etc/sysconfig/network \
89
+ && sed -i \
90
+ -e 's~^PasswordAuthentication yes~PasswordAuthentication no~g' \
91
+ -e 's~^#PermitRootLogin yes~PermitRootLogin no~g' \
92
+ -e 's~^#UseDNS yes~UseDNS no~g' \
93
+ -e 's~^\( .*\) /usr/libexec/openssh/sftp-server$~\1 internal-sftp~g' \
123
94
/etc/ssh/sshd_config \
124
- && ln -sf \
125
- /etc/services-config/ssh/sshd-bootstrap.conf \
126
- /etc/sshd-bootstrap.conf \
127
- && ln -sf \
128
- /etc/services-config/ssh/sshd-bootstrap.env \
129
- /etc/sshd-bootstrap.env \
130
- && ln -sf \
131
- /etc/services-config/supervisor/supervisord.conf \
132
- /etc/supervisord.conf \
133
- && ln -sf \
134
- /etc/services-config/supervisor/supervisord.d/sshd-wrapper.conf \
135
- /etc/supervisord.d/sshd-wrapper.conf \
136
- && ln -sf \
137
- /etc/services-config/supervisor/supervisord.d/sshd-bootstrap.conf \
138
- /etc/supervisord.d/sshd-bootstrap.conf \
95
+ && sed -i \
96
+ -e 's~^# %wheel\t ALL=(ALL)\t ALL~%wheel\t ALL=(ALL) ALL~g' \
97
+ -e 's~\( .*\) requiretty$~#\1 requiretty~' \
98
+ /etc/sudoers \
99
+ && sed -i \
100
+ -e "s~{{RELEASE_VERSION}}~${RELEASE_VERSION}~g" \
101
+ /etc/systemd/system/centos-ssh@.service \
102
+ && chmod 644 \
103
+ /etc/{sshd-bootstrap.{conf,env},supervisord.conf,supervisord.d/sshd-{bootstrap,wrapper}.conf} \
139
104
&& chmod 700 \
140
105
/usr/{bin/healthcheck,sbin/{scmi,sshd-{bootstrap,wrapper}}}
141
106
@@ -158,12 +123,12 @@ ENV SSH_AUTHORIZED_KEYS="" \
158
123
SSH_USER_ID="500:500" \
159
124
SSH_USER_PASSWORD="" \
160
125
SSH_USER_PASSWORD_HASHED="false" \
126
+ SSH_USER_PRIVATE_KEY="" \
161
127
SSH_USER_SHELL="/bin/bash"
162
128
163
129
# -----------------------------------------------------------------------------
164
130
# Set image metadata
165
131
# -----------------------------------------------------------------------------
166
- ARG RELEASE_VERSION="1.9.1"
167
132
LABEL \
168
133
maintainer="James Deathe <james.deathe@gmail.com>" \
169
134
install="docker run \
@@ -195,7 +160,7 @@ jdeathe/centos-ssh:${RELEASE_VERSION} \
195
160
org.deathe.description="CentOS-6 6.10 x86_64 - SCL, EPEL and IUS Repositories / Supervisor / OpenSSH."
196
161
197
162
HEALTHCHECK \
198
- --interval=0.5s \
163
+ --interval=1s \
199
164
--timeout=1s \
200
165
--retries=5 \
201
166
CMD ["/usr/bin/healthcheck" ]
0 commit comments