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

CLOSES #695: Adds feature to self-destruct a container. #800

Open
wants to merge 19 commits into
base: centos-7-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
738d959
#695: Adds feature to self-destruct a container after a (1 hour defau…
jdeathe Jun 10, 2019
0bd1b43
#695: Separate out the reaper env variable names from sshd.
jdeathe Jun 12, 2019
6ef33d5
#695: Fixes __reap call and missed variable rename.
jdeathe Jun 12, 2019
6b2eb19
#695: Renames reaper autostart variable in systemd template.
jdeathe Jun 13, 2019
1358399
#695: Adds simplified sessing expiry warnimg message.
jdeathe Jun 14, 2019
b8de2bf
#695: Adds lock file feature to reaper.
jdeathe Jun 14, 2019
ed072a0
#695: Adds feature to get reaper start/end timestamp or ttl (remainin…
jdeathe Jun 14, 2019
86ff3c4
#695: Adds reaper usage help/error catching.
jdeathe Jun 15, 2019
5447f0c
#695: Adds parameters for wall and wall timeout to reaper.
jdeathe Jun 15, 2019
5e6ec08
#695: Adds --timeout parameter to reaper and sets default timeout of …
jdeathe Jun 17, 2019
1970259
Merge branch 'centos-7-develop' into issue/695
jdeathe Jun 20, 2019
3eeb6fc
#695: Renames reaper config file to follow existing p1 processes.
jdeathe Jun 20, 2019
56d75b4
Merge branch 'centos-7-develop' into issue/695
jdeathe Sep 19, 2019
4998338
#695: Adds improved message output.
jdeathe Sep 20, 2019
4e00ad3
#695: Fixes error return code when requesting help
jdeathe Sep 20, 2019
8607a70
#695: Emmit WARN message when expiring session.
jdeathe Sep 20, 2019
414a39b
#695: Fixes WARN messages and quite/silent options.
jdeathe Sep 20, 2019
a3199c3
#695: Adds logging output improvements.
jdeathe Sep 21, 2019
3bcaaa1
#695: Order variables alphabetically.
jdeathe Sep 21, 2019
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
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ENABLE_REAPER=false
REAPER_TIMEOUT=0
SSH_AUTHORIZED_KEYS=
SSH_CHROOT_DIRECTORY=%h
SSH_INHERIT_ENVIRONMENT=false
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Summary of release changes.
- Adds exec proxy function to `sshd-wrapper` used to pass through nice.
- Adds double quotes around value containing spaces.
- Adds `/docs` directory for supplementary documentation and simplify README.
- Adds feature to optionally exit the container after a specified timout period.
- Adds `ENABLE_REAPER` with a default value of `false` to enable the `reaper` service.
- Adds `REAPER_TIMEOUT` with a default value of `0` seconds (i.e no timeout delay).
- Fixes validation failure of 0 second --timeout value in `test/health_status`.
- Removes `ENABLE_SSHD_BOOTSTRAP` from docker-compose example configuration.
- Removes `ENABLE_SSHD_WRAPPER` from docker-compose example configuration.
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ RUN rpm --rebuilddb \
openssl-1.0.2k-19.el7 \
python-setuptools-0.9.8-7.el7 \
sudo-1.8.23-4.el7 \
sysvinit-tools-2.88-14.dsf.el7 \
yum-plugin-versionlock-1.1.31-52.el7 \
&& yum versionlock add \
inotify-tools \
Expand All @@ -40,6 +41,7 @@ RUN rpm --rebuilddb \
openssh-clients \
python-setuptools \
sudo \
sysvinit-tools \
yum-plugin-versionlock \
&& yum clean all \
&& easy_install \
Expand Down Expand Up @@ -88,17 +90,19 @@ RUN ln -sf \
&& chmod 644 \
/etc/{supervisord.conf,supervisord.d/{20-sshd-bootstrap,50-sshd-wrapper}.conf} \
&& chmod 700 \
/usr/{bin/healthcheck,sbin/{scmi,sshd-{bootstrap,wrapper},system-{timezone,timezone-wrapper}}}
/usr/{bin/healthcheck,sbin/{reaper,scmi,sshd-{bootstrap,wrapper},system-{timezone,timezone-wrapper}}}

