Commit 636eb4d
committed
Fix sshd hardening being overridden by drop-in configs
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>1 parent 9c58231 commit 636eb4d
1 file changed
Lines changed: 12 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
185 | 192 | | |
186 | 193 | | |
187 | 194 | | |
| |||
278 | 285 | | |
279 | 286 | | |
280 | 287 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
| 288 | + | |
| 289 | + | |
295 | 290 | | |
296 | | - | |
| 291 | + | |
297 | 292 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 293 | + | |
302 | 294 | | |
303 | | - | |
| 295 | + | |
304 | 296 | | |
305 | 297 | | |
306 | 298 | | |
| |||
0 commit comments