Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit 82fe408

Browse files
authored
Merge pull request #748 from jdeathe/centos-7-develop
Release changes for 2.5.1
2 parents 3fcc789 + d980cf1 commit 82fe408

26 files changed

+996
-788
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
.env
2+
.env.example
13
.git
24
.gitignore
35
dist
46
test
7+
docker-compose.yml
58
LICENSE
69
README-short.txt
710
*.md

.env.example

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
SSH_AUTHORIZED_KEYS=
2+
SSH_AUTOSTART_SSHD=true
3+
SSH_AUTOSTART_SSHD_BOOTSTRAP=true
4+
SSH_CHROOT_DIRECTORY=%h
5+
SSH_INHERIT_ENVIRONMENT=false
6+
SSH_PASSWORD_AUTHENTICATION=false
7+
SSH_SUDO=ALL=(ALL) ALL
8+
SSH_TIMEZONE=UTC
9+
SSH_USER=app-admin
10+
SSH_USER_FORCE_SFTP=false
11+
SSH_USER_HOME=/home/%u
12+
SSH_USER_ID=500:500
13+
SSH_USER_PASSWORD=
14+
SSH_USER_PASSWORD_HASHED=false
15+
SSH_USER_PRIVATE_KEY=
16+
SSH_USER_SHELL=/bin/bash

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
.env
12
packages
23
dist

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@
44

55
Summary of release changes for Version 2 - CentOS-7
66

7+
### 2.5.1 - 2019-02-28
8+
9+
- Deprecates use of `supervisor_stdout` - the default value of `SSH_AUTOSTART_SUPERVISOR_STDOUT` will be switched to "false" in a future release.
10+
- Updates Dockerfile with combined ADD to reduce layer count in final image.
11+
- Fixes `scmi` installation error when using the `--manager=systemd` option on Ubuntu hosts.
12+
- Fixes issues with failure to install/uninstall systemd units installed with scmi.
13+
- Adds improvement to pull logic in systemd unit install template.
14+
- Adds `docker-compose.yml` to `.dockerignore` to reduce size of build context.
15+
- Adds docker-compose configuration example.
16+
- Adds `SSH_AUTOSTART_SUPERVISOR_STDOUT` to control startup of `supervisor_stdout`.
17+
- Adds drop-in configuration for `supervisor_stdout` in `/etc/supervisord.d/00-supervisor_stdout.conf`.
18+
- Adds improved `healtchcheck`, `sshd-bootstrap` and `sshd-wrapper` scripts.
19+
- Adds validation of `SSH_INHERIT_ENVIRONMENT` values.
20+
- Removes reference to `python-setuptools` from README as it's no longer installed.
21+
- Removes requirement of `supervisor_stdout` for output of supervisord logs to stdout.
22+
- Removes unnecessary configuration file `/etc/sshd-bootstrap.conf`.
23+
- Removes unnecessary environment file `/etc/sshd-bootstrap.env`.
24+
725
### 2.5.0 - 2019-01-28
826

927
- Updates `openssl` package to 1.0.2k-16.el7.

Dockerfile

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
FROM centos:7.5.1804
22

3-
ARG RELEASE_VERSION="2.5.0"
3+
ARG RELEASE_VERSION="2.5.1"
44

