feat(ssh): offer the SSH hardening, into the drop-in only (#20)
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
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
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.
This commit is contained in:
1 parent
a0d28fc939
commit
a7a4e46ac2
6 files changed
+39
-23
No files matched your search
@@ -32,6 +32,10 @@ All notable changes to this driver. The format follows
|
|||||||
### Changed
|
### Changed
|
||||||
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
|
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
|
||||||
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
|
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
|
||||||
|
- The SSH hardening is offered again (#20, NetOrk/netork#1950): it goes into the drop-in under
|
||||||
|
`/etc/ssh/sshd_config.d`, which OpenMediaVault's generated `sshd_config` includes and salt
|
||||||
|
leaves alone, never into `sshd_config` itself (`SSHD_CONFIG_GENERATED`, napalm-device-types
|
||||||
|
4.26.0). Requires napalm-device-types 4.26.0.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- `get_disks()` reports each disk's SMART verdict: `healthy` when smartctl's overall
|
- `get_disks()` reports each disk's SMART verdict: `healthy` when smartctl's overall
|
||||||
|
|||||||
@@ -45,11 +45,16 @@ with driver("192.0.2.10", "admin", "secret", optional_args={"sudo_password": "se
|
|||||||
"Upgrade everything" is a full upgrade (`FULL_UPGRADE = True`): a plain `apt-get upgrade` holds
|
"Upgrade everything" is a full upgrade (`FULL_UPGRADE = True`): a plain `apt-get upgrade` holds
|
||||||
back OpenMediaVault's own packages and the kernel.
|
back OpenMediaVault's own packages and the kernel.
|
||||||
|
|
||||||
|
The SSH hardening of napalm-linux (`harden_ssh_server`) writes only the drop-in under
|
||||||
|
`/etc/ssh/sshd_config.d` (`SSHD_CONFIG_GENERATED = True`). OpenMediaVault generates
|
||||||
|
`sshd_config` from its own database and would write over a change to it, but its template
|
||||||
|
includes that directory, and salt leaves the drop-in alone. An algorithm set in the SSH
|
||||||
|
settings' "Extra options" comes before the include and wins; the hardening sees that, puts
|
||||||
|
its change back and says so.
|
||||||
|
|
||||||
## Not supported
|
## Not supported
|
||||||
|
|
||||||
- `get_volume_snapshots`, `get_replication_jobs`, `get_quotas` raise `NotImplementedError`.
|
- `get_volume_snapshots`, `get_replication_jobs`, `get_quotas` raise `NotImplementedError`.
|
||||||
- `harden_ssh_server` is not offered: OpenMediaVault generates `sshd_config` from its own
|
|
||||||
database and would undo a drop-in on the next apply of its SSH settings.
|
|
||||||
- Configuration changes to shares, disks or arrays.
|
- Configuration changes to shares, disks or arrays.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|||||||
@@ -187,10 +187,10 @@ class OpenMediaVaultDriver(OmvLocalAccountsMixin, StorageDriver, LinuxDriver):
|
|||||||
FingerprintRule("openmediavault", weight=9.0, mandatory=True),
|
FingerprintRule("openmediavault", weight=9.0, mandatory=True),
|
||||||
]
|
]
|
||||||
|
|
||||||
#: OMV generates sshd_config from its own database; a drop-in netOrk wrote
|
#: OMV generates sshd_config from its own database, but its template includes
|
||||||
#: would be dropped on the next apply of the SSH settings. Inherited from
|
#: /etc/ssh/sshd_config.d, which salt leaves alone: the SSH hardening from
|
||||||
#: napalm-linux, so opted out here (NetOrk/netork#1027).
|
#: napalm-linux goes into a drop-in there and never into sshd_config itself.
|
||||||
harden_ssh_server = None # type: ignore[assignment]
|
SSHD_CONFIG_GENERATED = True
|
||||||
|
|
||||||
# ── Facts override ─────────────────────────────────────────────────────────
|
# ── Facts override ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ classifiers = [
|
|||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"napalm>=4.0",
|
"napalm>=4.0",
|
||||||
"napalm-device-types>=4.22.0",
|
"napalm-device-types>=4.26.0",
|
||||||
"napalm-linux>=0.15.0",
|
"napalm-linux>=0.15.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
"""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
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
"""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). On OMV the next apply of the SSH
|
|
||||||
settings (``omv-salt deploy run ssh``) would regenerate the configuration and
|
|
||||||
take the change back without a word, so this driver opts out: netOrk's
|
|
||||||
capability probe asks ``callable(harden_ssh_server)``.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from napalm_openmediavault.openmediavault import OpenMediaVaultDriver
|
|
||||||
|
|
||||||
|
|
||||||
def test_does_not_offer_ssh_hardening():
|
|
||||||
assert not callable(getattr(OpenMediaVaultDriver, "harden_ssh_server", None))
|
|
||||||
Reference in new issue
Block a user