Files
napalm-openmediavault/tests/test_ssh_hardening.py
T
Christian Manivong a7a4e46ac2
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 15s
driver / test (3.12) (pull_request) Successful in 1m56s
driver / types (pull_request) Successful in 2m4s
driver / test (3.13) (pull_request) Successful in 2m7s
driver / build (pull_request) Successful in 38s
driver / lowest (pull_request) Successful in 1m51s
driver / security (pull_request) Successful in 1m52s
CI / driver (pull_request) Successful in 4m15s
driver / publish (pull_request) Skipped
feat(ssh): offer the SSH hardening, into the drop-in only (#20)
OMV's generated sshd_config includes /etc/ssh/sshd_config.d, and its salt
state manages only sshd_config itself, so the drop-in napalm-linux's
hardening writes survives the next apply of the SSH settings. The opt-out
from #3 goes; SSHD_CONFIG_GENERATED (napalm-device-types 4.26.0) keeps the
hardening off sshd_config itself.
2026-11-03 07:57:08 +01:00

24 lines
907 B
Python

"""OpenMediaVault writes sshd_config itself, from its own database.
The Linux driver offers to harden the SSH server by writing a drop-in under
/etc/ssh/sshd_config.d (NetOrk/netork#1027). OMV's template ends with
``Include /etc/ssh/sshd_config.d/*.conf`` and salt manages only sshd_config,
so the drop-in survives the next apply of the SSH settings
(``omv-salt deploy run ssh``) and the hardening is offered. Only sshd_config
itself is off limits: that apply would write over it, so an OMV whose
sshd_config does not include the directory is left alone
(``SSHD_CONFIG_GENERATED``).
"""
from __future__ import annotations
from napalm_openmediavault.openmediavault import OpenMediaVaultDriver
def test_offers_ssh_hardening():
assert callable(getattr(OpenMediaVaultDriver, "harden_ssh_server", None))
def test_writes_only_the_dropin():
assert OpenMediaVaultDriver.SSHD_CONFIG_GENERATED is True