Skip to content

Commit 8b474ce

Browse files
committed
don't use paramiko's get_fingerprint (md5)
In order for n-g-s to be able to run on a node in FIPS enforcing mode, it *must* not use md5. However, paramiko's code has a get_fingerprint call where it is fingerprinting data for the exchange to identify a difference, which can use any algorithm realistically. Anyhow, this is necessary because it appears that paramiko's maintainer is not really interested in fixing the md5 usage. As a result, we're forced to monkeypatch paramiko, which is loaded by netmiko, which is what NGS uses. This should be fixed in paramiko, but also it seems several changes been proposed without forward movement. https: //github.com/paramiko/paramiko/pull/688 https: //github.com/paramiko/paramiko/pull/1103 https: //github.com/paramiko/paramiko/pull/2189 https: //github.com/paramiko/paramiko/pull/2496 https: //github.com/paramiko/paramiko/issues/2383 https: //github.com/paramiko/paramiko/issues/396 Related-Bug: 2098819 Change-Id: Ia3fb9d2baa14be1726197d1115e92adc9ce5ce0a
1 parent 6711765 commit 8b474ce

File tree

1 file changed

+8
-1
lines changed
  • networking_generic_switch/devices/netmiko_devices

1 file changed

+8
-1
lines changed

networking_generic_switch/devices/netmiko_devices/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
import atexit
1616
import contextlib
1717
import functools
18+
import hashlib
1819
import uuid
1920

2021
import netmiko
2122
from oslo_config import cfg
2223
from oslo_log import log as logging
23-
import paramiko
24+
from paramiko import PKey as _pkey # noqa - This is for a monkeypatch
25+
import paramiko # noqa - Must load after the patch
2426
import tenacity
2527
from tooz import coordination
2628

@@ -30,6 +32,11 @@
3032
from networking_generic_switch import exceptions as exc
3133
from networking_generic_switch import locking as ngs_lock
3234

35+
# NOTE(TheJulia) monkey patch paramiko's get_finerprint function
36+
# to use sha256 instead of md5, since Paramiko's maintainer doesn't
37+
# seem to be concerned about FIPS compliance.
38+
_pkey.get_fingerprint = lambda x: hashlib.sha256(x.asbytes()).digest()
39+
3340
LOG = logging.getLogger(__name__)
3441
CONF = cfg.CONF
3542

0 commit comments

Comments
 (0)