Skip to content

Commit 69e8826

Browse files
authored
Merge pull request #93 from ploxiln/env_key_upd_types
network: update key_from_env() pkey types
2 parents edac6ec + 25b50a1 commit 69e8826

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

fabric/network.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,12 @@ def key_from_env(passphrase=None):
224224

225225
if 'key' in env:
226226
if output.debug:
227-
# NOTE: this may not be the most secure thing; OTOH anybody running
228-
# the process must by definition have access to the key value,
229-
# so only serious problem is if they're logging the output.
230-
sys.stderr.write("Trying to honor in-memory key %r\n" % env.key)
231-
for pkey_class in (ssh.rsakey.RSAKey, ssh.dsskey.DSSKey):
227+
sys.stderr.write("Trying to honor in-memory env.key %.66r...\n" % env.key)
228+
229+
for pkey_type in ['Ed25519Key', 'ECDSAKey', 'RSAKey', 'DSSKey']:
230+
pkey_class = getattr(ssh, pkey_type, None)
231+
if pkey_class is None:
232+
continue
232233
if output.debug:
233234
sys.stderr.write("Trying to load it as %s\n" % pkey_class)
234235
try:
@@ -243,6 +244,9 @@ def key_from_env(passphrase=None):
243244
else:
244245
pass
245246

247+
if output.debug:
248+
sys.stderr.write("Failed to load env.key\n")
249+
246250

247251
def parse_host_string(host_string):
248252
# Split host_string to user (optional) and host/port

0 commit comments

Comments
 (0)