EXPOSE 22

# ------------------------------------------------------------------------------
# Set default environment variables
# ------------------------------------------------------------------------------
ENV \
ENABLE_REAPER="false" \
ENABLE_SSHD_BOOTSTRAP="true" \
ENABLE_SSHD_WRAPPER="true" \
ENABLE_SUPERVISOR_STDOUT="false" \
REAPER_TIMEOUT="0" \
SSH_AUTHORIZED_KEYS="" \
SSH_CHROOT_DIRECTORY="%h" \
SSH_INHERIT_ENVIRONMENT="false" \
Expand Down
2 changes: 2 additions & 0 deletions default.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ DOCKER_PUBLISH := $(shell \
define DOCKER_CONTAINER_PARAMETERS
--name $(DOCKER_NAME) \
--restart $(DOCKER_RESTART_POLICY) \
--env "ENABLE_REAPER=$(ENABLE_REAPER)" \
--env "ENABLE_SSHD_BOOTSTRAP=$(ENABLE_SSHD_BOOTSTRAP)" \
--env "ENABLE_SSHD_WRAPPER=$(ENABLE_SSHD_WRAPPER)" \
--env "ENABLE_SUPERVISOR_STDOUT=$(ENABLE_SUPERVISOR_STDOUT)" \
--env "REAPER_TIMEOUT=$(REAPER_TIMEOUT)" \
--env "SSH_AUTHORIZED_KEYS=$(SSH_AUTHORIZED_KEYS)" \
--env "SSH_CHROOT_DIRECTORY=$(SSH_CHROOT_DIRECTORY)" \
--env "SSH_INHERIT_ENVIRONMENT=$(SSH_INHERIT_ENVIRONMENT)" \
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ services:
context: "."
dockerfile: "Dockerfile"
environment:
ENABLE_REAPER: "${ENABLE_REAPER}"
REAPER_TIMEOUT: "${REAPER_TIMEOUT}"
SSH_AUTHORIZED_KEYS: "${SSH_AUTHORIZED_KEYS}"
SSH_CHROOT_DIRECTORY: "${SSH_CHROOT_DIRECTORY}"
SSH_INHERIT_ENVIRONMENT: "${SSH_INHERIT_ENVIRONMENT}"
Expand Down
2 changes: 2 additions & 0 deletions environment.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ STARTUP_TIME ?= 2
# ------------------------------------------------------------------------------
# Application container configuration
# ------------------------------------------------------------------------------
ENABLE_REAPER ?= false
ENABLE_SSHD_BOOTSTRAP ?= true
ENABLE_SSHD_WRAPPER ?= true
ENABLE_SUPERVISOR_STDOUT ?= false
REAPER_TIMEOUT ?= 0
SSH_AUTHORIZED_KEYS ?=
SSH_CHROOT_DIRECTORY ?= %h
SSH_INHERIT_ENVIRONMENT ?= false
Expand Down
10 changes: 10 additions & 0 deletions src/etc/supervisord.d/00-reaper.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[program:reaper]
autorestart = false
autostart = %(ENV_ENABLE_REAPER)s
command = /usr/sbin/reaper --monochrome --verbose --timeout %(ENV_REAPER_TIMEOUT)s --wall-timeout 30 --wall="Session expiring in 30 seconds."
priority = 1
startsecs = 0
stderr_logfile = /dev/stderr
stderr_logfile_maxbytes = 0
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0
4 changes: 4 additions & 0 deletions src/etc/systemd/system/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ Environment="DOCKER_IMAGE_PACKAGE_PATH=/var/opt/scmi/packages"
Environment="DOCKER_IMAGE_TAG={{RELEASE_VERSION}}"
Environment="DOCKER_PORT_MAP_TCP_22=2020"
Environment="DOCKER_USER=jdeathe"
Environment="ENABLE_REAPER=false"
Environment="ENABLE_SSHD_BOOTSTRAP=true"
Environment="ENABLE_SSHD_WRAPPER=true"
Environment="ENABLE_SUPERVISOR_STDOUT=false"
Environment="REAPER_TIMEOUT=0"
Environment="SSH_AUTHORIZED_KEYS="
Environment="SSH_CHROOT_DIRECTORY=%%h"
Environment="SSH_INHERIT_ENVIRONMENT=false"
Expand Down Expand Up @@ -129,9 +131,11 @@ ExecStartPre=-/bin/bash -c \
ExecStart=/bin/bash -c \
"exec /usr/bin/docker run \
--name %p.%i \
--env \"ENABLE_REAPER=${ENABLE_REAPER}\" \
--env \"ENABLE_SSHD_BOOTSTRAP=${ENABLE_SSHD_BOOTSTRAP}\" \
--env \"ENABLE_SSHD_WRAPPER=${ENABLE_SSHD_WRAPPER}\" \
--env \"ENABLE_SUPERVISOR_STDOUT=${ENABLE_SUPERVISOR_STDOUT}\" \
--env \"REAPER_TIMEOUT=${REAPER_TIMEOUT}\" \
--env \"SSH_AUTHORIZED_KEYS=${SSH_AUTHORIZED_KEYS}\" \
--env \"SSH_CHROOT_DIRECTORY=${SSH_CHROOT_DIRECTORY}\" \
--env \"SSH_INHERIT_ENVIRONMENT=${SSH_INHERIT_ENVIRONMENT}\" \
Expand Down
2 changes: 2 additions & 0 deletions src/opt/scmi/default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ fi
# Common parameters of create and run targets
DOCKER_CONTAINER_PARAMETERS="--name ${DOCKER_NAME} \
--restart ${DOCKER_RESTART_POLICY} \
--env \"ENABLE_REAPER=${ENABLE_REAPER}\" \
--env \"ENABLE_SSHD_BOOTSTRAP=${ENABLE_SSHD_BOOTSTRAP}\" \
--env \"ENABLE_SSHD_WRAPPER=${ENABLE_SSHD_WRAPPER}\" \
--env \"ENABLE_SUPERVISOR_STDOUT=${ENABLE_SUPERVISOR_STDOUT}\" \
--env \"REAPER_TIMEOUT=${REAPER_TIMEOUT}\" \
--env \"SSH_AUTHORIZED_KEYS=${SSH_AUTHORIZED_KEYS}\" \
--env \"SSH_CHROOT_DIRECTORY=${SSH_CHROOT_DIRECTORY}\" \
--env \"SSH_INHERIT_ENVIRONMENT=${SSH_INHERIT_ENVIRONMENT}\" \
Expand Down
2 changes: 2 additions & 0 deletions src/opt/scmi/environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ STARTUP_TIME="${STARTUP_TIME:-2}"
# ------------------------------------------------------------------------------
# Application container configuration
# ------------------------------------------------------------------------------
ENABLE_REAPER="${ENABLE_REAPER:-false}"
ENABLE_SSHD_BOOTSTRAP="${ENABLE_SSHD_BOOTSTRAP:-true}"
ENABLE_SSHD_WRAPPER="${ENABLE_SSHD_WRAPPER:-true}"
ENABLE_SUPERVISOR_STDOUT="${ENABLE_SUPERVISOR_STDOUT:-false}"
REAPER_TIMEOUT="${REAPER_TIMEOUT:-0}"
SSH_AUTHORIZED_KEYS="${SSH_AUTHORIZED_KEYS:-}"
SSH_CHROOT_DIRECTORY="${SSH_CHROOT_DIRECTORY:-%h}"
SSH_INHERIT_ENVIRONMENT="${SSH_INHERIT_ENVIRONMENT:-false}"
Expand Down
2 changes: 2 additions & 0 deletions src/opt/scmi/service-unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ readonly SERVICE_UNIT_ENVIRONMENT_KEYS="
DOCKER_IMAGE_PACKAGE_PATH
DOCKER_IMAGE_TAG
DOCKER_PORT_MAP_TCP_22
ENABLE_REAPER
ENABLE_SSHD_BOOTSTRAP
ENABLE_SSHD_WRAPPER
ENABLE_SUPERVISOR_STDOUT
REAPER_TIMEOUT
SSH_AUTHORIZED_KEYS
SSH_CHROOT_DIRECTORY
SSH_INHERIT_ENVIRONMENT
Expand Down
Loading