1
- # =============================================================================
2
- # jdeathe/centos-ssh
3
- #
4
- # CentOS-7 7.5.1804 x86_64 - SCL/EPEL/IUS Repos. / Supervisor / OpenSSH.
5
- #
6
- # =============================================================================
7
1
FROM centos:7.5.1804
8
2
3
+ ARG RELEASE_VERSION="2.5.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 \
@@ -25,10 +25,10 @@ RUN rpm --rebuilddb \
25
25
https://centos7.iuscommunity.org/ius-release.rpm \
26
26
openssh-clients-7.4p1-16.el7 \
27
27
openssh-server-7.4p1-16.el7 \
28
- openssl-1.0.2k-12 .el7 \
28
+ openssl-1.0.2k-16 .el7 \
29
29
python-setuptools-0.9.8-7.el7 \
30
- sudo-1.8.19p2-14.el7_5 \
31
- yum-plugin-versionlock-1.1.31-46.el7_5 \
30
+ sudo-1.8.23-3.el7 \
31
+ yum-plugin-versionlock-1.1.31-50.el7 \
32
32
&& yum versionlock add \
33
33
openssh \
34
34
openssh-server \
@@ -37,50 +37,17 @@ RUN rpm --rebuilddb \
37
37
sudo \
38
38
yum-plugin-versionlock \
39
39
&& yum clean all \
40
+ && easy_install \
41
+ 'supervisor == 3.3.5' \
42
+ 'supervisor-stdout == 0.1.1' \
43
+ && mkdir -p \
44
+ /var/log/supervisor/ \
40
45
&& rm -rf /etc/ld.so.cache \
41
46
&& rm -rf /sbin/sln \
42
47
&& rm -rf /usr/{{lib,share}/locale,share/{man,doc,info,cracklib,i18n},{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive} \
43
48
&& rm -rf /{root,tmp,var/cache/{ldconfig,yum}}/* \
44
49
&& > /etc/sysconfig/i18n
45
50
46
- # -----------------------------------------------------------------------------
47
- # Install supervisord (required to run more than a single process in a container)
48
- # Note: EPEL package lacks /usr/bin/pidproxy
49
- # We require supervisor-stdout to allow output of services started by
50
- # supervisord to be easily inspected with "docker logs".
51
- # -----------------------------------------------------------------------------
52
- RUN easy_install \
53
- 'supervisor == 3.3.4' \
54
- 'supervisor-stdout == 0.1.1' \
55
- && mkdir -p \
56
- /var/log/supervisor/
57
-
58
- # -----------------------------------------------------------------------------
59
- # UTC Timezone & Networking
60
- # -----------------------------------------------------------------------------
61
- RUN ln -sf \
62
- /usr/share/zoneinfo/UTC \
63
- /etc/localtime \
64
- && echo "NETWORKING=yes" > /etc/sysconfig/network
65
-
66
- # -----------------------------------------------------------------------------
67
- # Configure SSH for non-root public key authentication
68
- # -----------------------------------------------------------------------------
69
- RUN sed -i \
70
- -e 's~^PasswordAuthentication yes~PasswordAuthentication no~g' \
71
- -e 's~^#PermitRootLogin yes~PermitRootLogin no~g' \
72
- -e 's~^#UseDNS yes~UseDNS no~g' \
73
- -e 's~^\( .*\) /usr/libexec/openssh/sftp-server$~\1 internal-sftp~g' \
74
- /etc/ssh/sshd_config
75
-
76
- # -----------------------------------------------------------------------------
77
- # Enable the wheel sudoers group
78
- # -----------------------------------------------------------------------------
79
- RUN sed -i \
80
- -e 's~^# %wheel\t ALL=(ALL)\t ALL~%wheel\t ALL=(ALL) ALL~g' \
81
- -e 's~\( .*\) requiretty$~#\1 requiretty~' \
82
- /etc/sudoers
83
-
84
51
# -----------------------------------------------------------------------------
85
52
# Copy files into place
86
53
# -----------------------------------------------------------------------------
@@ -90,40 +57,38 @@ ADD src/usr/sbin \
90
57
/usr/sbin/
91
58
ADD src/opt/scmi \
92
59
/opt/scmi/
93
- ADD src/etc/systemd/system \
94
- /etc/systemd/system/
95
- ADD src/etc/services-config/ssh/authorized_keys \
96
- src/etc/services-config/ssh/sshd-bootstrap.conf \
97
- src/etc/services-config/ssh/sshd-bootstrap.env \
98
- /etc/services-config/ssh/
99
- ADD src/etc/services-config/supervisor/supervisord.conf \
100
- /etc/services-config/supervisor/
101
- ADD src/etc/services-config/supervisor/supervisord.d \
102
- /etc/services-config/supervisor/supervisord.d/
60
+ ADD src/etc \
61
+ /etc/
103
62
104
- RUN mkdir -p \
105
- /etc/supervisord.d/ \
106
- && cp -pf \
107
- /etc/ssh/sshd_config \
108
- /etc/services-config/ssh/ \
109
- && ln -sf \
110
- /etc/services-config/ssh/sshd_config \
63
+ # -----------------------------------------------------------------------------
64
+ # Provisioning
65
+ # - UTC Timezone
66
+ # - Networking
67
+ # - Configure SSH defaults for non-root public key authentication
68
+ # - Enable the wheel sudoers group
69
+ # - Replace placeholders with values in systemd service unit template
70
+ # - Set permissions
71
+ # -----------------------------------------------------------------------------
72
+ RUN ln -sf \
73
+ /usr/share/zoneinfo/UTC \
74
+ /etc/localtime \
75
+ && echo "NETWORKING=yes" \
76
+ > /etc/sysconfig/network \
77
+ && sed -i \
78
+ -e 's~^PasswordAuthentication yes~PasswordAuthentication no~g' \
79
+ -e 's~^#PermitRootLogin yes~PermitRootLogin no~g' \
80
+ -e 's~^#UseDNS yes~UseDNS no~g' \
81
+ -e 's~^\( .*\) /usr/libexec/openssh/sftp-server$~\1 internal-sftp~g' \
111
82
/etc/ssh/sshd_config \
112
- && ln -sf \
113
- /etc/services-config/ssh/sshd-bootstrap.conf \
114
- /etc/sshd-bootstrap.conf \
115
- && ln -sf \
116
- /etc/services-config/ssh/sshd-bootstrap.env \
117
- /etc/sshd-bootstrap.env \
118
- && ln -sf \
119
- /etc/services-config/supervisor/supervisord.conf \
120
- /etc/supervisord.conf \
121
- && ln -sf \
122
- /etc/services-config/supervisor/supervisord.d/sshd-wrapper.conf \
123
- /etc/supervisord.d/sshd-wrapper.conf \
124
- && ln -sf \
125
- /etc/services-config/supervisor/supervisord.d/sshd-bootstrap.conf \
126
- /etc/supervisord.d/sshd-bootstrap.conf \
83
+ && sed -i \
84
+ -e 's~^# %wheel\t ALL=(ALL)\t ALL~%wheel\t ALL=(ALL) ALL~g' \
85
+ -e 's~\( .*\) requiretty$~#\1 requiretty~' \
86
+ /etc/sudoers \
87
+ && sed -i \
88
+ -e "s~{{RELEASE_VERSION}}~${RELEASE_VERSION}~g" \
89
+ /etc/systemd/system/centos-ssh@.service \
90
+ && chmod 644 \
91
+ /etc/{sshd-bootstrap.{conf,env},supervisord.conf,supervisord.d/sshd-{bootstrap,wrapper}.conf} \
127
92
&& chmod 700 \
128
93
/usr/{bin/healthcheck,sbin/{scmi,sshd-{bootstrap,wrapper}}}
129
94
@@ -146,12 +111,12 @@ ENV SSH_AUTHORIZED_KEYS="" \
146
111
SSH_USER_ID="500:500" \
147
112
SSH_USER_PASSWORD="" \
148
113
SSH_USER_PASSWORD_HASHED="false" \
114
+ SSH_USER_PRIVATE_KEY="" \
149
115
SSH_USER_SHELL="/bin/bash"
150
116
151
117
# -----------------------------------------------------------------------------
152
118
# Set image metadata
153
119
# -----------------------------------------------------------------------------
154
- ARG RELEASE_VERSION="2.4.1"
155
120
LABEL \
156
121
maintainer="James Deathe <james.deathe@gmail.com>" \
157
122
install="docker run \
@@ -183,7 +148,7 @@ jdeathe/centos-ssh:${RELEASE_VERSION} \
183
148
org.deathe.description="CentOS-7 7.5.1804 x86_64 - SCL, EPEL and IUS Repositories / Supervisor / OpenSSH."
184
149
185
150
HEALTHCHECK \
186
- --interval=0.5s \
151
+ --interval=1s \
187
152
--timeout=1s \
188
153
--retries=5 \
189
154
CMD ["/usr/bin/healthcheck" ]
0 commit comments