From larstiq at larstiq.dyndns.org Thu Feb 8 09:04:58 2007 From: larstiq at larstiq.dyndns.org (Wouter van Heyst) Date: Thu, 8 Feb 2007 18:04:58 +0100 Subject: [paramiko] Broken listinfo link Message-ID: <20070208170458.GB19218@larstiq.dyndns.org> Hi all, On lag.net/paramiko there is a link to this mailinglist under the documentation header, but it seems broken. http://www.lag.net/mailman/listinfo/paramiko I'm mailing this to the list also to see if the actualy list itself is still working. Wouter van Heyst -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: Digital signature Url : http://www.lag.net/pipermail/paramiko/attachments/20070208/7086e6d9/attachment.pgp From jonathan.sabo at gmail.com Thu Feb 8 10:23:37 2007 From: jonathan.sabo at gmail.com (Jon Sabo) Date: Thu, 8 Feb 2007 13:23:37 -0500 Subject: [paramiko] Broken listinfo link In-Reply-To: <20070208170458.GB19218@larstiq.dyndns.org> References: <20070208170458.GB19218@larstiq.dyndns.org> Message-ID: Sweet it is working! I was on #bzr earlier asking to have the link on the paramiko site fixed too. I had a question about executing commands on remote servers and how to receive the output from them. I want to make a script that will allow you to specify the username and password and a sudo user an password so you can execute commands remotely. Another thing i want to do is to use it with pexpect to connect to these terminal servers I have and tell me what hosts they are really connected to.... the sh hosts output is all wrong and I want to automate generating t he host map. Anyway. This is what I have so far. Just a modified demo.py: I'm by no means great at python yet so suggestions and help is definitely wanted... Its here: http://www.illfunction.com/~illsci/code/pssh.py And here: >>> (01:26 PM) (jsabo at frostedflakes) (0/pts/0) (~/Projects/pssh) $ cat pssh.py #!/usr/bin/env python # This is just a modified demo.py from the paramiko module examples # Yay no nsh! import base64 from binascii import hexlify from optparse import OptionParser import getpass import os import select import socket import sys import threading import time import traceback import paramiko import interactive import pexpect def agent_auth(transport, username): """ Attempt to authenticate to the given transport using any of the private keys available from an SSH agent. """ agent = paramiko.Agent() agent_keys = agent.get_keys() if len(agent_keys) == 0: return for key in agent_keys: print 'Trying SSH agent key: %s' % hexlify(key.get_fingerprint()), try: transport.auth_publickey(username, key) return except paramiko.SSHException: print 'SSH agent key: %s Failed!' % hexlify(key.get_fingerprint ()) def manual_auth(transport, username, password): """ Attempt to authenticate to the given transport using passwd authentication """ try: transport.auth_password(username, password) except: print "Password Authentication failed" sys.exit(1) def ssh_connect(hostname, port): """ Connect to remote server and return socket. """ try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((hostname, port)) except Exception, e: print 'Connection failed: ' + str(e) traceback.print_exc() sys.exit(1) return sock def get_transport(socket): """ Get transport. """ try: transport = paramiko.Transport(socket) transport.start_client() except paramiko.SSHException: print 'Secure Shell negotiation failed.' traceback.print_exc() sys.exit(1) return transport def check_hostkey(transport, hostname, known_keys): """ Check server's host key -- this is important. """ remote_key = transport.get_remote_server_key() if not known_keys.has_key(hostname): print 'WARNING: Unknown host key!' elif not known_keys[hostname].has_key(remote_key.get_name()): print 'WARNING: Unknown host key!' elif known_keys[hostname][remote_key.get_name()] != remote_key: print 'WARNING: Host key has changed!!!' sys.exit(1) else: print 'Host key OK.' def get_knownhosts_keys(): """ Read in your known hosts file and get the keys. """ try: known_keys = paramiko.util.load_host_keys(os.path.expanduser ('~/.ssh/known_hosts')) except IOError: print 'Unable to open host keys file' known_keys = {} return known_keys def main(): # Remote Auth info hostname = "myhostname" port = int("22") username = "myuser" passwd = "apasswd" sudo_user = "root" logfile = "pssh.log" command = "touch boh.txt" #passwd = getpass.getpass('Password for %s@%s: ' % (username, hostname)) # Turn on logging paramiko.util.log_to_file(logfile, level=1) mysock = ssh_connect(hostname, port) t = get_transport(mysock) known_keys = get_knownhosts_keys() check_hostkey(t, hostname, known_keys) agent_auth(t, username) if not t.is_authenticated(): manual_auth(t, username, passwd) if not t.is_authenticated(): print 'Authentication Failed.' t.close() sys.exit(1) chan = t.open_session() chan.exec_command(command) chan.close() t.close() if __name__ == "__main__": main() On 2/8/07, Wouter van Heyst wrote: > > Hi all, > > On lag.net/paramiko there is a link to this mailinglist under the > documentation header, but it seems broken. > http://www.lag.net/mailman/listinfo/paramiko > > I'm mailing this to the list also to see if the actualy list itself is > still working. > > Wouter van Heyst > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iQCVAwUBRctYOenTGucjhaP+AQIEYQP/aRsq6AvLC8fYN77ItMOB56gVbVWUaatA > hCUyPzwjBKOwaWWqnw8h4XOozdK4xL4FDfEEajrfeTfdpCpgNan/FHW7ai24Vw9S > nBB4baGjAZlm4rwWuAuRp/azr1v/6XkDBVAvLpM6KpqEmV9bSr9iB6GsbOU93Ixd > 51+wXksFAqg= > =x37y > -----END PGP SIGNATURE----- > > _______________________________________________ > paramiko mailing list > paramiko at lag.net > http://www.lag.net/mailman/listinfo/paramiko > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lag.net/pipermail/paramiko/attachments/20070208/45d68aa6/attachment.htm From robey at lag.net Sat Feb 10 15:13:36 2007 From: robey at lag.net (Robey Pointer) Date: Sat, 10 Feb 2007 15:13:36 -0800 Subject: [paramiko] Broken listinfo link In-Reply-To: <20070208170458.GB19218@larstiq.dyndns.org> References: <20070208170458.GB19218@larstiq.dyndns.org> Message-ID: On 8 Feb 2007, at 9:04, Wouter van Heyst wrote: > Hi all, > > On lag.net/paramiko there is a link to this mailinglist under the > documentation header, but it seems broken. > http://www.lag.net/mailman/listinfo/paramiko > > I'm mailing this to the list also to see if the actualy list itself is > still working. Sorry about that. I moved the website to a new host last month, and I *knew* I would forget something in the process. Looks like mailman was the thing I forgot. :) I think everything should be fixed now. The mailman page is hosted on the mail server now, here: http://mail.lag.net/mailman/listinfo/paramiko I've updated the paramiko web page, and run a few arcane commands on mailman to tell it about the new urls. Please let me know if I've missed anything. robey From robey at lag.net Sat Feb 10 19:31:51 2007 From: robey at lag.net (Robey Pointer) Date: Sat, 10 Feb 2007 19:31:51 -0800 Subject: [paramiko] closing SFTP connections In-Reply-To: <45AEBA5E.50703@rsp.com.au> References: <457CABFC.1060508@rsp.com.au> <4585CCBA.4090408@rsp.com.au> <45AEBA5E.50703@rsp.com.au> Message-ID: <15CD7B50-19EF-42C4-A1BF-FBCD0060D479@lag.net> On 17 Jan 2007, at 16:07, Michael Gratton wrote: > Robey Pointer wrote: >> >> On 17 Dec 2006, at 15:03, Michael Gratton wrote: >>> Yep, but should the transport also automatically close once all >>> channels >>> are closed? We are seeing this happen most times, but for >>> something like >>> 1 in 20 connections, if all channels are closed (we're only >>> opening one >>> per transport) the transport isn't closed. >> >> It shouldn't ever happen. You can close all channels but may >> still want >> to open another channel over the same transport, and that should >> work. > > Oh! Okay, that's weird (the behaviour we're seeing, that is). > > It sounds pretty dumb, but we never were explicitly closing a > transport. > Channels that get opened were explicitly closed, but the transport > never > was. > > So during the course of this process running, a transport and channel > would be opened, the channel used then closed and the reference to the > transport lost. This would happen potentially multiple times during > the > course of one program execution. Usually the connection associated > with > the transport was closed - when the refcount for the transport got > to 0 > and it was GC'd, I assume. But sometimes the process would not exit > after it completed - a symptom of this was a still-open connection > that > the process was constantly select()ing (from memory). > > Anyway, it's not a problem anymore as we're now explicitly closing the > transport instances, but it seems like there might be some race or > other > condition when open transport instances are destroyed. > > Let me know if you want any more info. Ah, I might be able to clear it up a little bit: When a transport closes (even if only because it was GC'd), it closes all the channels. It just doesn't happen in reverse (a channel doesn't cause a transport to be closed). There are a few reasons why a transport might not be GC'd. Python is very finicky about calling destructors, so it's always better to close the transport explicitly. robey From apatrushev at gmail.com Wed Feb 14 06:16:42 2007 From: apatrushev at gmail.com (Anton Patrushev) Date: Wed, 14 Feb 2007 19:16:42 +0500 Subject: [paramiko] How to get trunk version of library ? Message-ID: Hello. I try to get trunk version of paramiko library and get following error: D:\Projects\Libraries\paramico>C:\Python24\Scripts\bzr.bat branch http://www.lag.net/paramiko/bzr/paramiko/ bzr: ERROR: Not a branch: http://www.lag.net/paramiko/bzr/paramiko/ How to get trunk version ? Do you plan to do nigthly trunk builds ? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.lag.net/pipermail/paramiko/attachments/20070214/a08700af/attachment.htm From robey at lag.net Sun Feb 18 12:55:42 2007 From: robey at lag.net (Robey Pointer) Date: Sun, 18 Feb 2007 12:55:42 -0800 Subject: [paramiko] How to get trunk version of library ? In-Reply-To: References: Message-ID: <8449B9FD-4593-4FF8-988B-2B9534373676@lag.net> On 14 Feb 2007, at 6:16, Anton Patrushev wrote: > Hello. > I try to get trunk version of paramiko library and get following > error: > D:\Projects\Libraries\paramico>C:\Python24\Scripts\bzr.bat branch > http://www.lag.net/paramiko/bzr/paramiko/ > bzr: ERROR: Not a branch: http://www.lag.net/paramiko/bzr/paramiko/ Weird, that ought to work. I just tried it myself: $ bzr branch http://www.lag.net/paramiko/bzr/paramiko/ and it successfully checked out the branch. Maybe your copy of bazaar is very old? > How to get trunk version ? > Do you plan to do nigthly trunk builds ? Getting a branch from bazaar should be sufficient, since there isn't any real "build" stage (paramiko is all python). robey -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.lag.net/pipermail/paramiko/attachments/20070218/7bb7e71f/attachment.htm From robey at lag.net Sun Feb 18 13:42:49 2007 From: robey at lag.net (Robey Pointer) Date: Sun, 18 Feb 2007 13:42:49 -0800 Subject: [paramiko] release: paramiko 1.7 Message-ID: <8E96E520-4CE9-4532-8191-9817658F3157@lag.net> Paramiko 1.7 is now released: http://www.lag.net/paramiko/ Reverse port forwarding and X11 channels were added, and a few months worth of collected bug fixes. v1.7 ZUBAT * added x11 channel support (patch from david guerizec) * added reverse port forwarding support * (bug 75370) raise an exception when contacting a broken SFTP server * (bug 80295) SSHClient shouldn't expand the user directory twice when reading RSA/DSS keys * (bug 82383) typo in DSS key in SSHClient * (bug 83523) python 2.5 warning when encoding a file's modification time * if connecting to an SSH agent fails, silently fallback instead of raising an exception Zubats are commonly found in caves and are one of the easiest pok?mon to catch. In its advanced form, it may use an attack called Mean Look, even though it has no eyes. This is also the last letter of the Latin alphabet, so I've run out of names for releases. Time to get more clever. :) robey