Skip to content

Commit b351b91

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "don't use paramiko's get_fingerprint (md5)"
2 parents d8261fd + 8b474ce commit b351b91

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)