5-
# -----------------------------------------------------------------------------
5+
# ------------------------------------------------------------------------------
66
# - Import the RPM GPG keys for repositories
77
# - Base install of required packages
88
# - Install supervisord (used to run more than a single process)
99
# - Install supervisor-stdout to allow output of services started by
1010
# supervisord to be easily inspected with "docker logs".
11-
# -----------------------------------------------------------------------------
11+
# ------------------------------------------------------------------------------
1212
RUN rpm --rebuilddb \
1313
&& rpm --import \
1414
http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7 \
@@ -48,27 +48,20 @@ RUN rpm --rebuilddb \
4848
&& rm -rf /{root,tmp,var/cache/{ldconfig,yum}}/* \
4949
&& > /etc/sysconfig/i18n
5050

51-
# -----------------------------------------------------------------------------
51+
# ------------------------------------------------------------------------------
5252
# Copy files into place
53-
# -----------------------------------------------------------------------------
54-
ADD src/usr/bin \
55-
/usr/bin/
56-
ADD src/usr/sbin \
57-
/usr/sbin/
58-
ADD src/opt/scmi \
59-
/opt/scmi/
60-
ADD src/etc \
61-
/etc/
53+
# ------------------------------------------------------------------------------
54+
ADD src /
6255

63-
# -----------------------------------------------------------------------------
56+
# ------------------------------------------------------------------------------
6457
# Provisioning
6558
# - UTC Timezone
6659
# - Networking
6760
# - Configure SSH defaults for non-root public key authentication
6861
# - Enable the wheel sudoers group
6962
# - Replace placeholders with values in systemd service unit template
7063
# - Set permissions
71-
# -----------------------------------------------------------------------------
64+
# ------------------------------------------------------------------------------
7265
RUN ln -sf \
7366
/usr/share/zoneinfo/UTC \
7467
/etc/localtime \
@@ -88,18 +81,20 @@ RUN ln -sf \
8881
-e "s~{{RELEASE_VERSION}}~${RELEASE_VERSION}~g" \
8982
/etc/systemd/system/centos-ssh@.service \
9083
&& chmod 644 \
91-
/etc/{sshd-bootstrap.{conf,env},supervisord.conf,supervisord.d/sshd-{bootstrap,wrapper}.conf} \
84+
/etc/{supervisord.conf,supervisord.d/sshd-{bootstrap,wrapper}.conf} \
9285
&& chmod 700 \
9386
/usr/{bin/healthcheck,sbin/{scmi,sshd-{bootstrap,wrapper}}}
9487

9588
EXPOSE 22
9689

97-
# -----------------------------------------------------------------------------
90+
# ------------------------------------------------------------------------------
9891
# Set default environment variables
99-
# -----------------------------------------------------------------------------
100-
ENV SSH_AUTHORIZED_KEYS="" \
92+
# ------------------------------------------------------------------------------
93+
ENV \
94+
SSH_AUTHORIZED_KEYS="" \
10195
SSH_AUTOSTART_SSHD="true" \
10296
SSH_AUTOSTART_SSHD_BOOTSTRAP="true" \
97+
SSH_AUTOSTART_SUPERVISOR_STDOUT="true" \
10398
SSH_CHROOT_DIRECTORY="%h" \
10499
SSH_INHERIT_ENVIRONMENT="false" \
105100
SSH_PASSWORD_AUTHENTICATION="false" \
@@ -114,9 +109,9 @@ ENV SSH_AUTHORIZED_KEYS="" \
114109
SSH_USER_PRIVATE_KEY="" \
115110
SSH_USER_SHELL="/bin/bash"
116111

117-
# -----------------------------------------------------------------------------
112+
# ------------------------------------------------------------------------------
118113
# Set image metadata
119-
# -----------------------------------------------------------------------------
114+
# ------------------------------------------------------------------------------
120115
LABEL \
121116
maintainer="James Deathe <james.deathe@gmail.com>" \
122117
install="docker run \
@@ -153,4 +148,4 @@ HEALTHCHECK \
153148
--retries=5 \
154149
CMD ["/usr/bin/healthcheck"]
155150

156-
CMD ["/usr/bin/supervisord", "--configuration=/etc/supervisord.conf"]
151+
CMD ["/usr/bin/supervisord", "--configuration=/etc/supervisord.conf"]

README.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ Includes public key authentication, Automated password generation and supports c
77

88
## Overview & links
99

10-
The latest CentOS-6 / CentOS-7 based releases can be pulled from the `centos-6` / `centos-7` Docker tags respectively. For production use it is recommended to select a specific release tag - the convention is `centos-6-1.10.0` OR `1.10.0` for the [1.10.0](https://github.com/jdeathe/centos-ssh/tree/1.10.0) release tag and `centos-7-2.5.0` OR `2.5.0` for the [2.5.0](https://github.com/jdeathe/centos-ssh/tree/2.5.0) release tag.
10+
The latest CentOS-6 / CentOS-7 based releases can be pulled from the `centos-6` / `centos-7` Docker tags respectively. For production use it is recommended to select a specific release tag - the convention is `centos-6-1.10.1` OR `1.10.1` for the [1.10.1](https://github.com/jdeathe/centos-ssh/tree/1.10.1) release tag and `centos-7-2.5.1` OR `2.5.1` for the [2.5.1](https://github.com/jdeathe/centos-ssh/tree/2.5.1) release tag.
1111

1212
### Tags and respective `Dockerfile` links
1313

14-
- `centos-7`,`centos-7-2.5.0`,`2.5.0` [(centos-7/Dockerfile)](https://github.com/jdeathe/centos-ssh/blob/centos-7/Dockerfile)
15-
- `centos-6`,`centos-6-1.10.0`,`1.10.0` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh/blob/centos-6/Dockerfile)
14+
- `centos-7`,`centos-7-2.5.1`,`2.5.1` [(centos-7/Dockerfile)](https://github.com/jdeathe/centos-ssh/blob/centos-7/Dockerfile)
15+
- `centos-6`,`centos-6-1.10.1`,`1.10.1` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh/blob/centos-6/Dockerfile)
1616

1717
The Dockerfile can be used to build a base image that is the bases for several other docker images.
1818

19-
Included in the build are the [SCL](https://www.softwarecollections.org/), [EPEL](http://fedoraproject.org/wiki/EPEL) and [IUS](https://ius.io) repositories. Installed packages include [OpenSSH](http://www.openssh.com/portable.html) secure shell, [Sudo](http://www.courtesan.com/sudo/) and [vim-minimal](http://www.vim.org/) are along with python-setuptools, [supervisor](http://supervisord.org/) and [supervisor-stdout](https://github.com/coderanger/supervisor-stdout).
19+
Included in the build are the [SCL](https://www.softwarecollections.org/), [EPEL](http://fedoraproject.org/wiki/EPEL) and [IUS](https://ius.io) repositories. Installed packages include [OpenSSH](http://www.openssh.com/portable.html) secure shell, [Sudo](http://www.courtesan.com/sudo/) and [vim-minimal](http://www.vim.org/) are along with [supervisor](http://supervisord.org/) and [supervisor-stdout](https://github.com/coderanger/supervisor-stdout).
2020

21-
[Supervisor](http://supervisord.org/) is used to start and the sshd daemon when a docker container based on this image is run. To enable simple viewing of stdout for the sshd subprocess, supervisor-stdout is included. This allows you to see output from the supervisord controlled subprocesses with `docker logs {container-name}`.
21+
[Supervisor](http://supervisord.org/) is used to start and the sshd daemon when a docker container based on this image is run.
2222

2323
SSH access is by public key authentication and, by default, the [Vagrant](http://www.vagrantup.com/) [insecure private key](https://github.com/mitchellh/vagrant/blob/master/keys/vagrant) is required.
2424

@@ -42,7 +42,7 @@ Run up an SSH container named 'ssh.1' from the docker image 'jdeathe/centos-ssh'
4242
$ docker run -d \
4343
--name ssh.1 \
4444
-p 2020:22 \
45-
jdeathe/centos-ssh:2.5.0
45+
jdeathe/centos-ssh:2.5.1
4646
```
4747

4848
Check the logs for the password (required for sudo).
@@ -76,7 +76,7 @@ $ docker run -d \
7676
--name sftp.1 \
7777
-p 2021:22 \
7878
-e SSH_USER_FORCE_SFTP=true \
79-
jdeathe/centos-ssh:2.5.0
79+
jdeathe/centos-ssh:2.5.1
8080
```
8181

8282
Connect using the `sftp` command line client with the [insecure private key](https://github.com/mitchellh/vagrant/blob/master/keys/vagrant).
@@ -106,10 +106,10 @@ $ docker run \
106106
--rm \
107107
--privileged \
108108
--volume /:/media/root \
109-
jdeathe/centos-ssh:2.5.0 \
109+
jdeathe/centos-ssh:2.5.1 \
110110
/usr/sbin/scmi install \
111111
--chroot=/media/root \
112-
--tag=2.5.0 \
112+
--tag=2.5.1 \
113113
--name=ssh.1 \
114114
--setopt="--volume {{NAME}}.config-ssh:/etc/ssh"
115115
```
@@ -123,10 +123,10 @@ $ docker run \
123123
--rm \
124124
--privileged \
125125
--volume /:/media/root \
126-
jdeathe/centos-ssh:2.5.0 \
126+
jdeathe/centos-ssh:2.5.1 \
127127
/usr/sbin/scmi uninstall \
128128
--chroot=/media/root \
129-
--tag=2.5.0 \
129+
--tag=2.5.1 \
130130
--name=ssh.1 \
131131
--setopt="--volume {{NAME}}.config-ssh:/etc/ssh"
132132
```
@@ -140,10 +140,10 @@ $ docker run \
140140
--rm \
141141
--privileged \
142142
--volume /:/media/root \
143-
jdeathe/centos-ssh:2.5.0 \
143+
jdeathe/centos-ssh:2.5.1 \
144144
/usr/sbin/scmi install \
145145
--chroot=/media/root \
146-
--tag=2.5.0 \
146+
--tag=2.5.1 \
147147
--name=ssh.1 \
148148
--manager=systemd \
149149
--register \
@@ -159,7 +159,7 @@ Since release tags `1.7.2` / `2.1.2` the install template has been added to the
159159
_NOTE:_ A prerequisite of the following examples is that the image has been pulled (or loaded from the release package).
160160

161161
```
162-
$ docker pull jdeathe/centos-ssh:2.5.0
162+
$ docker pull jdeathe/centos-ssh:2.5.1
163163
```
164164

165165
To see detailed information about the image run `scmi` with the `--info` option. To see all available `scmi` options run with the `--help` option.
@@ -168,7 +168,7 @@ To see detailed information about the image run `scmi` with the `--info` option.
168168
$ eval "sudo -E $(
169169
docker inspect \
170170
-f "{{.ContainerConfig.Labels.install}}" \
171-
jdeathe/centos-ssh:2.5.0
171+
jdeathe/centos-ssh:2.5.1
172172
) --info"
173173
```
174174

@@ -178,7 +178,7 @@ To perform an installation using the docker name `ssh.2` simply use the `--name`
178178
$ eval "sudo -E $(
179179
docker inspect \
180180
-f "{{.ContainerConfig.Labels.install}}" \
181-
jdeathe/centos-ssh:2.5.0
181+
jdeathe/centos-ssh:2.5.1
182182
) --name=ssh.2"
183183
```
184184

@@ -188,7 +188,7 @@ To uninstall use the *same command* that was used to install but with the `unins
188188
$ eval "sudo -E $(
189189
docker inspect \
190190
-f "{{.ContainerConfig.Labels.uninstall}}" \
191-
jdeathe/centos-ssh:2.5.0
191+
jdeathe/centos-ssh:2.5.1
192192
) --name=ssh.2"
193193
```
194194

@@ -201,7 +201,7 @@ To see detailed information about the image run `scmi` with the `--info` option.
201201
```
202202
$ sudo -E atomic install \
203203
-n ssh.3 \
204-
jdeathe/centos-ssh:2.5.0 \
204+
jdeathe/centos-ssh:2.5.1 \
205205
--info
206206
```
207207

@@ -210,14 +210,14 @@ To perform an installation using the docker name `ssh.3` simply use the `-n` opt
210210
```
211211
$ sudo -E atomic install \
212212
-n ssh.3 \
213-
jdeathe/centos-ssh:2.5.0
213+
jdeathe/centos-ssh:2.5.1
214214
```
215215

216216
Alternatively, you could use the `scmi` options `--name` or `-n` for naming the container.
217217

218218
```
219219
$ sudo -E atomic install \
220-
jdeathe/centos-ssh:2.5.0 \
220+
jdeathe/centos-ssh:2.5.1 \
221221
--name ssh.3
222222
```
223223

@@ -226,7 +226,7 @@ To uninstall use the *same command* that was used to install but with the `unins
226226
```
227227
$ sudo -E atomic uninstall \
228228
-n ssh.3 \
229-
jdeathe/centos-ssh:2.5.0
229+
jdeathe/centos-ssh:2.5.1
230230
```
231231

232232
#### Using environment variables
@@ -242,7 +242,7 @@ $ docker stop ssh.1 \
242242
--name ssh.1 \
243243
-p :22 \
244244
--env "SSH_USER=centos" \
245-
jdeathe/centos-ssh:2.5.0
245+
jdeathe/centos-ssh:2.5.1
246246
```
247247

248248
To identify the `SSH_USER` user's sudoer password, inspect the container's logs as follows:
@@ -265,8 +265,7 @@ The output of the logs will show the auto-generated password for the user specif
265265
2019-01-17 18:56:10,089 INFO success: supervisor_stdout entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
266266
2019-01-17 18:56:10,089 INFO success: sshd-bootstrap entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
267267
2019-01-17 18:56:10,089 INFO success: sshd-wrapper entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
268-
sshd-bootstrap stdout | Initialising SSH.
269-
sshd-bootstrap stdout |
268+
270269
================================================================================
271270
SSH Details
272271
--------------------------------------------------------------------------------
@@ -335,6 +334,10 @@ It may be desirable to prevent the startup of the sshd daemon and/or sshd-bootst
335334
...
336335
```
337336

337+
##### SSH_AUTOSTART_SUPERVISOR_STDOUT
338+
339+
This image has `supervisor_stdout` installed which can be used to allow a process controlled by supervisord to send output to both a log file and stdout. It is recommended to simply output to stdout in order to reduce the number of running processes to a minimum. Setting `SSH_AUTOSTART_SUPERVISOR_STDOUT` to "false" will prevent the startup of `supervisor_stdout`. Where an image requires this feature for its logging output `SSH_AUTOSTART_SUPERVISOR_STDOUT` should be set to "true".
340+
338341
##### SSH_CHROOT_DIRECTORY
339342

340343
This option is only applicable when `SSH_USER_FORCE_SFTP` is set to `true`. When using the SFTP option the user is jailed into the ChrootDirectory. The value can contain the placeholders `%h` and `%u` which will be replaced with the values of `SSH_USER_HOME` and `SSH_USER` respectively. The default value of `%h` is the best choice in most cases but the user requires a sub-directory in their HOME directory which they have write access to. If no volume is mounted into the path of the SSH user's HOME directory then a directory named `_data` is created automatically. If you need the user to be able to write to their HOME directory then use an alternative value such as `/chroot/%u` so that the user's HOME path, (relative to the ChrootDirectory), becomes `/chroot/app-admin/home/app-admin` by default.

default.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ define DOCKER_CONTAINER_PARAMETERS
4444
--env "SSH_AUTHORIZED_KEYS=$(SSH_AUTHORIZED_KEYS)" \
4545
--env "SSH_AUTOSTART_SSHD=$(SSH_AUTOSTART_SSHD)" \
4646
--env "SSH_AUTOSTART_SSHD_BOOTSTRAP=$(SSH_AUTOSTART_SSHD_BOOTSTRAP)" \
47+
--env "SSH_AUTOSTART_SUPERVISOR_STDOUT=$(SSH_AUTOSTART_SUPERVISOR_STDOUT)" \
4748
--env "SSH_CHROOT_DIRECTORY=$(SSH_CHROOT_DIRECTORY)" \
4849
--env "SSH_INHERIT_ENVIRONMENT=$(SSH_INHERIT_ENVIRONMENT)" \
4950
--env "SSH_PASSWORD_AUTHENTICATION=$(SSH_PASSWORD_AUTHENTICATION)" \

0 commit comments

Comments
 (0)