ENT-13766: Fix sshd hardening being overridden by drop-in configs#2136
Open
larsewi wants to merge 3 commits intocfengine:masterfrom
Open
ENT-13766: Fix sshd hardening being overridden by drop-in configs#2136larsewi wants to merge 3 commits intocfengine:masterfrom
larsewi wants to merge 3 commits intocfengine:masterfrom
Conversation
On Ubuntu, /etc/ssh/sshd_config includes drop-in files from sshd_config.d/ near the top, and OpenSSH uses first-match-wins. The previous policy only edited the main sshd_config, so drop-ins like 50-cloud-init.conf setting PasswordAuthentication yes took precedence. Changes: - Add sshd_hardening_directives slist to avoid repeating directive names - Comment out insecure values recursively across /etc/ssh (main config and all drop-ins), not just sshd_config - Prepend hardening directives to the top of sshd_config, before the Include directive, so they take precedence over any drop-in Ticket: ENT-13766 Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Ticket: ENT-13766 Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
On Ubuntu/Debian, the service is called ssh, not sshd. Ticket: ENT-13766 Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Ubuntu, /etc/ssh/sshd_config includes drop-in files from sshd_config.d/ near the top, and OpenSSH uses first-match-wins. The previous policy only edited the main sshd_config, so drop-ins like 50-cloud-init.conf setting
PasswordAuthentication yestook precedence.Changes:
sshd_hardening_directivesslist to avoid repeating directive namesTicket: ENT-13766
Signed-off-by: Lars Erik Wik lars.erik.wik@northern.tech