Loading
Include user sshd config drop-ins in the Docker image
What does this MR do?
Adds Include /etc/gitlab/sshd_config.d/*.conf to docker/assets/sshd_config, so users of the Docker image can customize sshd (ciphers, MACs, key exchange algorithms, host certificates) from the persisted /etc/gitlab volume instead of patching /assets/sshd_config.
- If
sshd_config.dis missing or empty, nothing changes. - Default algorithms are unchanged. !8937 (merged) reverted a change to the defaults because it broke existing installations, so this MR gives users a way to set them instead.
docker/assets/init-containerprints a warning if the resulting config failssshd -t. The existing workaround, appending the sameIncludefrom aGITLAB_POST_RECONFIGURE_SCRIPThook, is described in #8124 (comment 2230870069).
Changelog: added
Related issues
Related to: #8124 (closed)
Test Cases
Using gitlab/gitlab-ce:latest docker image:
Before
Command:
docker run --rm --entrypoint bash gitlab/gitlab-ce:latest -c '
mkdir -p /etc/gitlab/sshd_config.d /run/sshd
for t in rsa ecdsa ed25519; do ssh-keygen -q -f /etc/gitlab/ssh_host_${t}_key -N "" -t $t; done
printf "MACs hmac-sha2-512-etm@openssh.com\nMaxStartups 10:30:100\n" > /etc/gitlab/sshd_config.d/10-test.conf
echo "--- effective values ---"
/usr/sbin/sshd -T -f /assets/sshd_config | grep -iE "^(macs|maxstartups)"
echo "BogusKeyword yes" > /etc/gitlab/sshd_config.d/20-bad.conf
echo "--- bad keyword in drop-in ---"
/usr/sbin/sshd -t -f /assets/sshd_config && echo "sshd -t OK (drop-ins are ignored)"
'Output:
--- effective values ---
macs umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
maxstartups 100:30:200
--- bad keyword in drop-in ---
sshd -t OK (drop-ins are ignored)After
Command:
mkdir -p /tmp/gl-etc/sshd_config.d
printf "MACs hmac-sha2-512-etm@openssh.com\n" > /tmp/gl-etc/sshd_config.d/10-test.conf
docker run -d --name gl-ssh-test -p 2222:22 \
-v "$PWD/docker/assets/sshd_config:/assets/sshd_config:ro" \
-v /tmp/gl-etc:/etc/gitlab \
gitlab/gitlab-ce:latest
docker exec gl-ssh-test /usr/sbin/sshd -T -f /assets/sshd_config | grep -i '^macs'Output:
macs hmac-sha2-512-etm@openssh.comChecklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion.
Required
- MR title and description are up to date, accurate, and descriptive.
- MR targeting the appropriate branch.
- Latest Merge Result pipeline is green.
- When ready for review, MR is labeled workflowready for review per the Distribution MR workflow.
For GitLab team members
If you don't have access to this, the reviewer should trigger these jobs for you during the review process.
- The manual
Trigger:ee-packagejobs have a green pipeline running against latest commit. - If
config/softwareorconfig/patchesdirectories are changed, make sure thebuild-package-on-all-osjob within theTrigger:ee-packagedownstream pipeline succeeded. - If you are changing anything SSL related, then the
Trigger:package:fipsmanual job within theTrigger:ee-packagedownstream pipeline must succeed. - If CI configuration is changed, the branch must be pushed to
dev.gitlab.orgto confirm regular branch builds aren't broken.
Expected (please provide an explanation if not completing)
- Test plan indicating conditions for success has been posted and passes.
- Documentation created/updated.
- Tests added.
- Integration tests added to GitLab QA.
- Equivalent MR/issue for the GitLab Chart opened.
- Validate potential values for new configuration settings. Formats such as integer
10, duration10s, URIscheme://user:passwd@host:portmay require quotation or other special handling when rendered in a template and written to a configuration file.
Edited by Kolawole Ezekiel Damilare