summaryrefslogtreecommitdiffhomepage
path: root/demo_server.py
diff options
context:
space:
mode:
authorRobey Pointer <robey@lag.net>2003-12-24 20:49:38 +0000
committerRobey Pointer <robey@lag.net>2003-12-24 20:49:38 +0000
commit02319afd5ac24ebeed0d4f671179128c4fc39596 (patch)
tree117f99db047e245e72319d655e9f07a1fb49bfc9 /demo_server.py
parente7715095b649fd9582de4dff9930d9ee42013a6e (diff)
[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-12]
fix dss key signing (expanded on a patch from fred gansevles) add a demo dss key for server mode, and fix some bugs that had caused the dss signing stuff to never work before. the demo_server is a bit more verbose now, too. both key types (RSAKey & DSSKey) now have a function to return the fingerprint of the key, and both versions of read_private_key_file() now raise exceptions on failure, instead of just silently setting "valid" to false.
Diffstat (limited to 'demo_server.py')
-rwxr-xr-xdemo_server.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/demo_server.py b/demo_server.py
index 0c7ec518..90ab9bac 100755
--- a/demo_server.py
+++ b/demo_server.py
@@ -12,8 +12,12 @@ if len(l.handlers) == 0:
lh.setFormatter(logging.Formatter('%(levelname)-.3s [%(asctime)s] %(name)s: %(message)s', '%Y%m%d:%H%M%S'))
l.addHandler(lh)
-host_key = paramiko.RSAKey()
-host_key.read_private_key_file('demo_host_key')
+#host_key = paramiko.RSAKey()
+#host_key.read_private_key_file('demo_host_key')
+
+host_key = paramiko.DSSKey()
+host_key.read_private_key_file('demo_dss_key')
+print 'Read key: ' + paramiko.hexify(host_key.get_fingerprint())
class ServerTransport(paramiko.Transport):
@@ -54,12 +58,15 @@ except Exception, e:
try:
sock.listen(100)
+ print 'Listening for connection ...'
client, addr = sock.accept()
except Exception, e:
print '*** Listen/accept failed: ' + str(e)
traceback.print_exc()
sys.exit(1)
+print 'Got a connection!'
+
try:
event = threading.Event()
t = ServerTransport(client)