r46959 - clean up some things
hawkowl-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org Wed, 9 Mar 2016 02:34:23 -0700 (MST)
| Newsgroups | gmane.comp.python.twisted.commits |
|---|---|
| Message-ID | <[email protected]> |
Author: hawkowl
Date: Wed Mar 9 02:34:19 2016
New Revision: 46959
Modified:
branches/manhole-hardcodedkey-8229/twisted/conch/manhole_tap.py
branches/manhole-hardcodedkey-8229/twisted/conch/ssh/keys.py
Log:
clean up some things
Modified: branches/manhole-hardcodedkey-8229/twisted/conch/manhole_tap.py
==============================================================================
--- branches/manhole-hardcodedkey-8229/twisted/conch/manhole_tap.py (original)
+++ branches/manhole-hardcodedkey-8229/twisted/conch/manhole_tap.py Wed Mar 9 02:34:19 2016
@@ -50,7 +50,8 @@
def requestAvatar(self, avatarId, *interfaces):
if telnet.ITelnetProtocol in interfaces:
return (telnet.ITelnetProtocol,
- self.protocolFactory(*self.protocolArgs, **self.protocolKwArgs),
+ self.protocolFactory(*self.protocolArgs,
+ **self.protocolKwArgs),
lambda: None)
raise NotImplementedError()
@@ -58,12 +59,20 @@
class Options(usage.Options):
optParameters = [
- ["telnetPort", "t", None, "strports description of the address on which to listen for telnet connections"],
- ["sshPort", "s", None, "strports description of the address on which to listen for ssh connections"],
- ["passwd", "p", "/etc/passwd", "name of a passwd(5)-format username/password file"],
- ["sshKeyDir", None, None, "Directory where the autogenerated SSH key is kept."],
- ["sshKeyName", None, None, "Filename of the autogenerated SSH key."],
- ["sshKeySize", None, 4096, "Size of the automatically generated SSH key."],
+ ["telnetPort", "t", None,
+ ("strports description of the address on which to listen for telnet "
+ "connections")],
+ ["sshPort", "s", None,
+ ("strports description of the address on which to listen for ssh "
+ "connections")],
+ ["passwd", "p", "/etc/passwd",
+ "name of a passwd(5)-format username/password file"],
+ ["sshKeyDir", None, None,
+ "Directory where the autogenerated SSH key is kept."],
+ ["sshKeyName", None, None,
+ "Filename of the autogenerated SSH key."],
+ ["sshKeySize", None, 4096,
+ "Size of the automatically generated SSH key."],
]
def __init__(self):
@@ -72,7 +81,8 @@
def postOptions(self):
if self['telnetPort'] is None and self['sshPort'] is None:
- raise usage.UsageError("At least one of --telnetPort and --sshPort must be specified")
+ raise usage.UsageError(
+ "At least one of --telnetPort and --sshPort must be specified")
@@ -98,6 +108,13 @@
"passwd": Name of a passwd(5)-format username/password file.
+ "sshKeyDir": The folder that the SSH server key will be kept in. If
+ None, it is in the user's data dir.
+
+ "sshKeyName": The filename of the key. If None, it is "server.pem".
+
+ "sshKeySize": The size of the key, in bits. Default is 4096.
+
@rtype: L{twisted.application.service.IService}
@return: A manhole service.
"""
Modified: branches/manhole-hardcodedkey-8229/twisted/conch/ssh/keys.py
==============================================================================
--- branches/manhole-hardcodedkey-8229/twisted/conch/ssh/keys.py (original)
+++ branches/manhole-hardcodedkey-8229/twisted/conch/ssh/keys.py Wed Mar 9 02:34:19 2016
@@ -1283,9 +1283,9 @@
# working PEM file. Load it!
# (Future archelogical readers: I chose not to short circuit above, because
# then there's two exit paths to this code!)
- with pemFile.open("rb") as key_file:
+ with pemFile.open("rb") as keyFile:
privateKey = serialization.load_pem_private_key(
- key_file.read(),
+ keyFile.read(),
password=None,
backend=default_backend()
)